Open echohenry2006 opened 6 years ago
Hey I have same error
/usr/local/lib/python3.6/site-packages/ipykernel_launcher.py:3: DeprecationWarning: `imread` is deprecated!
`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use ``imageio.imread`` instead.
This is separate from the ipykernel package so we can avoid doing imports until
Processing 1 images
image shape: (480, 640, 3) min: 0.00000 max: 255.00000
molded_images shape: (1, 1024, 1024, 3) min: -123.70000 max: 151.10000
image_metas shape: (1, 89) min: 0.00000 max: 1024.00000
/Users/user1/Dev/test/Mask_RCNN/utils.py:67: RuntimeWarning: invalid value encountered in true_divide
iou = intersection / union
/Users/user1/Dev/test/Mask_RCNN/utils.py:120: RuntimeWarning: invalid value encountered in greater
remove_ixs = np.where(iou > threshold)[0] + 1
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-1c43c85bdf35> in <module>()
4
5 # Run detection
----> 6 results = model.detect([image], verbose=1)
7
8 # Visualize results
~/Dev/test/Mask_RCNN/model.py in detect(self, images, verbose)
2222 final_rois, final_class_ids, final_scores, final_masks =\
2223 self.unmold_detections(detections[i], mrcnn_mask[i],
-> 2224 image.shape, windows[i])
2225 results.append({
2226 "rois": final_rois,
~/Dev/test/Mask_RCNN/model.py in unmold_detections(self, detections, mrcnn_mask, image_shape, window)
2184 for i in range(N):
2185 # Convert neural network mask to full size mask
-> 2186 full_mask = utils.unmold_mask(masks[i], boxes[i], image_shape)
2187 full_masks.append(full_mask)
2188 full_masks = np.stack(full_masks, axis=-1)\
~/Dev/test/Mask_RCNN/utils.py in unmold_mask(mask, bbox, image_shape)
471 y1, x1, y2, x2 = bbox
472 mask = scipy.misc.imresize(
--> 473 mask, (y2 - y1, x2 - x1), interp='bilinear').astype(np.float32) / 255.0
474 mask = np.where(mask >= threshold, 1, 0).astype(np.uint8)
475
/usr/local/lib/python3.6/site-packages/numpy/lib/utils.py 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/python3.6/site-packages/scipy/misc/pilutil.py 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/local/lib/python3.6/site-packages/PIL/Image.py in resize(self, size, resample, box)
1745 self.load()
1746
-> 1747 return self._new(self.im.resize(size, resample, box))
1748
1749 def rotate(self, angle, resample=NEAREST, expand=0, center=None,
ValueError: height and width must be > 0
You might be getting a bounding box with an area of zero, which causes this error when it tries to resize the mask to the given bounding box area. Can you track why your bounding boxes are zero?
When feed large image into the the net , I got "ValueError: height and width must be > 0" in resize_image, anyone know how to solve it?