We train with Yolov7 and YoloR models and augment our data with three additional datasets.
Convert these data into Yolo format and change the labels to only four categories: cars, trucks, pedestrians, and motorcycles.
Create three folders (train\Val\Test) under the datasets folder
- train folder (Training dataset)
- val folder (Validation dataset)
- test folder (AI-CUP public and private datasets)
Once you have prepared three folders, then you should put the photos and labels from the three datasets mentioned above into the corresponding folders (e.g. Training photos should go in the train/images folder, and training labels should go in the train/labels folder), and then run create_txt.ipynb to create three txt files.
pip install -r yolov7/requirements.txt
python train_aux.py --workers 8 --device 0 --batch-size 8 --data data/aicup.yaml --img 1280 1280 --cfg cfg/training/yolov7-e6e.yaml --weights 'yolov7-e6e_training.pt' --name yolov7-e6e --hyp data/hyp.scratch.p6.yaml --epochs 500 --cache-images
Testing Weights
python detect.py --weights "runs/train/yolov7-e6e/weights/yolov7_best.pt" --source "../datasets/test/images/" --conf-thres 0.3 --img-size 1920 --augment --save-txt --save-conf
python train.py --batch-size 4 --img 1280 1280 --data data/aicup.yaml --cfg models/yolor-d6.yaml --weights 'yolor-d6-paper-573.pt' --device 0 --name yolor_d6 --hyp data/hyp.scratch.1280.yaml --epochs 500 --cache-image
Testing Weights
python detect.py --weights "runs/train/yolor_d62/weights/yolor_best.pt" --source "../datasets/test/images/" --conf-thres 0.45 --img-size 1920 --augment --save-txt --save-conf --device 0
pip install ensemble-boxes
Prepare the yolov7/yolor testing results as below structure:
-wbf
|- runs
| |- yolov7_exp (This folder is same as the exp folder under the yolov7/runs/detect)
| |- yolor_exp (This folder is same as the exp folder under the yolor/runs/detect)
Run the following cmd
[Current Woring Directory] AI-CUP_Drone/wbf
python wbf.py
Create the final csv result.
[Current Woring Directory] AI-CUP_Drone
python transform.py