developer0hye / Yolo_Label

GUI for marking bounded boxes of objects in images for training neural network YOLO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The bounding box values are wrong

ajaysurya1221 opened this issue · comments

Hi,
I completed my annotation and had a look at the .txt files. All the values of my bounding boxes start with 0.

For eg :
0 0.485048 0.334155 0.253589 0.059186
1 0.449761 0.529593 0.180622 0.060419
2 0.437799 0.739211 0.153110 0.053021
3 0.550239 0.215783 0.250000 0.054254
This is for a single image with 4 classes.

I used PIL and OpenCV to crop my image using these values considering they are [xmin ymin xmax ymax] and I got the results wrong. When I reopen Yolo_Label, the boxes are perfectly there. Is there anything I need to do? any solution?

The code I used to crop the boxes :

from PIL import Image
import matplotlib.pyplot as plt
bbox=(int(0.485048), int(0.334155), int(0.253589), int(0.059186)) #for one bounding box of an image
im=Image.open('sample.jpg')
im=im.crop(bbox)
plt.subplot(3,3,i+1)
plt.axis("off")
plt.imshow(im)

Thank you so much