johnnylu305 / Simple-does-it-weakly-supervised-instance-and-semantic-segmentation

Weakly Supervised Segmentation by Tensorflow. Implements semantic segmentation in Simple Does It: Weakly Supervised Instance and Semantic Segmentation, by Khoreva et al. (CVPR 2017).
Apache License 2.0
56 stars 12 forks source link

Error grabcut.cpp: Line 177 #1

Closed xiaoyufenfei closed 5 years ago

xiaoyufenfei commented 5 years ago

Hello @johnnylu305 When I run the following program, something went wrong. test@precision:/data/weakly-supervised-instance-and-semantic-segmentation/Simple_does_it$
python ./Preprocess/grabcut.py --train_pair_name voc_train_pairs.txt

The command line output is as follows:

Dataset : ./Preprocess/../Parser_/../Dataset Image directory name : JPEGImages Pair name : voc_train_pairs.txt Grabcut directory name : Grabcut_inst Label directory name : Segmentation_label Load annotations : 3.51kit [00:00, 250kit/s] Total images : 3508 Ungrabcut images : 3508 0%| | 2/1464 [00:01<12:45, 1.91it/s]multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/usr/local/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "./Preprocess/grabcut.py", line 117, in grabcut cv2.GC_INIT_WITH_RECT) cv2.error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/grabcut.cpp:177: error: (-215:Assertion failed) totalSampleCount > 0 in function 'endLearning'

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "./Preprocess/grabcut.py", line 232, in main() File "./Preprocess/grabcut.py", line 228, in main grabcut_.run_grabcut() File "./Preprocess/grabcut.py", line 92, in run_grabcut total=len(self.anns)): File "/usr/local/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 979, in iter for obj in iterable: File "/usr/local/anaconda3/lib/python3.6/multiprocessing/pool.py", line 735, in next raise value cv2.error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/grabcut.cpp:177: error: (-215:Assertion failed) totalSampleCount > 0 in function 'endLearning' my data is VOC12 (train set size: 1464) I have test it in Opencv 3.4.3 and 4.0, but i encounter the same Error. I can't figure it out. Can you help me? Thank you very much!

johnnylu305 commented 5 years ago

Hello @xiaoyufenfei , it's working fine on OpenCV3.4.2 and crash on OpenCV3.4.3+.

Fortunately, this issue had been resolved few months ago. Just check opencv #13297 and opencv #13323 for more details.

Therefore, you can downgrade your OpenCV to 3.4.2 or build OpenCV4.0.1 from source.

Hoping this can help you and I will close this issue later.

xiaoyufenfei commented 5 years ago

Ok, I got it, thanks a lot.