Skip to content

boostcampaitech4lv23cv3/level2_semanticsegmentation_cv-level2-cv-16

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trash Semantic Segmentation

Main

Contributors

CV-16조 💡 비전길잡이 💡
NAVER Connect Foundation boostcamp AI Tech 4th

민기 박민지 유영준 장지훈 최동혁
revanZX arislid youngjun04 FIN443 choipp
CVAT
Stratified K-Fold
ConvNeXt
SeMask
Pseudo-labeling
Ensemble
HorNet · Swin
Optimization
Data version test
ViT-Adapter
Data split · merge
WandB customization
EVA · DiNAT
Class weights
Annotation manual
Data
Cleansing
Data
Cleansing
Data
Cleansing
Data
Cleansing
Data
Cleansing

Links

Result

Result


문제 정의

  • 대량 생산, 대량 소비로 인한 '쓰레기 대란', '매립지 부족'과 같은 여러 사회 문제 발생
  • 정확한 분리수거를 돕는 우수한 성능의 모델을 개발하는 목적의 프로젝트

Dataset

image

  • 학습 데이터 3,272장(train 2,617장, validation 655장) / 평가 데이터 819장
  • 11개 클래스 : Background, General trash, Paper, Paper pack, Metal, Glass, Plastic, Styrofoam, Plastic bag, Battery, Clothing
  • 이미지 크기 : (512, 512)

Stratified Group K-Fold

k-fold

  • 매우 불균형한 전체 train set의 클래스 분포
  • 동일한 분포를 가지는 5개의 train, validation set 구성

Data Cleansing

Annotation Manual

  • 주어진 데이터의 경계선 annotation 오류 · 라벨링 일관성 부족 이슈
  • 전체 데이터 3272장 전수조사 · 메뉴얼 작성 및 Data Cleansing 진행
  • CVAT annotation tool 사용 - 상단 Link 메뉴얼 참고
  • Data Versioning
    • DataV1 : 수정 전 기본 데이터셋
    • DataV2 : Data Cleansing으로 1차 수정된 데이터셋
    • DataV3 : DataV2를 class별 area 기준으로 stratified k-fold 적용한 데이터셋

Model

image

method UperNet SeMask Mask2Former
model Swin
Hornet
ConvNeXt
Beit(V1/V2)
Swin Swin
Vit-adapter (beitV2)

Experiments

(1) 단일 모델 결과
(2) k-fold ensemble 적용 결과

(1) Model mIoU (2) Model mIoU
upernet_hornet_large 0.7310 upernet_hornet_large 0.7356
SeMask 0.7353 SeMask 0.7419
Mask2Former_Swin 0.7433 Mask2Former_Swin 0.7580
ViT-adapter 0.7418 ViT-adapter 0.7552

Ensemble

Swin-L Adapter SeMask Adapter
dataV2
UperNet
Beit
Swin-L
dataV3
Hornet Public
mIoU
✔︎ ✔︎ ✔︎ 0.7716
✔︎ ✔︎ ✔︎ ✔︎ ✔︎ ✔︎ 0.7810
✔︎ ✔︎ ✔︎ ✔︎ ✔︎ ✔︎ ✔︎ 0.7828
  • 다양한 모델들을 모두 포함시켰을 때 가장 높은 public mIoU 기록

Directory Structure

|-- 🗂 appendix             : 발표자료
|-- 🗂 detection            : MMdet 기반 Deformable Attention 의존 코드 포함
|-- 🗂 mmsegmentation       : hornet, convnext, Beit 포함
|-- 🗂 segmentation         : mask2former_beitV2 adapter 학습
|-- 🗂 SeMask-Segmentation  : Detectron2 기반, mask2former_swin, Semask 학습
|-- 🗂 tools                : kfold 및 앙상블 등 자체 제작 툴 포함
`-- README.md

Installation

nvidia-Apex

git clone https://github.com/NVIDIA/apex
cd apex
git checkout 22.05-dev
pip install -v --disable-pip-version-check --no-cache-dir ./

ViT-Adapter

# Check CUDA & torch version
python -c 'import torch;print(torch.__version__)'
pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

# Download mmcv-full==1.4.2 >> https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-with-pip
pip install mmcv-full==1.4.2 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7/index.html
pip install timm==0.4.12
pip install mmdet==2.22.0 # for Mask2Former
pip install mmsegmentation==0.20.2
ln -s ../detection/ops ./

# If error occurred, check below context
cd ops & sh make.sh # compile deformable attention

Deformable DETR

# Check CUDA version
wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
sh cuda_11.0.2_450.51.05_linux.run

# If cv2 error occurred
apt-get install libgl1-mesa-glx

# Add this code to /root/.bashrc
export PATH="/usr/local/cuda-11.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH"

# Check CUDA & nvcc -V
source /root/.bashrc
python -c 'from torch.utils.cpp_extension import CUDA_HOME;print(CUDA_HOME)'

apt-get install g++

# Install MultiScaleDeformableAttention
cd ops
sh make.sh

Detectron2

apt-get install ninja-build

conda create -n d2 python=3.8
source activate d2
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=11.0 -c pytorch
python -m pip install detectron2==0.5 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu110/torch1.7/index.html

# If error occurred (torch 1.7.0 requires dataclasses, which is not installed)
pip install dataclasses

# MultiScaleDeformableAttention 설치 방법은 Vit-adapter과 동일
git clone https://github.com/IDEA-Research/MaskDINO.git
cd MaskDINO
pip install -r requirements.txt
cd maskdino/modeling/pixel_decoder/ops
sh make.sh

About

level2_semanticsegmentation_cv-level2-cv-16 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Packages

No packages published