Detectron: I meet this question:“not enough values to unpack (expected 3, got 2)”?

Created on 16 Feb 2019  ·  4Comments  ·  Source: facebookresearch/Detectron

File "/home/qifengliang/detectron/detectron/utils/vis.py", line 332, in vis_one_image
e.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE)
ValueError: not enough values to unpack (expected 3, got 2)

Most helpful comment

Opencv change returns of function cv2.findContours from image, contour, hier (since 3.2.0) to contour, hier, in the latest 4.0.0 version

All 4 comments

I have encountered the same issue when running:
python tools/infer_simple.py \ --cfg configs/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml \ --output-dir /tmp/detectron-visualizations \ --image-ext jpg \ --wts https://dl.fbaipublicfiles.com/detectron/35861858/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml.02_32_51.SgT4y1cO/output/train/coco_2014_train:coco_2014_valminusminival/generalized_rcnn/model_final.pkl \ demo
According to https://stackoverflow.com/questions/54164630/want-to-find-contours-valueerror-not-enough-values-to-unpack-expected-3-go, the cv2.findContours() has changed.
Go to /detectron/detectron/utils/vis.py in line 331, change it into:
contour, hier = cv2.findContours( e.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE)
My problem solved.

Opencv change returns of function cv2.findContours from image, contour, hier (since 3.2.0) to contour, hier, in the latest 4.0.0 version

Opencv change returns of function cv2.findContours from image, contour, hier (since 3.2.0) to contour, hier, in the latest 4.0.0 version

Thank you, I have solved this problem after I changed the version of cv2.

Hi all, please see my comment in #809.

Was this page helpful?
0 / 5 - 0 ratings