ValueError in evaluation.py, the answer got from infer has a wrong number.
Running evaluation.py with error:
File "evaluation.py", line 93, in match_result
answer_nums = np.array([list(map(float, x.split()))[0] for x in answer_nums]).reshape(-1, 2)
ValueError: cannot reshape array of size 13 into shape (2)
The accurate answer format should be [880.0, 500.0, 1000.0, 500.0, 1000.0, 500.0] and reshape to [[ 880. 500.], [1000. 500.], [1000. 500.]]
But I got a [1055.5, 510.0, 1055.5, 510.0, 1055.5, 510.0, 1055.5, 510.0, 1055.5, 510.0, 1055.5, 510.0, 1055.5] with 13 numbers in my answer.
I have no idea why it happens. Please help
You could employ post-processing techniques, such as rule-based methods, to address this situation. For instance, you could opt to retain only the initial 12 numbers. Subsequently, you could proceed with evaluating your answers.
@DevLinyan Thanks for the reply.
I still have doubts about the cause of this error. According to your reply, this error is not due to a model inference error, but due to a bug in the evaluation code? So I can just crop and remove the excess data (the 13th)?
Same issues
answer_nums = np.array([list(map(float, x.split()))[0] for x in answer_nums]).reshape(-1, 2) ValueError: cannot reshape array of size 5 into shape (2)
will this happen is the test server?
The error you're encountering is actually caused by your own model. Typically, the model should produce the even number as output.
For those who have the same iisues.
It seems that
answer_nums = re.findall(r'\d+\.\d+', answer)
retrieve data in \d+.\d format but some of my answers are in \d format.
We checked again and find the error caused by the aborted answer of the LLM:
answer= "There is a black sedan to the front of the ego vehicle, a black sedan to the back of the ego vehicle, a black sedan to the front of the ego vehicle, a black sedan to the back of the ego vehicle, a black sedan to the front of the ego vehicle, a black sedan to the back of the ego vehicle, and a black sedan to the front of the ego vehicle. The IDs of these objects are <c1,CAM_FRONT,1055.5,500.0>, <c2,CAM_BACK,1055.5,500.0>, <c3,CAM_FRONT,1055.5,500.0>, <c4,CAM_BACK,1055.5,500.0>, <c5,CAM_FRONT,1055.5,500.0>, <c6,CAM_BACK,1055.5,500.0>, and <c7,CAM_FRONT,1055.5,500"
GT= [1055.5, 500.0, 1055.5, 500.0, 1055.5, 500.0, 1055.5, 500.0, 1055.5, 500.0, 1055.5, 500.0, 1055.5]
answer_nums = re.findall(r'\d+\.\d+', answer)
GT_nums = re.findall(r'\d+\.\d+', GT)
where the answer stoped at , and <c7,CAM_FRONT,1055.5,500, and the next two lines of code is to contract float numbers.
And if you just submit the answer toserver, it will cause the same error So, before the evaluation, you should deal with the answers with none even numbers, to cut it to a even numbers santence,