Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError in evaluation.py, the answer got from infer has a wrong number. #76

Open
piqiuni opened this issue Apr 8, 2024 · 6 comments
Labels
good first issue Good for newcomers

Comments

@piqiuni
Copy link

piqiuni commented Apr 8, 2024

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

@DevLinyan
Copy link
Contributor

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.

@piqiuni
Copy link
Author

piqiuni commented Apr 9, 2024

@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)?

@hutslib
Copy link

hutslib commented Apr 10, 2024

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?

@DevLinyan
Copy link
Contributor

The error you're encountering is actually caused by your own model. Typically, the model should produce the even number as output.

@hutslib
Copy link

hutslib commented Apr 10, 2024

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.

@ChonghaoSima ChonghaoSima added the good first issue Good for newcomers label Apr 11, 2024
@piqiuni
Copy link
Author

piqiuni commented Apr 15, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants