deepmask-pytorch
deepmask-pytorch copied to clipboard
File "computeProposals.py", line 66, in main _, contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) ValueError: not enough values to unpack (expected 3, got 2)
when i run "python computeProposals.py --arch DeepMask --resume $DEEPMASK/pretrained/deepmask/DeepMask.pth.tar --img ./data/test.jpg", I get this error result:
File "computeProposals.py", line 66, in main _, contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) ValueError: not enough values to unpack (expected 3, got 2)
how can i sovle it ,thank you
Downgrade cv2 version 4.x to version 3.x.
OpenCV 3 changed cv2.findContours(...)
to return image, contours, hierarchy, while OpenCV 2's cv2.findContours(...)
and OpenCV 4's cv2.findContours(...)
return contours, hierarchy.
The easy way is to change this (computeProposals.py)
_, contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
to this
contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)