Skip to content

j8n17/Object-Detection-for-Garbage-Classification

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object-detection-level2-cv-08

1. Introduction


본 과정은 NAVER Connect 재단 주관으로 인공지능과 딥러닝 Production의 End-to-End를 명확히 학습하고 실무에서 구현할 수 있도록 훈련하는 약 5개월간의 교육과정입니다. 전체 과정은 이론과정(U-stage, 5주)와 실무기반 프로젝트(P-stage, 15주)로 구성되어 있으며, 두 번째 대회인 Object detection과제에 대한 Level2 - 08조 의 문제해결방법을 기록합니다.


🧙‍♀️ 주행 청소년

🔅 Members

허 석 이준혁 윤서연 김 준 이재홍
Github Github Github Github Github

🔅 Contribution

  • 허 석 yolov5 model 실험 / mmdection Cascade 구조 사용 및 분석
  • 이준혁 data augmentation 실험 / EfficientDet 모델 실험
  • 윤서연 EDA&pseudo labeling json 파일 생성 코드 / detectron2 라이브러리 사용하여 모델 학습
  • 김 준 mmdetection 코드 분석 / atss, dyhead 활용 / 앙상블
  • 이재홍 analysis tool 코드 작성 / mmdetection 모델 실험 / Cross-Validation 코드 작성

⚙ Development Environment

  • 협업 툴 : GitHub, WandB, Notion
  • 개발 환경
    • OS : Ubuntu 18.04
    • GPU : V100
    • 언어 : Python 3.7
    • dependency : Pytorch 1.7.1

2. Project Outline

image image-20220413170311282
  • Task : Object detection
  • Date : 2022.03.21 - 2022.04.07 (3 weeks)
  • Description : 쓰레기 사진을 입력받아서 일반 쓰레기, 플라스틱, 종이, 유리 등를 추측하여 10개의 class로 분류하고 박스의 영역을 구합니다.
  • Image Resolution : (1024 x 1024)
  • Train : 4,833
  • Test : 4,871

objecteda

🏆 Final Score

image


3. Solution

KEY POINT

  • General trash가 데이터 양에 비해 낮은 검출율을 보였다.

    일반 쓰레기 범주가 너무 방대해서 생기는 문제로 보였다.

    ( 데이터셋 자체 문제로 인한 개선 불가 )

  • 클래스 간 불균형 문제

    Focal Loss, Over Sampling을 사용하여 개선

  • small / medium object에 대한 낮은 검출율

    Multiscale, base anchor size 조절, stride 조절을 통해 개선

  • 높은 bias로 인한 under fitting

    더 큰 backbone (Swin L)을 이용하여 개선

  • 문제점 파악을 위한 Analysis Tool 사용 및 코드 작성


Checklist

[More Detail](여기다가 wrap up report 링크 달기)

  • Test Time Augmentation
  • Ensemble(ATSS, Cascade R-CNN, YOLOv5x 등)
  • Augmentation
  • Multi-scale learning
  • Oversampling
  • Pseudo labeling
  • Stratified K-fold
  • Transfer learning
  • WandB

Evaluation

Method mAP Pseudo Labeling
ATSS (Dyhead) 0.6443 O
Cascade R-CNN 0.6320 O
YOLOv5s 0.4492 X
YOLOv5m 0.5001 X
YOLOv5L 0.5182 X
YOLOv5x 0.5984 O
ATSS (Dyhead) + YOLOv5x (2개 ensemble) 0.6786 X
ATSS (Dyhead) + Cascade R-CNN + YOLOv5x (3개 ensemble) 0.6932 X

4. Project Structure

├── 📂 detectron2
│   ├── 📝 train.py
│   ├── 📝 inference.py
│   └── etc
├── 📂 mmdetection
│   ├── 📂 configs
│   │   └── 📂 custom
│   ├── 📂 tools
│   │   ├── 📝 train.py
│   │   ├── 📝 test.py
│   │   └── 📝 inference.py
│   └── etc
├── 📂 yolov5
│   ├── 📝 train.py
│   ├── 📝 detect.py
│   └── etc
└── 📂 custom analysis tools
    ├── 📝 S-Kfold.py
		├── 📝 pseudo_labeling.py
    ├── 📝 analysis.ipynb
		├── 📝 ensemble.ipynb
		└── etc
  • detectron2, mmdetection, yolov5에는 각각 library file들과 README.md가 존재합니다.
  • z_customs에는 stratified k-fold / pseudo labeling / analysis tool / ensemble 등 자체 구현 모듈이 존재합니다.
  • 각 라이브러리의 구성요소는 README.md에서 확인할 수 있습니다.

5. How to use

5-1. YOLOv5

  • Train

    python train.py --img {img size} --batch {batch size} --epochs {epochs} --data {data yaml location} --weights {weight file loacation} --multi_scale
  • Inference

    python detect.py --weights {weight file location} --source {data yaml location} --img {img size} --name {save name} --half --save-txt --save-conf --augment
  • to csv

    python txt2csv_for_submission.py --result_path {label txt location} --save_name {save_name}

5-2. detectron2

  • Train

    python train.py
    # cfg: .yaml 파일 변경
    # weight: cfg.MODEL.WEIGHTS 변경
  • Inference

    python inference.py
    # cfg: .yaml 파일 변경
    # weight: cfg.MODEL.WEIGHTS pth변경

5-3. mmdetection

  • Train

    python train.py [config file path] --work-dir [directory path to save logs and models]
  • Inference

    python inference.py [config file path] [checkpoint file path] --name [submission file name]

5-4. Analysis tool

  • custom analysis tools 내부에 readme 참고

About

BoostCamp AI Tech 3기 - 재활용 품목 분류를 위한 Object Detection 대회

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 80.7%
  • Python 18.6%
  • Cuda 0.3%
  • C++ 0.2%
  • Shell 0.2%
  • Dockerfile 0.0%