0

Specific Error,

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() Are there anyone to explain why this error occur? Here is my code that I want to apply: https://code.sololearn.com/ca10a18a2277

5th May 2021, 9:37 AM
Nurullah Aydın
Nurullah Aydın - avatar
14 odpowiedzi
+ 1
Okey. I will try thanks for help.
5th May 2021, 11:01 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
I see that boxes_sorted is set equal to the sorted(boxes, ect...). Boxes is a parameter value, is it supposed to be a list or what? And of what exactly?
5th May 2021, 9:53 AM
Slick
Slick - avatar
0
Boxes parameters seems as ndarray at now. Boxes include some of bounding box coordinates and their confidence scores. I mean, if the 10 boxes detected, boxes size will be equal to (10,5). Each box have their four coordinates value and score information.
5th May 2021, 9:58 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
Im just not sure of what input to provide. Have you though of making a box class? Then you can just keep all that info in each instance
5th May 2021, 10:00 AM
Slick
Slick - avatar
0
It is a nms algorithm that is used for object detection. The aim of this function decrase to possible false detection by using their scores value and intersection over union value.
5th May 2021, 10:02 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
Right right, but Im still unsure of the input to provide. Its too specific. Thats why i suggested a class that can hold all those attributes and be a bit less confusing. what is an example of input so i can run it and get the error you get?
5th May 2021, 10:05 AM
Slick
Slick - avatar
0
Here is my input boxes: [[104 72 64 64 0.337] [120 88 64 64 0.496] [200 104 64 64 0.0430] [184 120 64 64 0.136] [192.88 57.77 71.11 71.11 0] [104 75.55 71.11 71.11 0.363] [175.11 111.11 71.11 71.11 0.038] [183.01 40 79.01 79.01 0.477] [104 59.75 79.01 79.01 0.36] [169.84 105.84 87.79 87.79 1]] And here is the error I get: bbox_list_thresholded.remove(box) # If there is significant overlap, then remove the box ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
5th May 2021, 10:26 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
okay, its a list. So you could find the index of the box you want to remove and call .pop(<index>) on the list
5th May 2021, 10:29 AM
Slick
Slick - avatar
0
Do yo mean that I need to change (bbox_list_thresholded.remove(box)) line as (bbox_list_thresholded.pop(box))
5th May 2021, 10:32 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
No, cause i dont know what value "box" holds. All im saying is, if you want to remove the first box in the list: box_list.pop(0)
5th May 2021, 10:33 AM
Slick
Slick - avatar
0
Well if I convert the box list to numoy array. Then, can I use remove instead of pop ?
5th May 2021, 10:37 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
Not sure, but its not working now. Popping the index will though
5th May 2021, 10:38 AM
Slick
Slick - avatar
0
Well, How can I reach the index of box to use .pop() command
5th May 2021, 10:56 AM
Nurullah Aydın
Nurullah Aydın - avatar
0
Write another function to look for certain values in a list. If values are found, return the index. You can use that function inside of pop and it will pop the chosen index
5th May 2021, 10:57 AM
Slick
Slick - avatar