Search Unity

Question Barracuda output does not match onnxruntime

Discussion in 'Barracuda' started by sullivanml299, Feb 3, 2023.

  1. sullivanml299

    sullivanml299

    Joined:
    Jan 18, 2021
    Posts:
    1
    Hey everyone,

    I am experiencing inconsistencies between my barracuda and onnxrunitime outputs and was wondering if anyone has encountered/resolved similar issues previously.

    My model is a convNet classifier trained using transfer learning. I’ve tested using both ResNet and VGG16. ResNet is left mostly unmodified. I just resize the FC layer to work with my class count. For VGG16, I replace the avgpool layer with an Identity layer (for ONNX compatibility) and similarly swap the classifier layer with a new FC layer.

    I’ve compared the onnxruntime and Barracuda outputs for the same image (imported as a texture2D in Unity). The Barracuda output always differs from that of onnxruntime.

    For example, using the VGG16 model, when running inference with onnxruntime I get:

    [-389.3855, -414.1038, 706.42206] when the image is scaled between 0 and 255

    [-16.100842, -20.118477, 33.834724] when the image is scaled between 0 and 1​

    Running the same image through Barracuda I get [-429.9272, -518.117, 865.4481]

    For VGG16, the predicted class is still the same, but for ResNet, the differences are even greater and always predicts the same class regardless of the input image.

    Thank you in advance for your time! Don’t hesitate to reach out if any more information is needed.
     
  2. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    Just out of interest. How does Baracuda times compare to say onnxruntime using GPU?