|
| 1 | +# YoloX-NAS |
| 2 | + |
| 3 | +---- |
| 4 | +### Prepare Dataset |
| 5 | +``` |
| 6 | +cd /data/dataset/ |
| 7 | +wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar |
| 8 | +tar xf VOCtrainval_06-Nov-2007.tar |
| 9 | +mkdir voc2007_coco |
| 10 | +cd voc2007_coco |
| 11 | +
|
| 12 | +wget https://raw.githubusercontent.com/yukkyo/voc2coco/master/voc2coco.py |
| 13 | +mkdir annotations |
| 14 | +ln -s ../VOCdevkit/VOC2007/Annotations . |
| 15 | +ln -s ../VOCdevkit/VOC2007/ImageSets . |
| 16 | +``` |
| 17 | + |
| 18 | +Add class_list.txt to this directory. |
| 19 | + |
| 20 | +``` |
| 21 | +python3 voc2coco.py --ann_dir Annotations/ --ann_ids ImageSets/Main/train.txt --labels class_list.txt --output annotations/instances_train.json --ext xml --extract_num_from_imgid |
| 22 | +python3 voc2coco.py --ann_dir Annotations/ --ann_ids ImageSets/Main/val.txt --labels class_list.txt --output annotations/instances_val.json --ext xml --extract_num_from_imgid |
| 23 | +
|
| 24 | +ln -s ../VOCdevkit/VOC2007/JPEGImages/ train2017 |
| 25 | +ln -s ../VOCdevkit/VOC2007/JPEGImages/ val2017 |
| 26 | +
|
| 27 | +**change to working directory.** |
| 28 | +
|
| 29 | +git clone https://github.com/Megvii-BaseDetection/YOLOX.git && cd YOLOX |
| 30 | +git checkout -b bootstrapnas bb9185c095dfd7a8015a1b82f3e9a065090860b8 |
| 31 | +git apply < /path/to/yolox-bootstrapnas.patch |
| 32 | +
|
| 33 | +cd datasets && ln -s ../../VOCdevkit/VOC2007 && cd - |
| 34 | +cd datasets && ln -s /data/dataset/voc2007_coco/ VOC2007 && cd - |
| 35 | +
|
| 36 | +poetry config --local virtualenvs.in-project true |
| 37 | +poetry install |
| 38 | +poetry shell |
| 39 | +
|
| 40 | +
|
| 41 | +#train without BootstrapNAS to get pretrained weight |
| 42 | +wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_nano.pth |
| 43 | +C=yolox_nano.pth |
| 44 | +PYTHONPATH=. nohup 2>&1 python tools/train.py -f exps/default/yolox_nano_voc-e50.py -d 1 -b 6 -o -c $C --cache |
| 45 | +
|
| 46 | +#train with BootstrapNAS using pretrained initial weight |
| 47 | +C=YOLOX_outputs/yolox_nano_voc-e50/best_ckpt.pth |
| 48 | +PYTHONPATH=. nohup 2>&1 python tools/train.py -f exps/default/first_try.py -d 1 -b 6 -o -c $C --cache --nncf_config_path nncf_config_yolox_bootstrapNAS.json |
| 49 | +``` |
0 commit comments