Reproduce result on scoreboard with trained model
Build docker image:
docker build -t khiemledev/unstable_vaipe .
Run docker image:
docker run --rm --gpus <gpu_id> --shm-size 8G -v <your_output_path>:/output -v /data_folder:/data/public_test khiemledev/unstable_vaipe
# e.g
docker run -it --rm --gpus 1 --shm-size 8G -v $PWD/output1:/output -v /databases/VAIPE/public_test_new:/data/public_test khiemledev/unstable_vaipe
We use YOLOv7 to detect pill name in prescription.
Steps to train:
- Convert prescription data to YOLO format with single class (text only)
- Cd into your yolov7 folder
- Change your data path in
data/vaipe_text_det.yaml
- Run training command:
python3 train.py --weights yolov7-w6_training.pt --cfg cfg/training/yolov7-w6-text-det.yaml --data data/vaipe_text_det.yaml --hyp data/hyp.scratch.custom.yaml --epochs 100 --batch-size 4 --imgsz 1280
We use YOLOR to detect pill in image.
Steps to train:
- Convert pill data to YOLO format with single class (pill only) (all dataset for train and 15% for validation)
- Cd into your yolor folder
- Change your data path in
data/vaipe.yaml
- Dowload pretrained yolor_p6.pt from the repo
- Run training command:
python3 -m torch.distributed.launch --nproc_per_node 2 --master_port 9527 train.py --batch-size 16 --img 1280 1280 --data vaipe.yaml --cfg cfg/vaipe.cfg --weights 'yolor_p6.pt' --device 0,1 --sync-bn --name vaipe --hyp hyp.scratch.1280.yaml --epochs 19
We use FGVC-PIM as our classifier.
Steps to train:
- Crop pill image from provided bounding box and convert it into ImageNet format (Only use class from 0 - 106).
- We trained 2 phases, first, split 80% for train, 10% for validate and 10% for test (100 epochs). Then merge all folder train, validate, test in in train folder and keep old validate folder (100 epochs).
- Cd into my FGVC-PIM
- Change your data path and others configs in configs/vaipe.yaml
- Run traning command:
python3 main.py --c configs/vaipe.yaml