Downloads · 30 days
6
33% of all-time downloads
danjung9/resnet18-approval-regressor
resnet18-approval-regressor is a machine learning model from danjung9. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
6
33% of all-time downloads
All-time downloads
18
Public
Repo size
89.5 MB
Likes
0
Public
Click a slice to open those files.
.bin44.8 MB · 100%
From the Hugging Face model README
Author: Dan Jung and Scotty McGee
Model Description
import torch
from PIL import Image
from torchvision import transforms
from model import load_model
cfg = {"image_size": 224, "mean": [0.485, 0.456, 0.406], "std": [0.229, 0.224, 0.225], "label_range": [1.0, 10.0], "task": "image_regression", "backbone": "resnet18", "target": "approval(1-10)"}
tf = transforms.Compose([
transforms.Resize((cfg["image_size"], cfg["image_size"])),
transforms.ToTensor(),
transforms.Normalize(mean=cfg["mean"], std=cfg["std"]),
])
m = load_model("pytorch_model.bin")
img = Image.open("your_image.jpg").convert("RGB")
x = tf(img).unsqueeze(0)
with torch.no_grad():
y = m(x).squeeze(1).clamp(1.0, 10.0).item()
print(y)