Open dexception opened 6 years ago
0.004953125 0.31128989361702125 0.00990625 -0.2994414893617021
Height can't be less than zero.
What Python script do you use?
The file in scripts folder voc_label.py contains the convert method but the correct method for coco dataset should be:
def convert(size, box):
box[2] = box[2]+box[0]
box[3] = box[3]+box[1]
dw = 1./size[0]
dh = 1./size[1]
x = (box[0] + box[1])/2.0
y = (box[2] + box[3])/2.0
w = box[1] - box[0]
h = box[3] - box[2]
x = x*dw
w = w*dw
y = y*dh
h = h*dh
return (x,y,w,h)
http://cocodataset.org/#format-data
- Object Detection ...
annotation{ "id" : int, "image_id" : int, "category_id" : int, "segmentation" : RLE or [polygon], "area" : float, "bbox" : [x,y,width,height], "iscrowd" : 0 or 1, }
Convertion from MS COCO-labels to Yolo-labels:
yolo_x = box[0] / image_width
yolo_y = box[1] / image_height
yolo_width = box[2] / image_width
yolo_height = box[3] / image_height
Why do you want to use voc_label.py
to get labels of COCO-dataset?
voc_label.py
is of PascalVOC-dataset only.
Why do not you want to use this script to get COCO labels? https://github.com/AlexeyAB/darknet/blob/master/scripts/get_coco_dataset.sh
As described here: https://pjreddie.com/darknet/yolo/
Get The COCO Data To train YOLO you will need all of the COCO data and labels. The script scripts/get_coco_dataset.sh will do this for you. Figure out where you want to put the COCO data and download it, for example:
cp scripts/get_coco_dataset.sh data cd data bash get_coco_dataset.sh
Isn't this old ? There have been many corrections in the coco dataset.
Yes, if you want to use the newest COCO-dataset version, then use it from: http://cocodataset.org/#download
Convertion: http://cocodataset.org/#format-data
yolo_x = box[0] / image_width
yolo_y = box[1] / image_height
yolo_width = box[2] / image_width
yolo_height = box[3] / image_height
I am using the following function to convert coco dataset bbox to yolo format. So for image 000000002639.jpg => https://ibb.co/b99mFd In coco dataset the annotation given is width: 640x376 5 buses with the bbox
0.0 173.34 6.34 60.75 268.69 130.97 92.1 151.24
362.54 26.16 252.35 317.96
5.1 168.19 53.25 90.62
55.89 24.98 218.49 332.81
And after conversion the coordinates generated by the convert method are: 0.004953125 0.31128989361702125 0.00990625 -0.2994414893617021 0.2818671875 0.37527925531914896 -0.27592187500000004 0.053909574468085135 0.48038281250000003 0.4576063829787234 -0.17217187500000006 0.7760638297872339 0.04558593750000001 0.3441622340425532 0.075234375 -0.2063031914893617 0.21435937500000002 0.47578457446808514 0.2540625 0.8186968085106382
But when i check in Yolo_Mark these values are not correct ! https://ibb.co/m8Qq8y