Capsule endoscopy detection DACON challenge

Overview

capsule_endoscopy_detection (DACON Challenge)

Overview

  • Yolov5, Yolor, mmdetection기반의 모델을 사용 (총 11개 모델 앙상블)
    • 모든 모델은 학습 시 Pretrained Weight을 yolov5, yolor, mmdetection 및 swin transformer github로부터 받아서 사용
    • 각 방식에 필요한 형태로 데이터의 format 변경
  • Train set과 Validation set을 나누어 진행
  • 총 11개의 결과를 앙상블
    • detectors_casacde_rcnn_resnet50_multiscale, retinanet_swin-l, retinanet_swin-l_multiscale, retinanet_swin-t, atss_swin-l_multiscale, faster_rcnn-swin-l_multiscale, yolor_tta_multiscale, yolov5x, yolov5x_tta, yolov5x_tta_multiscale
    • Weighted boxes fusion (WBF) 방식으로 앙상블 진행 (Iou threshold = 0.4)
    • 모델에 관한 보다 자세한 내용은 /all_steps 폴더 내에 STEP2로 시작하는 .sh 스크립트들에 적힌 주석을 참고해주세요!

환경(env) 세팅

  • 실험 환경: Ubuntu 18.04, Cuda 11.3, Anaconda3, Python 3.8
  1. git clone ( + 폴더 권한 설정)
git clone https://github.com/MAILAB-Yonsei/capsule_endoscopy_detection.git
chmod -R 777 capsule_endoscopy_detection
cd capsule_endoscopy_detection
  1. cbnet만 제외한 나머지에 대한 env 생성 (all_except_cbnet)
conda create -n all_except_cbnet python=3.8
conda activate all_except_cbnet
pytorch 설치 (ex. conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch)
pip install openmim
mim install mmdet
pip install -r requirements_all_except_cbnet.txt
conda deactivate
  1. cbnet에 대한 env 생성 (cbnet)
conda create -n cbnet python=3.8
conda activate cbnet
pytorch 설치 (ex. conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch)
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
     (ex. pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html)
cd UniverseNet
pip install -r requirements/build.txt
pip install -v -e .  # or "python setup.py develop"
pip install instaboostfast
pip install git+https://github.com/cocodataset/panopticapi.git
pip install git+https://github.com/lvis-dataset/lvis-api.git
pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
pip install pandas
pip install tqdm
pip install shapely
conda deactivate
cd ..

main code 실행

[각 STEP 별로 자세한 설명은 /all_steps 폴더 내의 각각의 .sh 파일에 적힌 주석을 참고해주세요!]

STEP0. data root path 지정

cd all_steps
gedit data_path.txt

data_path.txt 파일에 data의 절대 경로를 명시한다!!! (ex. /mnt/data)

STEP1. data preparation (약 20~30분 소요)

conda activate all_except_cbnet
bash STEP1_data_preparation.sh

STEP2. 각 모델을 학습시킨다. (pretrained 모델로 inference만 하고자 한다면 바로 STEP3로!)

  • cbnet만 제외한 나머지에 대한 Training
conda activate all_except_cbnet
bash STEP2_train_model1_atss_swin-l_ms.sh
bash STEP2_train_model2_detectors_cascade_rcnn_r50_ms.sh
bash STEP2_train_model3_faster_rcnn_swin-l_ms.sh
bash STEP2_train_model4_retinanet_swin-l.sh
bash STEP2_train_model5_retinanet_swin-l_ms.sh
bash STEP2_train_model6_retinanet_swin-t_ms.sh
bash STEP2_train_model7_yolor.sh
bash STEP2_train_model8_yolo5x.sh
  • cbnet에 대한 Training
conda activate cbnet
bash STEP2_train_model9_cbnet_faster_rcnn_swin-l_ms.sh

STEP3. 모든 모델에 대해 Inference를 진행한다. (모델 하나당 20~30분 소요)

  • STEP2.를 건너뛰고 pretrained 모델에 대해 test를 하는 경우 아래 과정을 수행한 뒤 STEP3.의 명령어를 실행:
    • 아래의 weight 파일 링크에서 받은 mmdetection/ckpts 폴더를 /mmdetection 폴더 아래에 위치시킨다.
    • 아래의 weight 파일 링크에서 받은 UniverseNet/ckpts 폴더를 /UniverseNet 폴더 아래에 위치시킨다.
    • 아래의 weight 파일 링크에서 받은 YOLO/ckpts 폴더를 /YOLO 폴더 아래에 위치시킨다.
    • weight 파일 링크: https://drive.google.com/drive/folders/151KJC3FTUsK5mfx4TtNbhiFuuvLIeGz-?usp=sharing
  • cbnet만 제외한 나머지에 대한 Inference
conda activate all_except_cbnet
bash STEP3_inference_all_except_cbnet.sh
  • cbnet에 대한 Inference
conda activate cbnet
bash STEP3_inference_cbnet.sh

SETP4. 모든 모델에 대해 앙상블을 진행한다.

conda activate all_except_cbnet
bash STEP4_ensemble.sh
  • 최종 파일은 가장 상위 디렉토리에 'final.csv'로 생성!!!

주의사항

모두 순서에 맞게 코드를 구성해놓았기 때문에 하나의 코드를 2번 실행하는 등의 경우 진행에 어려움이 있을 수 있습니다. 참고해주세요.

현재 코드는 validation은 진행하지 않게 주석처리했습니다. 원하시면 predict.py에서 validation 주석처리를 풀고 val_answer.csv 파일의 경로를 설정해주시면 됩니다.

(predict.py 파일 위치: /mmdetection/predict/main.py, /UniverseNet/predict/main.py)

Owner
MAILAB
Medical Artificial Intelligence Laboratory at Yonsei University, Republic of Korea
MAILAB
Technical Analysis library in pandas for backtesting algotrading and quantitative analysis

bta-lib - A pandas based Technical Analysis Library bta-lib is pandas based technical analysis library and part of the backtrader family. Links Main P

DRo 393 Dec 20, 2022
Repository for benchmarking graph neural networks

Benchmarking Graph Neural Networks Updates Nov 2, 2020 Project based on DGL 0.4.2. See the relevant dependencies defined in the environment yml files

NTU Graph Deep Learning Lab 2k Jan 03, 2023
TorchIO is a Medical image preprocessing and augmentation toolkit for deep learning. Part of the PyTorch Ecosystem.

Medical image preprocessing and augmentation toolkit for deep learning. Part of the PyTorch Ecosystem.

Fernando Pérez-García 1.6k Jan 06, 2023
Tensorflow implementation of Fully Convolutional Networks for Semantic Segmentation

FCN.tensorflow Tensorflow implementation of Fully Convolutional Networks for Semantic Segmentation (FCNs). The implementation is largely based on the

Sarath Shekkizhar 1.3k Dec 25, 2022
Narya API allows you track soccer player from camera inputs, and evaluate them with an Expected Discounted Goal (EDG) Agent

Narya The Narya API allows you track soccer player from camera inputs, and evaluate them with an Expected Discounted Goal (EDG) Agent. This repository

Paul Garnier 121 Dec 30, 2022
This repository is for our EMNLP 2021 paper "Automated Generation of Accurate & Fluent Medical X-ray Reports"

Introduction: X-Ray Report Generation This repository is for our EMNLP 2021 paper "Automated Generation of Accurate & Fluent Medical X-ray Reports". O

no name 36 Dec 16, 2022
Video Autoencoder: self-supervised disentanglement of 3D structure and motion

Video Autoencoder: self-supervised disentanglement of 3D structure and motion This repository contains the code (in PyTorch) for the model introduced

157 Dec 22, 2022
The code for the NSDI'21 paper "BMC: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing".

BMC The code for the NSDI'21 paper "BMC: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing". BibTex entry available here. B

Orange 383 Dec 16, 2022
Assessing the Influence of Models on the Performance of Reinforcement Learning Algorithms applied on Continuous Control Tasks

Assessing the Influence of Models on the Performance of Reinforcement Learning Algorithms applied on Continuous Control Tasks This is the master thesi

Giacomo Arcieri 1 Mar 21, 2022
Code accompanying "Dynamic Neural Relational Inference" from CVPR 2020

Code accompanying "Dynamic Neural Relational Inference" This codebase accompanies the paper "Dynamic Neural Relational Inference" from CVPR 2020. This

Colin Graber 48 Dec 23, 2022
Official codebase used to develop Vision Transformer, MLP-Mixer, LiT and more.

Big Vision This codebase is designed for training large-scale vision models on Cloud TPU VMs. It is based on Jax/Flax libraries, and uses tf.data and

Google Research 701 Jan 03, 2023
(CVPR 2021) PAConv: Position Adaptive Convolution with Dynamic Kernel Assembling on Point Clouds

PAConv: Position Adaptive Convolution with Dynamic Kernel Assembling on Point Clouds by Mutian Xu*, Runyu Ding*, Hengshuang Zhao, and Xiaojuan Qi. Int

CVMI Lab 228 Dec 25, 2022
This repository is for DSA and CP scripts for reference.

dsa-script-collections This Repo is the collection of DSA and CP scripts for reference. Contents Python Bubble Sort Insertion Sort Merge Sort Quick So

Aditya Kumar Pandey 9 Nov 22, 2022
✨✨✨An awesome open source toolbox for stereo matching.

OpenStereo This is an awesome open source toolbox for stereo matching. Supported Methods: BM SGM(T-PAMI'07) GCNet(ICCV'17) PSMNet(CVPR'18) StereoNet(E

Wang Qingyu 6 Nov 04, 2022
Python module providing a framework to trace individual edges in an image using Gaussian process regression.

Edge Tracing using Gaussian Process Regression Repository storing python module which implements a framework to trace individual edges in an image usi

Jamie Burke 7 Dec 27, 2022
Keras documentation, hosted live at keras.io

Keras.io documentation generator This repository hosts the code used to generate the keras.io website. Generating a local copy of the website pip inst

Keras 2k Jan 08, 2023
The backbone CSPDarkNet of YOLOX.

YOLOX-Backbone The backbone CSPDarkNet of YOLOX. In this project, you can enjoy: CSPDarkNet-S CSPDarkNet-M CSPDarkNet-L CSPDarkNet-X CSPDarkNet-Tiny C

Jianhua Yang 9 Aug 22, 2022
Material del curso IIC2233 Programación Avanzada 📚

Contenidos Los contenidos se organizan según la semana del semestre en que nos encontremos, y según la semana que se destina para su estudio. Los cont

IIC2233 @ UC 72 Dec 23, 2022
Pytorch Implementations of large number classical backbone CNNs, data enhancement, torch loss, attention, visualization and some common algorithms.

Torch-template-for-deep-learning Pytorch implementations of some **classical backbone CNNs, data enhancement, torch loss, attention, visualization and

Li Shengyan 270 Dec 31, 2022
Deep Residual Learning for Image Recognition

Deep Residual Learning for Image Recognition This is a Torch implementation of "Deep Residual Learning for Image Recognition",Kaiming He, Xiangyu Zhan

Kimmy 561 Dec 01, 2022