Azure-Samples / cognitive-services-onnx-customvision-sample

Real time image classification Windows-ML using a ONNX model exported from Custom Vision Service.
MIT License
15 stars 21 forks source link

Can't get data labels from ONNX model exported from Microsoft Custom Vision #13

Closed ooo1234567 closed 1 year ago

ooo1234567 commented 1 year ago

This issue is for a:

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Today when downloading an ONNX model from Custom Vision, the model_output type is a float32[1,4]. Therefore even if I'm able to download the ONNX file and get probabilities from the Model I'm unable to get labels data associated with the probabilities, which makes output useless.

I've provided the screenshot from netron.app and as you can see there's no string value outputted to grab the labels. Is there anything I'm missing?

Another hypothesis is that I should assume that the index on the label file (provided in .zip file along with model) match the output index of the ONNX. But how could I validate that?

Any log messages given by the failure

image

Expected/desired behavior

Getting the labels as well as the probabilities when using an up to date ONNX file from custom vision.

OS and Version?

11

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

shonohs commented 1 year ago

Hello,

Thanks for bringing up this issue regarding the ONNX model.

The label names are indeed not included directly in the ONNX model. This is primarily due to compatibility issues. Instead, you should rely on the order of labels provided in the labels.txt file that comes with the model in the zip file. The index of the label in the labels.txt file corresponds to the output index of the probabilities in the ONNX model.

shonohs commented 1 year ago

I've realized this repository is not actively maintained. Our official repository for sample scripts is https://github.com/Azure-Samples/customvision-export-samples

We will disable this repository soon.

shonohs commented 1 year ago

I apologize for any confusion or inconvenience caused by this repository.