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
All squeezenet 1.0 models from https://github.com/onnx/models/tree/main/validated/vision/classification/squeezenet
These squeezenet 1.0 models can't provide correct prediction results:
System Information
Win11
Select any one squeezenet 1.0 model to try:
import onnx import onnxruntime import numpy as np from PIL import Image # Load SqueezeNet ONNX model_path = 'squeezenet1.0-12-fp32.onnx' model = onnx.load(model_path) # Create ONNX session session = onnxruntime.InferenceSession(model_path) # Load image image_path = 'dog.jpg' image = Image.open(image_path) image = image.resize((224, 224)) # Image preprocessing image = np.array(image).astype(np.float32) image /= 255.0 # Normalize image mean = [0.485, 0.456, 0.406] std = [0.229, 0.224, 0.225] image = (image - mean) / std image = np.transpose(image, (2, 0, 1)) # Adjust channel order of the image image = np.expand_dims(image, axis=0) # Add batch dimension # convert the input tensor to float type image = image.astype(np.float32) # Predict input_name = session.get_inputs()[0].name output_name = session.get_outputs()[0].name input_feed = {input_name: image} output = session.run([output_name], input_feed) # Load the labels file labels_path = 'synset.txt' with open(labels_path, 'r') as f: labels = f.read().splitlines() # Get results predicted_idx = np.argmax(output[0]) predicted_label = labels[predicted_idx] print("Predicted label:", predicted_label) ...
The prediction result is always:
Predicted label: n03788365 mosquito net
The text was updated successfully, but these errors were encountered:
ONNX is a standard. You should probably file an issue against onnxruntime.
Sorry, something went wrong.
Thanks, I open microsoft/onnxruntime#20332
No branches or pull requests
Bug Report
Which model does this pertain to?
All squeezenet 1.0 models from https://github.com/onnx/models/tree/main/validated/vision/classification/squeezenet
Describe the bug
These squeezenet 1.0 models can't provide correct prediction results:
Reproduction instructions
System Information
Win11
Select any one squeezenet 1.0 model to try:
The prediction result is always:
Predicted label: n03788365 mosquito net
The text was updated successfully, but these errors were encountered: