Skip to content

Object Classification Track in 2020 AI R&D Grand Challenge

Notifications You must be signed in to change notification settings

jaebbb/Recycle-Trash-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recycle Trash Detection

AI Grand Challenge (Nov 16, 2020 ~ Nov 20,2020)
🥈 2nd Place Winner of Object Classification Track


Environments

Ubuntu 18.04.5 LTS   
Python 3.7  
CUDA 10.2  

mmdet is forked from open-mmlab/mmdetection. Difference in mmdet/datasets/coco.py, variable CLASSES


Install

Requirements

$ git clone https://github.com/jaebbb/recycle-trash-detection.git
$ cd recycle-trash-detection
$ pip install -r requirements.txt
$ pip install mmpycocotools
$ pip install mmcv-full==1.1.6+torch1.5.0+cu102 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html --use-deprecated=legacy-resolver
$ pip install -v -e .

Preparing dataset

  • You can prepare datasets in here

Change json format to coco style

  • You can refer to the sample images and jsons' format in the dataset folder.
$ python3 change_jsonstyle/trash2coco.py

Training

*Important*: According to the Linear Scaling Rule, you need to set the learning rate proportional to the batch size
if you use different GPUs or images per GPU,
e.g., lr=0.01 for 4 GPUs * 2 img/gpu and lr=0.08 for 16 GPUs * 4 img/gpu.

# single-gpu training
$ python3 tools/train.py ${MODEL_FILE}   

# multi-gpu training  
$ ./tools/dist_train.sh ${MODEL_FILE}  ${GPU_NUM}  

e.g. python3 tools/train.py model/cascade.py

Inference

  • You will get json files result.json to be submit to the official evaluation server.
  • You can use the following commands to get result images.
  • Detection results will be plotted on the images and saved to the specified directory.
# single-gpu testing
$ python3 predict.py ${MODEL_FILE} ${WEIGHT_FILE} ${RESULT_FOLDER}
# multi-gpu testing
$ ./tools/dist_test.sh ${MODEL_FILE} ${WEIGHT_FILE} ${RESULT_FOLDER} ${GPU_NUM}

e.g. python3 tools/test.py model/cascade.py work_dirs/cascade/latest.pth ./result


Another option : Docker

  • We provide a Dockerfile to build an image.
$ sudo docker build -t ${IMAGE_NAME} docker/

e.g. sudo docker build -t recycle docker/

  • Run it with
$ docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/Recycle-Trash-Detection/dataset --name ${CONTAINER_NAME} ${IMAGE_NAME}

e.g. sudo docker run --gpus all --shm-size=8g -it -v ~/dataset/:/Recycle-Trash-Detection/dataset --name recycle_test recycle

About

Object Classification Track in 2020 AI R&D Grand Challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages