cleardusk / 3DDFA_V2

The official PyTorch implementation of Towards Fast, Accurate and Stable 3D Dense Face Alignment, ECCV 2020.
MIT License
2.92k stars 515 forks source link

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #150

Open dongfeicui opened 1 year ago

dongfeicui commented 1 year ago

Before proposing this issue, plz search the existed issues by your keywords first.

Describe the bug I get the same error in both FaceBoxes/FaceBoxes.py line 133 and FaceBoxes/FaceBoxes_ONNX.py line 138. The program cannot determine the value. Because the variable b is two-dimensional and cannot be compared with a scalar variable vis_thres.

To Reproduce Case 1 python3 demo.py -f examples/inputs/emma.jpg -o 3d. Case2 python3 demo_video.py -f examples/inputs/videos/214.avi -o 3d

Expected behavior ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() Screenshots image

Platform:

Additional context Add any other context about the problem here. I modified the code as the follow: In FaceBoxes/FaceBoxes.py line 133 I change for b in dets: => for b in dets.squeeze(0): In FaceBoxes/FaceBoxes_ONNX.py line 138 I change for b in dets: => for b in dets.squeeze(0): If used in older numpy, please use np.squeeze(dets, 0)