Code for 20th place solution in Boostcamp AI Tech Recycle Trash Semantic Segmentation Challenge.
Contributors
κΉμμ | μ΄μ μ§ | μ΄νλΉ | μ μΈμ’ | μ‘°νλ | νμ§ν | νμ ν |
---|---|---|---|---|---|---|
λλ μμ°, λλ μλΉμ μλμ μ΄λ©° 'μ°λ κΈ° λλ', 'λ§€λ¦½μ§ λΆμ‘±'κ³Ό κ°μ μ¬λ¬ μ¬ν λ¬Έμ λ₯Ό λ³κ³ μλ€.
λΆλ¦¬μκ±°λ μ΄λ¬ν νκ²½λΆλ΄μ μ€μΌ μ μλ λ°©λ²μ΄λ€. ν΄λΉ λνλ μ°λ κΈ°λ₯Ό Segmentationνλ λͺ¨λΈμ λ§λ€μ΄ μ νν λΆλ¦¬μκ±°λ₯Ό λλ κ²μ κΈ°μ¬νλ€.
-
Dataset μ€λͺ
- 512 x 512 ν¬κΈ°μ train 2617μ₯ (80%) , public test 417μ₯ (10%) , private test 420μ₯(10%)
- μ΄ 10κ°μ class μ‘΄μ¬
- Background, General trash, Paper, Paper pack, Metal, Glass, Plastic, Styrofoam, Plastic bag, Battery, Clothing
- coco formatμΌλ‘ images , annotations μ 보 μ‘΄μ¬
- images : id, height , width, filename
- annotatins : id, segmentation mask , bbox, area, category_id , image_id
-
νκ°λ°©λ²
- Semantic Segmentation : mIOU
-
Template
pytorch template νμμ λ§κ² μ§μ ꡬν -
Model
FCN
UNet, UNet++
DeepLab, DeepLab++, DeepLab+++
HRNet, HRNet_OCR -
Techniques
Data hard augmentation
Mixup, Cutmix
Stratified K-Fold
Pseudo Labeling
TTA
Ensemble
WandB
segmentation
βββ input
β βββ data
βββ semantic-segmentation-level2-cv-02
β βββ base
β βββ data_loader
β βββ logger
β βββ loss
β βββ model
β βββ trainer
β βββ utils
βββ train.py
βββ train_kfold.py
βββ test.py
βββ test_TTA.py
βββ visulaize.py
βββ csv_ensemble.py
βββ create_resize_data.py
cd segmentation/semantic-segmentation-level2-cv-02
- vanilla train
python train.py [config path]
python train.py configs/config.json
- k-fold train
config fileμ μλμ κ°μ μΈμ μΆκ°"kfold": { "flag": true, "cnt": 5, "train_fold": "../input/data/train_fold.json", "valid_fold": "../input/data/val_fold.json" },
python train_kfold.py [config path]
- Pseudo Labeling Train & Inference
512x512 λ‘ inference ν csv file μ€λΉ
python pseudo_labeling.py --test_csv [csv file path]
- Expeiment with 256x256 image λΉ λ₯Έ μ€νμ μν 256x256 scale image λ‘ μ€ν
python create_resize_data.py
resized data μ¬μ© μ config μμ train, validation data loader μλμ κ°μ΄ μμ
"data_loader": {
"type": "ResizedBasicDataLoader",
"args": {
"dataset": {
"type": "ResizedBasicDataset",
"args": {
"data_dir": "../input/resized_data_256",
"mode": "train",
"transform": {"type": "BasicTransform", "args": {}}
}
cd segmentation/semantic-segmentation-level2-cv-02
- vanilla inference
python test.py -c [config path] -r [pth path]
- TTA inference
python test_TTA.py -c [config path] -r [pth path]
- test μ΄λ―Έμ§ μκ°ν
semantic-segmentation-level2-cv-02/visualize.py μ submission_path μ μκ°ννκ³ μ νλ csvνμΌ κ²½λ‘ λ£κ³ Run Cell - validation μ΄λ―Έμ§ μκ°ν
wandb μ¬μ©, utils/wandb.py μ show_images_wandb ν¨μλ‘ validation μ μ΄λ―Έμ§ μκ°ν
ensemble_method : Hard Voting
cd segmentation/semantic-segmentation-level2-cv-02
submission.csv κ²½λ‘ μΆκ° ν
python csv_ensemble.py
Backbone : EfficientNet-b4
Segmentation Head : UNet++
Original Image | Ground Truth | Predicted Image |
---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
data license : Naver Boostcamp AI Tech λνκ΅μ‘μ© μ¬νμ© μ°λ κΈ° λ°μ΄ν°μ . CC BY 2.0