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
5/5/2021 9:37:56 AMNurullah Aydın
14 AnswersNew Answer
Okey. I will try thanks for help.
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?
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.
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
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.
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?
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()
okay, its a list. So you could find the index of the box you want to remove and call .pop(<index>) on the list
Do yo mean that I need to change (bbox_list_thresholded.remove(box)) line as (bbox_list_thresholded.pop(box))
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)
Well if I convert the box list to numoy array. Then, can I use remove instead of pop ?
Not sure, but its not working now. Popping the index will though
Well, How can I reach the index of box to use .pop() command
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