-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Inference result of the ONNX model is different every time with the same input #23351
Copy link
Copy link
Closed
Closed
Copy link
Labels
Description
System Information
OpenCV python version: 4.7.0.68
Operating System / Platform: Windows 11
Python version: 3.9.6
Detailed description
When I infer a model with the same input many times, the output are different. For example, the score is sometimes almost 0 and sometimes almost 1. This has a significant impact on the application of the model.
The result of onnxruntime is normal.
Steps to reproduce
model file and input data: test.zip
import numpy as np
import cv2 as cv
model = cv.dnn.readNet("path/to/model")
model.setPreferableBackend(0)
model.setPreferableTarget(0)
input_blob = np.load("path/to/input.npy")
model.setInput(input_blob)
output_blob = model.forward(model.getUnconnectedOutLayersNames())
landmarks, conf, mask, heatmap, landmarks_word = output_blob
print(conf[0][0])Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable