yolov5-opencv-cpp-python icon indicating copy to clipboard operation
yolov5-opencv-cpp-python copied to clipboard

Python code confidence is an array not a number

Open BoazKG93 opened this issue 3 years ago • 5 comments

Upon running the python code I am getting:

    if confidence >= 0.4:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

And when trying condfidence.any() it won't work as well. Any advice?

BoazKG93 avatar Sep 05 '22 19:09 BoazKG93

have u found a solution?

hasimiali avatar Sep 05 '22 22:09 hasimiali

pip uninstall opencv-python pip install opencv-python==4.5.5.62

laosuan avatar Sep 22 '22 03:09 laosuan

Nope

On Tue, 6 Sept 2022 at 00:20, hasimiali @.***> wrote:

have u found a solution?

— Reply to this email directly, view it on GitHub https://github.com/doleron/yolov5-opencv-cpp-python/issues/20#issuecomment-1237499833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFA3ZIY4U5UZ7TMAXQB5B3LV4ZW3DANCNFSM6AAAAAAQFHTDMI . You are receiving this because you authored the thread.Message ID: @.***>

BoazKG93 avatar Oct 11 '22 09:10 BoazKG93

Hi, I had the same problem, solved with:

pip uninstall opencv-python pip install opencv-python==4.5.4.58

my numpy version is 1.23.3 running on Win 10 with python 3.8.10

Lupi91 avatar Oct 11 '22 17:10 Lupi91

Upon running the python code I am getting:

    if confidence >= 0.4:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

And when trying condfidence.any() it won't work as well. Any advice?

i've done

when you call wrap_detection(input_image = img, output_data=output_data[0])

don't forget to get only array [0] in output_data

hanifizzudinrahman avatar Oct 24 '22 14:10 hanifizzudinrahman