TakahiroMiyaura / HoloLensOnnxTinyYoLo

This project is a sample code that evaluate iamge data using "Tiny Yolo V2" on Window ML(RS4/RS5)
MIT License
4 stars 1 forks source link

Adjusting Parameters to different models (detect 6 objects) #2

Closed HololensHomer closed 5 years ago

HololensHomer commented 5 years ago

Hello Mr. Miyaura,

Thank you so much for sharing a working version for the 1809 build!

I'm currently trying to adapt your code to a self trained version of TinyYolov2 that I converted to ONNX by myself. The network is trained to detect only 6 instead of 20 objects but I somehow just don't get any usable output from the UWP. The confidence scores are around 0.0001x and I just can't figure out why they are so low.

The onnx model itself gives a plausible output. I compared it with the output of the CoreML model from which I converted it from.

Here are the changes I made to the code so far:

In WinMLParser:

    public const int ChannelCount = 55;      ->    (6+5)*5 to calculate the filters for 6 classes
    public const int ClassCount = 6;             ->    because I want to detect 6 classes

TinyYoloV1_2Output

        var tensorFloat = TensorFloat.CreateFromArray(new long[] {-1, 55, 13, 13}, new float[9295]); 

      9295 -> 13*13*55

I also double checked that I'm loading the correct onnx file. It's loading as it's supposed to (Kinda unnecessary but I thought it's important to check it)

Do you have any idea what I could do wrong / what I have to change? Even the slightest guess would really help me out :D

Yours sincerely,

Homer

TakahiroMiyaura commented 5 years ago

Hello Homer,

Thank you for trying this repository!

When you use a customized ONNX of TinyYolov2, you've faling into the situation that the confidence scores become degraded, right?

Could you please let me know this description?

The onnx model itself gives a plausible output. I compared it with the output of the CoreML model
from which I converted it from.

you've been evaluated using other machine learning(not Windows ML)? if it is yes, the confidence scores have been become right?

The cause may be the function that input an image data to onnx model under Windows ML. A characteristic of input image don't correspond with a training data because the preprocessing of input image is different under Windows ML? But I'm not sure if my way of things is correct solution to solve your problems. ..

TinyYoloV2 input data is "Normalized" image data. The specification of normalized image is below :

When we use TinyYoloV2, we must normalize a input image data, but in the case we use Windows ML, we can evaluate it without normalizing image data. we can set VideoFrame object, then we don't need to normalize a input image.

I hope this will help,

walterPeyton commented 5 years ago

Thank you so much for replying!

I was able to solve the problem....It was quite an embarrassing mistake that I made. Had nothing to do with your code :D

Yours sincerely,

Homer

P.S. I don't know how to close an issue >.< can you please do that for me? Sorry about that

TakahiroMiyaura commented 5 years ago

Hi Homer,

That's great!! I'm glad the problem was solved! : )