miladfa7/5-Flower-Types-Classification-Dataset
Viewer โข Updated โข 5k โข 167 โข 2
Run hilmiatha/resnet18-flower-classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/hilmiatha/resnet18-flower-classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/hilmiatha/resnet18-flower-classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use hilmiatha/resnet18-flower-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="hilmiatha/resnet18-flower-classifier")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("hilmiatha/resnet18-flower-classifier", device_map="auto")metrics: - name: Accuracy type: Accuracy value: 0.8980
This model classifies images into one of five flower types.
from torchvision import transforms
from PIL import Image
import torch
from torchvision.models import resnet18
model = resnet18(weights=None)
model.load_state_dict(torch.load('path_to_model/pytorch_model.bin'))
model.eval()
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
image = Image.open('path_to_image.jpg')
image = transform(image).unsqueeze(0)
with torch.no_grad():
output = model(image)
_, predicted = torch.max(output.data, 1)
print(predicted.item())