detecto
detecto copied to clipboard
All bounding boxes should have positive height and width
Describe the bug I created a dataset that already worked with TensorFlow. For some reason, it raises this error when trying to train a model.
Code and Data `from detecto import core, utils, visualize
dataset = core.Dataset('analyzepage/') model = core.Model(['taskRegion', 'pageCount', 'infoText', 'separateImage', 'element'])
model.fit(dataset)`
Environment:
- OS: Windows 10
- Python version: 3.6
- Detecto version: 1.1.6
- torch version: -
- torchvision version: -
Additional context Add any other context about the problem here.
Could you take a look at #56 and let me know if that helps fix the issue?
i have the same error and checked the data that xmin<xmax and ymin<ymax but the error still exist
The error in the image you shared seems to suggest there's a box with a width of 0, which would be invalid. If you modify your script to only print when an invalid box is found, do you get any output? It's possible that the box causing the error is getting buried behind the "all data is fine" messages.
for i in range(len(dataset)):
image, target = dataset[i]
box = target['boxes']
if box[0] >= box[2] or box[1] >= box[3]: # min x > max x or min y > max y
print(i, box)
the output of width with 0 was nothing that no image with width 0 .
there is the output :
Looks like I made a mistake in my script, my bad - try this instead:
for i in range(len(dataset)):
image, target = dataset[i]
boxes = target['boxes']
for box in boxes:
if box[0] >= box[2] or box[1] >= box[3]: # min x > max x or min y > max y
print(i, box)
oh finally it worked thank you!