Dataset:
- Download
voc2012traindataset - Download
voc2007traindataset - Download
voc2007testdataset - Put all images in
JPEGImagesfolder invoc2012trainandvoc2007traintoImagesfolder as following:
βββ Dataset
βββ IMAGES
βββ 0001.jpg
βββ 0002.jpg
βββ LABELS
βββ 0001.txt
βββ 0002.txt
βββ train.txt
βββ test.txt
Each label consists of class and bounding box information. e.g 0001.txt :
1 255 247 425 468
0 470 105 680 468
1 152 356 658 754
How to convert .xml files to .txt format?
- Download this repo and modify
config.pyto convertVOCformat toYOLOformat labels
Implementation of YOLOv1 using PyTorch
Train:
Note: I trained the backbone on IMAGENET, around ~ 10 epochs, not sure how many it was but less then 20
python main.py --base_dir ../../Datasets/VOC/ --log_dir ./weights
usage: main.py [-h] --base_dir BASE_DIR --log_dir LOG_DIR [--init_lr INIT_LR] [--base_lr BASE_LR] [--momentum MOMENTUM] [--weight_decay WEIGHT_DECAY] [--num_epochs NUM_EPOCHS]
[--batch_size BATCH_SIZE] [--seed SEED]
Evaluation:
-
python eval.py -
In
evaluation.py,im_show=Falsechange toTrueto see the results.
Evaluate the detection result...
aeroplane 0.57
bicycle 0.46
bird 0.38
boat 0.25
bottle 0.14
bus 0.53
car 0.48
cat 0.61
chair 0.18
cow 0.34
diningtable 0.44
dog 0.52
horse 0.52
motorbike 0.49
person 0.49
pottedplant 0.21
sheep 0.43
sofa 0.38
train 0.69
tvmonitor 0.40
mAP 0.426056536787907
Detection
- To detect objects on an image run the
detect.py

