GeorgeSeif / Semantic-Segmentation-Suite

Semantic Segmentation Suite in TensorFlow. Implement, train, and test new Semantic Segmentation models easily!
2.5k stars 880 forks source link

cv2.error #169

Closed upuil closed 5 years ago

upuil commented 5 years ago

The problem is like. #107. How to prevent this problem and The data must be a color image? File "/home/_/Tensorflow/Semantic_Segmentation/utils/utils.py", line 45, in load_image image = cv2.cvtColor(cv2.imread(path,-1), cv2.COLOR_BGR2RGB) cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/imgproc/src/color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper

ryohachiuma commented 5 years ago

If the input image is gray scale, you should convert gray scale image to RGB image before cvtColor.

kirgal commented 5 years ago

You can change cv2.COLOR_BGR2RGB to cv2.COLOR_GRAY2RGB in cv2.cvtColor in line 45

upuil commented 5 years ago

I change it like you said that, but Traceback (most recent call last): File "train.py", line 175, in <module> input_image = utils.load_image(train_input_names[id]) File "/home/pu/Tensorflow/Semantic_Segmentation/utils/utils.py", line 45, in load_image image = cv2.cvtColor(cv2.imread(path,-1), cv2.COLOR_GRAY2RGB) cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/imgproc/src/color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper'

upuil commented 5 years ago

change line like this works image = cv2.cvtColor(cv2.imread(path, 0), cv2.COLOR_GRAY2RGB)