divamgupta / image-segmentation-keras

Implementation of Segnet, FCN, UNet , PSPNet and other models in Keras.
https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html
MIT License
2.92k stars 1.16k forks source link

Resize method for segmentation #11

Open MiriamFarber opened 6 years ago

MiriamFarber commented 6 years ago

In the function getSegmentationArr in LoadBatches.py, I think that you need to use

cv2.resize(img, ( width , height ), cv2.INTER_NEAREST)

instead of the default one that you are currently using, which is equivalent to:

cv2.resize(img, ( width , height ), cv2.INTER_LINEAR)

The latter one is used to image resizing, but if you want to resize a segmentation with fixed number of labels, you probably don't want to use a bilinear interpolation. This may introduce labels that do not exist in the original image.

divamgupta commented 6 years ago

Thanks for pointing out. Could you send a pull request for this?