ONNX Model Zoo

laszlokiss27/doodle-dash2

By laszlokiss27 · ↓ 5 · ♥ 0 · Updated 2024-04-23

What's in this repo

This page lists the files in laszlokiss27/doodle-dash2, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 11 files, including 6 .json, 1 .md, 1 .safetensors, 1 .onnx, 1 .bin
  • Last updated 2024-04-23

ONNX files

File Size Download
onnx/model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

Model description

This is a fine-tuned model based on apple/mobilevitv2-1.0-imagenet1k-256 trained for sketch image recognition using Xenova/quickdraw-small dataset.

How to use?

from transformers import MobileViTImageProcessor, MobileViTV2ForImageClassification
from PIL import Image
import requests
import torch
import numpy as np  # Importing NumPy

url = "https://static.thenounproject.com/png/2024184-200.png"
response = requests.get(url, stream=True)

# Convert to grayscale to ensure a single channel input
image = Image.open(response.raw).convert('L')  # Convert to grayscale

processor = MobileViTImageProcessor.from_pretrained("laszlokiss27/doodle-dash2")
model = MobileViTV2ForImageClassification.from_pretrained("laszlokiss27/doodle-dash2")

# Convert the PIL image to a tensor and add a channel dimension
image_tensor = torch.unsqueeze(torch.tensor(np.array(image)), 0).float()
image_tensor = image_tensor.unsqueeze(0)  # Add batch dimension

# Check if processor requires specific form of input
inputs = processor(images=image_tensor, return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits

# Get prediction
predicted_class_idx = logits.argmax(-1).item()
predicted_class = model.config.id2label[predicted_class_idx]
print("Predicted class:", predicted_class)

Model info

image-classification transformers
transformers onnx safetensors mobilevitv2 image-classification endpoints_compatible region:us
↓ 5 ♥ 0

Created: 2024-04-21

Updated: 2024-04-23

View on Hugging Face

Files (11)

.gitattributes
README.md
all_results.json
config.json
model.safetensors
onnx/model.onnx ONNX
preprocessor_config.json
test_results.json
train_results.json
trainer_state.json
training_args.bin

Related models