Ma-Dan / keras-yolo4

A Keras implementation of YOLOv4 (Tensorflow backend)
MIT License
381 stars 175 forks source link

ValueError: height and width must be > 0 #16

Open ahsan856jalal opened 4 years ago

ahsan856jalal commented 4 years ago

When I run python test.py then Input image filename:'yolo4.png'

I get tis error: \Traceback (most recent call last): File "test.py", line 158, in result = yolo4_model.detect_image(image, model_image_size=model_image_size) File "test.py", line 80, in detect_image boxed_image = letterbox_image(image, tuple(reversed(model_image_size))) File "/home/muhammadmubeen/keras-yolo4/yolo4/utils.py", line 28, in letterbox_image image = image.resize((nw,nh), Image.BICUBIC) File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1883, in resize im = im.resize(size, resample, box) File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1888, in resize return self._new(self.im.resize(size, resample, box)) ValueError: height and width must be > 0

AndresChauca commented 4 years ago

In the file /yolov4/utils.py you must change line 24:

scale = min(w/iw, h/ih)

for this: scale = min(1.0 w/iw, 1.0h/ih)