matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.66k stars 11.7k forks source link

ValueError: height and width must be > 0 #193

Open LifeBeyondExpectations opened 6 years ago

LifeBeyondExpectations commented 6 years ago

I am runing a code 'demo.ipynb' I cannot solve this simple problem. If I change the code in the line 403 'utils.py' with below, then it shows nothing. What should I do ?? ..

` h_scaled = int(round(hscale)) w_scaled = int(round(wscale))

if h_scaled > 0 and w_scaled > 0: image = scipy.misc.imresize(image, (h_scaled, w_scaled)) `

ValueError Traceback (most recent call last)

in () 6 7 # Run detection ----> 8 results = model.detect([image], verbose=1) 9 10 # Visualize results

/home/Mask_RCNN/model.pyc in detect(self, images, verbose) 2331 log("image", image) 2332 # Mold inputs to format expected by the neural network -> 2333 molded_images, image_metas, windows = self.mold_inputs(images) 2334 if verbose: 2335 log("molded_images", molded_images)

/home/Mask_RCNN/model.pyc in mold_inputs(self, images) 2234 min_dim=self.config.IMAGE_MIN_DIM, 2235 max_dim=self.config.IMAGE_MAX_DIM, -> 2236 padding=self.config.IMAGE_PADDING) 2237 molded_image = mold_image(molded_image, self.config) 2238 # Build image_meta

/home/Mask_RCNN/utils.py in resize_image(image, min_dim, max_dim, padding) 401 ##origin 402 image = scipy.misc.imresize( --> 403 image, (int(round(h scale)), int(round(w scale)))) # jaesungchoe 404 405 # ##jaesungchoe

/usr/local/lib/python2.7/dist-packages/numpy/lib/utils.pyc in newfunc(*args, *kwds) 99 """arrayrange is deprecated, use arange instead!""" 100 warnings.warn(depdoc, DeprecationWarning, stacklevel=2) --> 101 return func(args, **kwds) 102 103 newfunc = _set_function_name(newfunc, old_name)

/usr/local/lib/python2.7/dist-packages/scipy/misc/pilutil.pyc in imresize(arr, size, interp, mode) 562 size = (size[1], size[0]) 563 func = {'nearest': 0, 'lanczos': 1, 'bilinear': 2, 'bicubic': 3, 'cubic': 3} --> 564 imnew = im.resize(size, resample=func[interp]) 565 return fromimage(imnew) 566

/usr/lib/python2.7/dist-packages/PIL/Image.pyc in resize(self, size, resample) 1536 return self.convert('RGBa').resize(size, resample).convert('RGBA') 1537 -> 1538 return self._new(self.im.resize(size, resample)) 1539 1540 def rotate(self, angle, resample=NEAREST, expand=0):

ValueError: height and width must be > 0

canerozer commented 6 years ago

Where is the hscale variable in utils.py file? Did you mean (h scale) and (wscale) in your modifications?

LifeBeyondExpectations commented 6 years ago

@dontgetdown Yes. I just add the variables.