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

what is the meaning of outputs? #1109

Closed
AliceSchaw opened this issue Apr 28, 2020 · 17 comments
Closed

what is the meaning of outputs? #1109

AliceSchaw opened this issue Apr 28, 2020 · 17 comments
Labels
bug Something isn't working

Comments

@AliceSchaw
Copy link

I trained my custom dataset and exported the onnx model. the final names of output are 325 and 328, the type of them is float32[12348,4]. what is the meaning of outputs? my number of classes is 4.

onnx model:
graph

cfg files:
prune_0.93_keep_0.01_16_shortcut_yolov3-spp3-4cls.txt

@AliceSchaw AliceSchaw added the bug Something isn't working label Apr 28, 2020
@github-actions
Copy link

github-actions bot commented Apr 28, 2020

Hello @AliceSchaw, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Google Colab Notebook, Docker Image, and GCP Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

@glenn-jocher
Copy link
Member

@AliceSchaw classes and boxes. boxes are nx4

@ghost
Copy link

ghost commented Apr 29, 2020

@glenn-jocher Could you elaborate on how to interpret these values? I find them confusing as they are different from what the PyTorch version would output

@glenn-jocher
Copy link
Member

@lostspirit0 these are designed for input into our iOS iDetection app.

You can export the raw model outputs as well, search the repo issues, there are many solutions already posted.

@AliceSchaw
Copy link
Author

@lostspirit0 these are designed for input into our iOS iDetection app.

You can export the raw model outputs as well, search the repo issues, there are many solutions already posted.

@glenn-jocher Could you give me a link, thank you?

@glenn-jocher
Copy link
Member

@AliceSchaw
Copy link
Author

AliceSchaw commented May 2, 2020

@glenn-jocher thanks for your reply. but i still do not understand the outputs, my input is 448X448, and strides are[32, 16, 8], so i guess the size of boundign box is (14 x 14 + 28 x 28 + 56 x 56) x 3 = 12348. but I want to get all the values that include the bbox of x, y, width, height and score, so, the expected size of outputs should be (14 x 14 + 28 x 28 + 56 x 56) x (4 + 1 + 4(class size)) * 3, but why is the size of outputs of the onnx 4 x 12348?

@glenn-jocher
Copy link
Member

onnx model may have multiple outputs, you might want to visualize with netron.

@AliceSchaw
Copy link
Author

onnx model may have multiple outputs, you might want to visualize with netron.

Yes, this is the visuality of my onnx model.
graph_01

Can you give me some examples how to get all the values that include the bboxs of x, y, width, height and class score ?

@glenn-jocher
Copy link
Member

@AliceSchaw ah perfect. Your outputs are right there. They're clearly labelled as 'boxes' and 'classes'. What seems to be the problem?

@AliceSchaw
Copy link
Author

AliceSchaw commented May 10, 2020

@AliceSchaw ah perfect. Your outputs are right there. They're clearly labelled as 'boxes' and 'classes'. What seems to be the problem?

here is official example: https://github.com/onnx/onnx-docker/blob/master/onnx-ecosystem/inference_demos/yoloV3_object_detection_onnxruntime_inference.ipynb

It is obviously different between the official example's onnx model and ultralytics's one.

The onnx model of official example has 3 outputs:
boxes: (1 x n_candidates x 4), the coordinates of all anchor boxes
scores: (1 x 80 x n_candidates), the scores of all anchor boxes per class
indices: (n_box x 3), selected indices from the boxes tensor. The selected index format is (batch_index, class_index, box_index)

However, here exported model has 2 outputs, any code example about utilizing the ultralytics's exported onnx model to detect objects with onnx runtime?

@glenn-jocher
Copy link
Member

@AliceSchaw Ah I see. This repo's onnx integrates objectness and classification togethor, which is a common format used in mobile device detection, such as in our iOS iDetection app.

I don't think anyone actually uses onnx to run models, it's mostly just an interchange format to send your model elsewhere, i..e coreml, tflite, etc.

If you want you can try this:
https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html#running-the-model-on-an-image-using-onnx-runtime

@AliceSchaw
Copy link
Author

AliceSchaw commented May 11, 2020

@AliceSchaw Ah I see. This repo's onnx integrates objectness and classification togethor, which is a common format used in mobile device detection, such as in our iOS iDetection app.

I don't think anyone actually uses onnx to run models, it's mostly just an interchange format to send your model elsewhere, i..e coreml, tflite, etc.

If you want you can try this:
https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html#running-the-model-on-an-image-using-onnx-runtime

Thank you for your help and patience.

@leeyunhome
Copy link

@AliceSchaw classes and boxes. boxes are nx4

Hello.

Does the expression nx4 mean n * 4?

Thank you.

@glenn-jocher
Copy link
Member

nx4 means shape = (n, 4)

@leeyunhome
Copy link

leeyunhome commented Feb 2, 2021

onnx model may have multiple outputs, you might want to visualize with netron.

Yes, this is the visuality of my onnx model.
graph_01

Can you give me some examples how to get all the values that include the bboxs of x, y, width, height and class score ?

Hello,

#1109 (comment)

Thanks for leaving any helpful questions.
How did you change the layer ids of 325 and 328 to'boxes' and'classes' in the following picture?
And how did you know that the two correspond to the box and the class?
image

The following is the model I learned
There are 3 outputs.
The types of outputs are
My number of classes is 102.
image
1 is batch size 3 is channel, 80, 80 is the same height width, but I don't know what 107 is.

ps. Can the input be converted to dynamic batch when converting to onnx?

Thank you.

@glenn-jocher
Copy link
Member

@leeyunhome it seems you have the wrong user, please refer to the follwing information:

  • For how to change the layer ids of 325 and 328 to 'boxes' and 'classes' and the corresponding interpretation, you can refer to the documentation or code within the project, or reach out to the ultralytics team.
  • Your question regarding the 107 output and the possibility of converting the input to dynamic batch should be addressed either by consulting the official documentation or by discussing it within the community or with the Ultralytics team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants