Keras-yolo3: yolo.py ValueError: height and width must be > 0

Created on 27 Jun 2018  路  4Comments  路  Source: qqwweee/keras-yolo3

Hello! When using yolo.py , after inputting the path to the image,"/home/image.jpg" i get the following error:

Traceback (most recent call last):
File "yolo.py", line 215, in
detect_img(YOLO())
File "yolo.py", line 208, in detect_img
r_image = yolo.detect_image(image)
File "yolo.py", line 92, in detect_image
boxed_image = letterbox_image(image, tuple(reversed(self.model_image_size)))
File "/home/keras-yolo/keras-yolo3/yolo3/utils.py", line 28, in letterbox_image
image = image.resize((nw,nh), Image.BICUBIC)
File "/root/anaconda2/lib/python2.7/site-packages/PIL/Image.py", line 1554, in resize
return self.convert('RGBa').resize(size, resample).convert('RGBA')
File "/root/anaconda2/lib/python2.7/site-packages/PIL/Image.py", line 1556, in resize
return self._new(self.im.resize(size, resample))
ValueError: height and width must be > 0

I'am using python 2.7.

Any idea why i'am getting this error (tried multiples images , .png an .jpg)?

Most helpful comment

Add from __future__ import division at the beginning of utils.py

All 4 comments

Ok found out why,

it was because scale = min(w/iw, h/ih) was 0

adding "from __future__ import division" at the beginning of utils.py fixed the issue.

Add from __future__ import division at the beginning of utils.py

Ok found out why,

it was because scale = min(w/iw, h/ih) was 0

adding "from future import division" at the beginning of utils.py fixed the issue.

Ok found out why,

it was because scale = min(w/iw, h/ih) was 0

adding "from future import division" at the beginning of utils.py fixed the issue.

it needs to be from __future__ import division in python2.7, __ can be transferred into '**' in this editor, so you can choose insert code to resolve this.

from future import division

ModuleNotFoundError: No module named 'future'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nguyeho7 picture nguyeho7  路  4Comments

laihaotao picture laihaotao  路  5Comments

wingNine picture wingNine  路  5Comments

ISSstone picture ISSstone  路  5Comments

nseidl picture nseidl  路  3Comments