The official implementation of CircleNet: Anchor-free Detection with Circle Representation, MICCAI 2030

Overview

CircleNet: Anchor-free Detection with Circle Representation

The official implementation of CircleNet, MICCAI 2020

[PyTorch] [project page] [MICCAI paper]

Object detection networks are powerful in computer vision, but not necessarily optimized for biomedical object detection. In this work, we propose CircleNet, a simple anchor-free detection method with circle representation for detection of the ball-shaped glomerulus. Different from the traditional bounding box based detection method, the bounding circle (1) reduces the degrees of freedom of detection representation, (2) is naturally rotation invariant, (3) and optimized for ball-shaped objects.

full citation is

Haichun Yang, Ruining Deng, Yuzhe Lu, Zheyu Zhu, Ye Chen, Joseph T. Roland, Le Lu, Bennett A. Landman, Agnes B. Fogo, and Yuankai Huo. "CircleNet: Anchor-free Detection with Circle Representation." arXiv preprint arXiv:2006.02474 (2020).

Envrioment Set up

We used CUDA 10.2 and PyTorch 0.4.1.

The implementation is based on the CenterNet. https://github.com/xingyizhou/CenterNet

Please install the packages, following https://github.com/xingyizhou/CenterNet/blob/master/readme/INSTALL.md

  • For "Clone this repo" step, please clone CircleNet rather than CenterNet

Testing on a whole slide image

The Case 03-1.scn file is avilable https://vanderbilt.box.com/s/s530m45rvk626xi1thwcdc2bhoea758r

The model_10.pth model file is avilable (human kidney) https://vumc.box.com/s/wpar2kz9600h9ao3wowjzc3y50znneop

To run it on a testing scan, please go to "src" folder and run

python run_detection_for_scn.py circledet --arch dla_34 --demo "/media/huoy1/48EAE4F7EAE4E264/Projects/from_haichun/batch_1_data/scn/Case 03-1.scn" --load_model /media/huoy1/48EAE4F7EAE4E264/Projects/detection/CircleNet/exp/circledet/kidpath_dla_batch4/model_10.pth --filter_boarder --demo_dir "/media/huoy1/48EAE4F7EAE4E264/Projects/detection/test_demo"

The demo_dir is output dir, which you set anywhere in your computer.

After running code, you will see a Case 03-1.xml file. Then you put the xml and scn files into the same folder, and open the scn file using ImageScope software (only avilable in Windows OS), you can see something like the following image, with green detection results.

A Google Colab demo of the above testing code is added

https://github.com/hrlblab/CircleNet/blob/master/src/circle_net_demo.ipynb

Run your own training code

The training code is

python main.py circledet --exp_id kidpath_dla_batch4 --arch dla_34 --batch_size 4 --master_batch 4 --lr 2.5e-4   --gpus 0 --print_iter 1  --dataset kidpath --save_all --load_model ../models/ctdet_coco_dla_2x.pth

You can get the ctdet_coco_dla_2x.pth model from model zoo https://github.com/xingyizhou/CenterNet/blob/master/readme/MODEL_ZOO.md

Comments
  • Running demo.ipynb

    Running demo.ipynb

    Hi, I have followed all your steps on demo.ipynb, but when I run the final command, it show this kind of error. How do I solve it. And is there new version for CUDA 10.1 10.2 or 9.1 to run this code. 777a014e550553dd6a27cc6ed9cdb99

    opened by XiaobingDean 8
  • 转COCO数据集格式请教

    转COCO数据集格式请教

    The nuclei dateset with annotation file can be found here: https://github.com/hrlblab/CircleNet/blob/master/docs/DATA.md

    1 在COCO格式的注释里,annotations中的segmentation字段多出了如下图所示的内容,其中width和height在image字段中已经出现了,如果直接用circlenet直接训练的话,这个必须加吗? image

    2 extreme_points代表什么意思? 3 MoNuSeg_extreme_train2021.json和MoNuSeg_train2021.json有什么区别?

    opened by lixiangMindSpore 8
  • circle loss

    circle loss

    Hello, thank you for your code sharing. I encountered the following problems when training my dataset: first, the training loss seems to be the same as that of centernet, with no circle loss. Second, Why is cIOU not reflected in loss. Hope to get your answer, thank you.

    opened by manongXT 5
  • Validation loss increases after a certain epoch.

    Validation loss increases after a certain epoch.

    Hi, I realized that my validation loss is increasing over time after a certain epoch while the training loss is converging. It seems to me that the network is overfitting. I have tried disabling random cropping, and introduced augmentations to mitigate this issue, however the problem seems to remain. I'm fairly new to neural network training, any suggestion is much appreciated!

    Screenshot from 2022-11-17 11-39-49 Screenshot from 2022-11-17 11-40-02

    Here is my opt file:

    ==> cudnn version: 7104
    ==> Cmd:
    ['main.py', 'circledet', '--exp_id', 'Apple5', '--arch', 'hourglass', '--batch_size', '4', '--master_batch', '4', '--lr', '2.5e-4', '--dataset', 'apple2', '--load_model', '/home/lmga-titanx/CircleNet/src/lib/models/ctdet_coco_hg.pth', '--num_epochs', '1000', '--input_w', '128', '--input_h', '128', '--K', '1', '--not_rand_crop', '--rotate', '1']
    ==> Opt:
      K: 1
      aggr_weight: 0.0
      agnostic_ex: False
      arch: hourglass
      aug_ddd: 0.5
      aug_rot: 0
      batch_size: 4
      cat_spec_wh: False
      center_thresh: 0.1
      chunk_sizes: [4]
      data_dir: /home/lmga-titanx/CircleNet/src/lib/../../data
      dataset: apple2
      debug: 0
      debug_dir: /home/lmga-titanx/CircleNet/src/lib/../../exp/circledet/Apple5/debug
      debugger_theme: white
      demo: 
      demo_dir: 
      dense_hp: False
      dense_wh: False
      dep_weight: 1
      dim_weight: 1
      down_ratio: 4
      eval_oracle_dep: False
      eval_oracle_hm: False
      eval_oracle_hmhp: False
      eval_oracle_hp_offset: False
      eval_oracle_kps: False
      eval_oracle_offset: False
      eval_oracle_wh: False
      exp_dir: /home/lmga-titanx/CircleNet/src/lib/../../exp/circledet
      exp_id: Apple5
      ez_guassian_radius: False
      filter_boarder: False
      fix_res: True
      flip: 0.5
      flip_test: False
      gpus: [0]
      gpus_str: 0
      head_conv: 64
      heads: {'hm': 1, 'cl': 1, 'reg': 2}
      hide_data_time: False
      hm_hp: True
      hm_hp_weight: 1
      hm_weight: 1
      hp_weight: 1
      input_h: 128
      input_res: 128
      input_w: 128
      keep_res: False
      kitti_split: 3dop
      load_model: /home/lmga-titanx/CircleNet/src/lib/models/ctdet_coco_hg.pth
      lr: 0.00025
      lr_step: [90, 120]
      lv: 2
      mask_focal_loss: False
      master_batch_size: 4
      mean: [[[0.40789655 0.44719303 0.47026116]]]
      metric: loss
      mse_loss: False
      nms: False
      no_color_aug: False
      norm_wh: False
      not_cuda_benchmark: False
      not_hm_hp: False
      not_prefetch_test: False
      not_rand_crop: True
      not_reg_bbox: False
      not_reg_hp_offset: False
      not_reg_offset: False
      num_classes: 1
      num_epochs: 1000
      num_iters: -1
      num_stacks: 2
      num_workers: 4
      off_weight: 1
      ontestdata: False
      output_h: 32
      output_res: 32
      output_w: 32
      pad: 127
      peak_thresh: 0.2
      print_iter: 0
      rect_mask: False
      reg_bbox: True
      reg_hp_offset: True
      reg_loss: l1
      reg_offset: True
      resume: False
      root_dir: /home/lmga-titanx/CircleNet/src/lib/../..
      rot_weight: 1
      rotate: 1.0
      rotate_reproduce: 0
      save_all: False
      save_dir: /home/lmga-titanx/CircleNet/src/lib/../../exp/circledet/Apple5
      scale: 0.4
      scores_thresh: 0.1
      seed: 317
      shift: 0.1
      std: [[[0.2886383  0.27408165 0.27809834]]]
      task: circledet
      test: False
      test_scales: [1.0]
      test_val_name: 
      trainval: False
      val_intervals: 1
      vis_thresh: 0.2
      wh_weight: 0.1```
    
    
    
    opened by EugeneKok97 4
  • Dataset Annotation Format

    Dataset Annotation Format

    If the dataset is inconvenient to publish, I hope to give pointers on the annotation of the dataset. It is best to provide an annotation file, thank you!!!

    opened by NCHUPP18170877081 3
  • Hi,I want to use other dataset instead of MoNuSeg2021,but the circle_center and circle_radius fields are not in the json file. How do I get them

    Hi,I want to use other dataset instead of MoNuSeg2021,but the circle_center and circle_radius fields are not in the json file. How do I get them

    for example

    Our dataset no circle_center and circle_radius fields in json file {"id": 1326, "image_id": 12, "category_id": 1, "iscrowd": 0, "area": 693, "bbox": [303.0, 270.0, 38.0, 30.0], "segmentation": [[337.0, 299.5, 315.0, 297.5, 305.0, 293.5, 302.5, 284.0, 307.5, 271.0, 314.0, 270.5, 324.0, 282.5, 331.0, 284.5, 333.0, 279.5, 340.5, 293.0, 337.0, 299.5]], "width": 500, "height": 500}

    The monuseg2021 dataset you provided have circle_center and circle_radius fields {"id": 65786, "image_id": 309, "category_id": 1, "iscrowd": 0, "area": 191, "bbox": [393.0, 305.0, 19.0, 14.0], "segmentation": [[410.0, 318.5, 395.0, 314.5, 392.5, 309.0, 398.0, 304.5, 405.0, 305.5, 411.5, 312.0, 410.0, 318.5]], "width": 512, "height": 512, "circle_center": [401.583984375, 313.134765625], "circle_radius": 9.980734386753602, "extreme_points": [[398, 304], [392, 309], [410, 318], [411, 312]]}

    opened by AKshang 2
  • Changing the input size

    Changing the input size

    Hi, I was trying to train CircleNet on my custom dataset with the image resolution of 128. I managed to train the NN with this following command: python main.py circledet --exp_id Apple2 --arch hourglass --batch_size 4 --master_batch 4 --lr 2.5e-4 --dataset apple --load_model /home/lmga-titanx/CircleNet/src/lib/models/ctdet_coco_hg.pth --input_res 128 --input_h 128 --input_w 128 --num_epochs 200

    However, when I tried to run detection with my trained model using the following script:

    TASK = 'circledet'
    opt = opts().init('{} --dataset {} --load_model {} --arch {} --input_w {} --input_h {} --K {}'.format(TASK, 'coco', MODEL_PATH, 'hourglass', 128,128, 1).split(' '))
    
    detector = detector_factory[opt.task](opt)
    ret = detector.run(img)['results']
    

    It returns an output that seemingly corresponds to the resolution of 512:

    {1: array([[356.9697   , 344.58255  , 263.82367  ,   0.7991894,   0.       ]],
          dtype=float32)}
    

    Can you please let me know what I may have done incorrectly? Thank you!

    opened by EugeneKok97 1
  • Some questions of training

    Some questions of training

    Now, I have my own COCO format dataset. I would like to train my own dataset. I intend to know the specific of command.

    https://github.com/hrlblab/CircleNet/blob/master/experiments/circledet_monuseg_dla.sh In circledet_monuseg_dla.sh, what's the meaning of exp_id? I have searched the key word "CircleNet_DLA_Reproduce" in the whole project, but I can't find the related code. image

    opened by lixiangMindSpore 1
  • No such file or directory when running demo

    No such file or directory when running demo

    I am running into an error when I run this command in the circle_net_demo.ipynb file

    !python run_detection_for_scn.py circledet --arch dla_34 --demo "/content/drive/My Drive/CircleNet/example_case/Case 03-1.scn" --load_model /content/drive/My\ Drive/CircleNet/trained_model/model_10.pth --filter_boarder --demo_dir "/content/drive/My Drive/CircleNet/demo_dir/test_demo"
    

    Here is the traceback

    Traceback (most recent call last):
      File "run_detection_for_scn.py", line 470, in <module>
        demo(opt)
      File "run_detection_for_scn.py", line 461, in demo
        run_one_scn(demo_scn, demo_dir, opt)
      File "run_detection_for_scn.py", line 241, in run_one_scn
        detector = Detector(opt)
      File "/content/drive/MyDrive/CircleNet/src/lib/detectors/circledet.py", line 23, in __init__
        super(CircledetDetector, self).__init__(opt)
      File "/content/drive/MyDrive/CircleNet/src/lib/detectors/base_detector.py", line 25, in __init__
        self.model = load_model(self.model, opt.load_model)
      File "/content/drive/MyDrive/CircleNet/src/lib/models/model.py", line 34, in load_model
        checkpoint = torch.load(model_path, map_location=lambda storage, loc: storage)
      File "/usr/local/lib/python3.7/site-packages/torch/serialization.py", line 356, in load
        f = open(f, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/My Drive/CircleNet/trained_model/model_10.pth'
    
    opened by jhomatas48 1
Owner
The Biomedical Data Representation and Learning Lab
Official GitHub repository of HRLB lab at Vanderbilt
The Biomedical Data Representation and Learning Lab
CenterFace(size of 7.3MB) is a practical anchor-free face detection and alignment method for edge devices.

CenterFace Introduce CenterFace(size of 7.3MB) is a practical anchor-free face detection and alignment method for edge devices. Recent Update 2019.09.

StarClouds 1.2k Dec 21, 2022
Official implementation of "Dynamic Anchor Learning for Arbitrary-Oriented Object Detection" (AAAI2021).

DAL This project hosts the official implementation for our AAAI 2021 paper: Dynamic Anchor Learning for Arbitrary-Oriented Object Detection [arxiv] [c

ming71 215 Nov 28, 2022
Code for CVPR 2021 paper: Anchor-Free Person Search

Introduction This is the implementationn for Anchor-Free Person Search in CVPR2021 License This project is released under the Apache 2.0 license. Inst

null 158 Jan 4, 2023
Code for CVPR2021 paper "Learning Salient Boundary Feature for Anchor-free Temporal Action Localization"

AFSD: Learning Salient Boundary Feature for Anchor-free Temporal Action Localization This is an official implementation in PyTorch of AFSD. Our paper

Tencent YouTu Research 146 Dec 24, 2022
A high-performance anchor-free YOLO. Exceeding yolov3~v5 with ONNX, TensorRT, NCNN, and Openvino supported.

YOLOX is an anchor-free version of YOLO, with a simpler design but better performance! It aims to bridge the gap between research and industrial communities. For more details, please refer to our report on Arxiv.

null 7.7k Jan 6, 2023
YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with ONNX, TensorRT, ncnn, and OpenVINO supported.

Introduction YOLOX is an anchor-free version of YOLO, with a simpler design but better performance! It aims to bridge the gap between research and ind

null 7.7k Jan 3, 2023
Yoloxkeypointsegment - An anchor-free version of YOLO, with a simpler design but better performance

Introduction 关键点版本:已完成 全景分割版本:已完成 实例分割版本:已完成 YOLOX is an anchor-free version of

null 23 Oct 20, 2022
2021-MICCAI-Progressively Normalized Self-Attention Network for Video Polyp Segmentation

2021-MICCAI-Progressively Normalized Self-Attention Network for Video Polyp Segmentation Authors: Ge-Peng Ji*, Yu-Cheng Chou*, Deng-Ping Fan, Geng Che

Ge-Peng Ji (Daniel) 85 Dec 30, 2022
Pre-trained model, code, and materials from the paper "Impact of Adversarial Examples on Deep Learning Models for Biomedical Image Segmentation" (MICCAI 2019).

Adaptive Segmentation Mask Attack This repository contains the implementation of the Adaptive Segmentation Mask Attack (ASMA), a targeted adversarial

Utku Ozbulak 53 Jul 4, 2022
[MICCAI'20] AlignShift: Bridging the Gap of Imaging Thickness in 3D Anisotropic Volumes

AlignShift NEW: Code for our new MICCAI'21 paper "Asymmetric 3D Context Fusion for Universal Lesion Detection" will also be pushed to this repository

Medical 3D Vision 42 Jan 6, 2023
A simple python module to generate anchor (aka default/prior) boxes for object detection tasks.

PyBx WIP A simple python module to generate anchor (aka default/prior) boxes for object detection tasks. Calculated anchor boxes are returned as ndarr

thatgeeman 4 Dec 15, 2022
Unofficial implementation of Proxy Anchor Loss for Deep Metric Learning

Proxy Anchor Loss for Deep Metric Learning Unofficial pytorch, tensorflow and mxnet implementations of Proxy Anchor Loss for Deep Metric Learning. Not

Geonmo Gu 3 Jun 9, 2021
Codes for TIM2021 paper "Anchor-Based Spatio-Temporal Attention 3-D Convolutional Networks for Dynamic 3-D Point Cloud Sequences"

Codes for TIM2021 paper "Anchor-Based Spatio-Temporal Attention 3-D Convolutional Networks for Dynamic 3-D Point Cloud Sequences"

Intelligent Robotics and Machine Vision Lab 4 Jul 19, 2022
[ICLR 2022] DAB-DETR: Dynamic Anchor Boxes are Better Queries for DETR

DAB-DETR This is the official pytorch implementation of our ICLR 2022 paper DAB-DETR. Authors: Shilong Liu, Feng Li, Hao Zhang, Xiao Yang, Xianbiao Qi

null 336 Dec 25, 2022
Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

ming71 56 Nov 28, 2022
Eff video representation - Efficient video representation through neural fields

Neural Residual Flow Fields for Efficient Video Representations 1. Download MPI

null 41 Jan 6, 2023
PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.

st-nerf We provide PyTorch implementations for our paper: Editable Free-viewpoint Video Using a Layered Neural Representation SIGGRAPH 2021 Jiakai Zha

Diplodocus 258 Jan 2, 2023
[IJCAI-2021] A benchmark of data-free knowledge distillation from paper "Contrastive Model Inversion for Data-Free Knowledge Distillation"

DataFree A benchmark of data-free knowledge distillation from paper "Contrastive Model Inversion for Data-Free Knowledge Distillation" Authors: Gongfa

ZJU-VIPA 47 Jan 9, 2023
FuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space OptimizationFuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space Optimization

FuseDream This repo contains code for our paper (paper link): FuseDream: Training-Free Text-to-Image Generation with Improved CLIP+GAN Space Optimizat

XCL 191 Dec 31, 2022