Our work to propsose solution for AI4VN challenge: VAIPE: Medicine Pill Image Recognition Challenge.
We achieved 1st place in both public and private test
Link Slide
1. Create data_config.json file in inference folder.
File data_config.json contains path to train label and image directories of prescription and pill as well as inference (test) image directories of prescription and pill. Example data_config.json file.
2. About config.json file
There are several configs for trainning. The models trained on these configs are then ensembled in test phase. To train each config, put the content in file config.json
- Preprocess data preprocess.py (Run once)
python inference/preprocess.py
- Process OCR infer_ocr.py (Run once)
python inference/infer_ocr.py
- Train and Inference (Test):
- Train model with each config: Change config and run train_vaipe.py
python inference/train_vaipe.py
- Inference: run infer.py
- Download model weight in release and place in runs/train folder
- Run
python inference/infer.py
- Train model with each config: Change config and run train_vaipe.py
- Change [WANDB_TOKEN] to your wandb token
docker build . -t ai4vn:latest --build-arg WANDB_TOKEN=[WANDB_TOKEN]
- Preprocess
- Change volume dataset (line 3) to your local directory train and test (infer) dataset.
- Then run
bash scripts/preprocess.sh
- Process OCR
- Change volume dataset (line 3) to your local directory inference test image.
- Then run
bash scripts/infer_ocr.sh
- Train and Inference
- Train
- Change file config.json content with each config in folder cfg/docker
- Then run
bash scripts/train.sh
- Inference
- Download private test model weight in release and place in runs/train folder
runs └──train ├── yolov7_45_deg_40_gen │ └── weights │ └── best.pt ├── yolov7_45_with_newgen │ └── weights │ └── best.pt ├── yolov7_50_deg_40_gen_400epochs4 ├── yolov7-tiny_115_deg_40_gen ├──yolov741 ├──yolov7_50_deg_40_gen_singlecls_400epochs └── yolov7_45_deg_40_gen_singlecls4
- Change content of config.json as given in ensemble_config.json
- Then run
bash scripts/infer.sh
- Train
- Model weight stored in runs/train
- File runs/ensemble/results.csv is the inference (test) results.