Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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) #7

Open
tim94173 opened this issue Mar 11, 2020 · 2 comments

Comments

@tim94173
Copy link

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

@alzayats
Copy link

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.

@jefflgaol
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants