Skip to content

GorkemP/EndoCV2021-EfficientDet-Pytorch

Repository files navigation

EndoCV2021 - Addressing generalisability in polyp detection and segmentation challenge & workshop

This repository can be used to train EfficientDet models on EndoCV2021 dataset and Kvasir-SEG dataset

🏆 The following paper (implementation of which is included in this repository) got the first rank in the polyp detection sub-challenge

Polyp Detection in Colonoscopy Images using Deep Learning and Bootstrap Aggregation

@inproceedings{polat2021polyp,
  author={Polat, Gorkem and Isik-Polat, Ece and Kayabay, Kerem and Temizel, Alptekin},
  title={Polyp Detection in Colonoscopy Images using Deep Learning and Bootstrap Aggregation},
  booktitle = {Proceedings of the 3rd International Workshop and Challenge on Computer
               Vision in Endoscopy (EndoCV 2021) co-located with with the 18th {IEEE}International Symposium on Biomedical Imaging {(ISBI} 2021), Nice,
               France, April 13, 2021},
  volume    = {2886},
  publisher = {CEUR-WS.org},
  pages={90--100},
  year      = {2021}
}
}

EfficientDet implementation is directly adapted from the zylo117 EfficientDet repository.

Several additions are made to the standard repository:

  • wandb integration is provided into code. Every nth step, training report the mAP of train and validation sets to the wandb platform.
  • Early stopping is added. If there is no increase in the mAP of validation set for the last n epoch, training stops.
  • Learning rate scheduling is added. If there is no increase in the mAP of the validation set for the last k epoch, learning rate is decreased with a factor of m.
  • Albumentations library is used to augment dataset.
  • Ensemble code that merges different predictions is added. It uses weighted box fusion technique.
  • And several example scripts:
    • Inference on single image
    • Visualizations of augmentations

Proposed approach

flowchart of polyp detection framework

Prediction of individual models (first row) and their ensemble result (second row)

polyp detection results

How to run

  • First, it is advised to experiment with the original repository to warmup
  • Setup environment using environment.yml.
  • After downloading the EndoCV2021 dataset, use dataset_ops/split_to_4_fold.py to create bootstrap folders. Use dataset_ops/convert_* scripts if necessary.
    • split_to_4_fold.py creates CV folds for bootstrap aggregation. For each fold, different project should be created.
    • Since the original repository accepts COCO format, use convert_to_coco_format_*.py files to convert annotations.
  • Use train_custom_augmentation file to run the codes, set necessary parameters like project_name,efficientdet_version.
  • Use inference_on_4_model.py to get results for test set.
  • Use ensemble_4.py to use weighted-box ensemble results.
  • In the visualizations folder there are many scripts to visualize bounding boxes, individual and ensemble results.