image-segmentation-keras icon indicating copy to clipboard operation
image-segmentation-keras copied to clipboard

Grayscale PNG images wrong assertion on prediction

Open DmitryMalishev opened this issue 4 years ago • 1 comments
trafficstars

When loading grayscale images they have shape=2, whick causes bellow assertion to fire in predict.py::predict():

assert (len(inp.shape) == 3 or len(inp.shape) == 1 or len(inp.shape) == 4), "Image should be h,w,3"

Changing it to the following solves the issue:

assert (len(inp.shape) == 3 or len(inp.shape) == 1 or len(inp.shape) == 4 or len(inp.shape) == 2), "Image should be h,w,3"

DmitryMalishev avatar Aug 26 '21 10:08 DmitryMalishev

Hello, were you able to get any prediction for the gray scale images? I converted my grayscale to RGB, so 3 channels before training and for prediction. But although the accuracy is high during training, the prediction is all blank. Were you able to get the prediction for your dataset? I am using the vgg model

ssnirgudkar avatar Sep 18 '21 14:09 ssnirgudkar