We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
def image_preprocess(img_path): img = cv2.imread(img_path).astype("float32")/255 # mean = [103.53, 116.28, 123.675] # Image net values # std = [57.375, 57.12, 58.395] mean = [113.533554, 118.14172, 123.63607] std = [21.405144, 21.405144, 21.405144] mean = np.array(mean, dtype=np.float32).reshape(1, 1, 3) / 255 std = np.array(std, dtype=np.float32).reshape(1, 1, 3) / 255 img = (img - mean) / std img = np.transpose(img, (2, 0, 1)) img = np.expand_dims(img, axis=0) return img
def test_onnx_model(onnx_model,img_path=None): if img_path is None: img_path = "path for img" imgdata = image_preprocess(img_path) sess = rt.InferenceSession(onnx_model) input_name = sess.get_inputs()[0].name output_detect_name = sess.get_outputs()[0].name pred_onnx0= sess.run([output_detect_name], {input_name: imgdata}) print("outputs:") print(np.array(pred_onnx0))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
def image_preprocess(img_path):
img = cv2.imread(img_path).astype("float32")/255
# mean = [103.53, 116.28, 123.675] # Image net values
# std = [57.375, 57.12, 58.395]
mean = [113.533554, 118.14172, 123.63607]
std = [21.405144, 21.405144, 21.405144]
mean = np.array(mean, dtype=np.float32).reshape(1, 1, 3) / 255
std = np.array(std, dtype=np.float32).reshape(1, 1, 3) / 255
img = (img - mean) / std
img = np.transpose(img, (2, 0, 1))
img = np.expand_dims(img, axis=0)
return img
def test_onnx_model(onnx_model,img_path=None):
if img_path is None:
img_path = "path for img"
imgdata = image_preprocess(img_path)
sess = rt.InferenceSession(onnx_model)
input_name = sess.get_inputs()[0].name
output_detect_name = sess.get_outputs()[0].name
pred_onnx0= sess.run([output_detect_name], {input_name: imgdata})
print("outputs:")
print(np.array(pred_onnx0))
The text was updated successfully, but these errors were encountered: