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
BMW TechOffice MUNICH 148 Dec 21, 2022
NeuroLKH: Combining Deep Learning Model with Lin-Kernighan-Helsgaun Heuristic for Solving the Traveling Salesman Problem

NeuroLKH: Combining Deep Learning Model with Lin-Kernighan-Helsgaun Heuristic for Solving the Traveling Salesman Problem Liang Xin, Wen Song, Zhiguang

xinliangedu 33 Dec 27, 2022
Swin-Transformer is basically a hierarchical Transformer whose representation is computed with shifted windows.

Swin-Transformer Swin-Transformer is basically a hierarchical Transformer whose representation is computed with shifted windows. For more details, ple

旷视天元 MegEngine 9 Mar 14, 2022
A lossless neural compression framework built on top of JAX.

Kompressor Branch CI Coverage main (active) main development A neural compression framework built on top of JAX. Install setup.py assumes a compatible

Rosalind Franklin Institute 2 Mar 14, 2022
Bringing Computer Vision and Flutter together , to build an awesome app !!

Bringing Computer Vision and Flutter together , to build an awesome app !! Explore the Directories Flutter · Machine Learning Table of Contents About

Padmanabha Banerjee 14 Apr 07, 2022
An open-source outlier detection package by Getcontact Data Team

pyfbad The pyfbad library supports anomaly detection projects. An end-to-end anomaly detection application can be written using the source codes of th

Teknasyon Tech 41 Dec 27, 2022
Source code for Fathony, Sahu, Willmott, & Kolter, "Multiplicative Filter Networks", ICLR 2021.

Multiplicative Filter Networks This repository contains a PyTorch MFN implementation and code to perform & reproduce experiments from the ICLR 2021 pa

Bosch Research 66 Jan 04, 2023
[ICCV'2021] "SSH: A Self-Supervised Framework for Image Harmonization", Yifan Jiang, He Zhang, Jianming Zhang, Yilin Wang, Zhe Lin, Kalyan Sunkavalli, Simon Chen, Sohrab Amirghodsi, Sarah Kong, Zhangyang Wang

SSH: A Self-Supervised Framework for Image Harmonization (ICCV 2021) code for SSH Representative Examples Main Pipeline RealHM DataSet Google Drive Pr

VITA 86 Dec 02, 2022
CVPRW 2021: How to calibrate your event camera

E2Calib: How to Calibrate Your Event Camera This repository contains code that implements video reconstruction from event data for calibration as desc

Robotics and Perception Group 104 Nov 16, 2022
DvD-TD3: Diversity via Determinants for TD3 version

DvD-TD3: Diversity via Determinants for TD3 version The implementation of paper Effective Diversity in Population Based Reinforcement Learning. Instal

3 Feb 11, 2022
A Python library for working with arbitrary-dimension hypercomplex numbers following the Cayley-Dickson construction of algebras.

Hypercomplex A Python library for working with quaternions, octonions, sedenions, and beyond following the Cayley-Dickson construction of hypercomplex

7 Nov 04, 2022
Repo for my Tensorflow/Keras CV experiments. Mostly revolving around the Danbooru20xx dataset

SW-CV-ModelZoo Repo for my Tensorflow/Keras CV experiments. Mostly revolving around the Danbooru20xx dataset Framework: TF/Keras 2.7 Training SQLite D

20 Dec 27, 2022
Fully Adaptive Bayesian Algorithm for Data Analysis (FABADA) is a new approach of noise reduction methods. In this repository is shown the package developed for this new method based on \citepaper.

Fully Adaptive Bayesian Algorithm for Data Analysis FABADA FABADA is a novel non-parametric noise reduction technique which arise from the point of vi

18 Oct 20, 2022
Tool cek opsi checkpoint facebook!

tool apa ini? cek_opsi_facebook adalah sebuah tool yang mengecek opsi checkpoint akun facebook yang terkena checkpoint! tujuan dibuatnya tool ini? too

Muhammad Latif Harkat 2 Jul 17, 2022
NNR conformation conditional and global probabilities estimation and analysis in peptides or proteins fragments

NNR and global probabilities estimation and analysis in peptides or protein fragments This module calculates global and NNR conformation dependent pro

0 Jul 15, 2021
Python KNN model: Predicting a probability of getting a work visa. Tableau: Non-immigrant visas over the years.

The value of international students to the United States. Probability of getting a non-immigrant visa. Project timeline: Jan 2021 - April 2021 Project

Zinaida Dvoskina 2 Nov 21, 2021
LoL Runes Recommender With Python

LoL-Runes-Recommender Para ejecutar la aplicación se debe llamar a execute_app.p

Sebastián Salinas 1 Jan 10, 2022
An architecture that makes any doodle realistic, in any specified style, using VQGAN, CLIP and some basic embedding arithmetics.

Sketch Simulator An architecture that makes any doodle realistic, in any specified style, using VQGAN, CLIP and some basic embedding arithmetics. See

12 Dec 18, 2022
This repository lets you interact with Lean through a REPL.

lean-gym This repository lets you interact with Lean through a REPL. See Formal Mathematics Statement Curriculum Learning for a presentation of lean-g

OpenAI 87 Dec 28, 2022
It's A ML based Web Site build with python and Django to find the breed of the dog

ML-Based-Dog-Breed-Identifier This is a Django Based Web Site To Identify the Breed of which your DOG belogs All You Need To Do is to Follow These Ste

Sanskar Dwivedi 2 Oct 12, 2022