Downloads · 30 days
3
13% of all-time downloads
GiladWeinberger/grape-leaf-5deg
grape-leaf-5deg is a machine learning model from GiladWeinberger. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as mit.
Convolutional neural network that estimates the percentage of downy mildew on grape leaf images (0–100%).
Downloads · 30 days
3
13% of all-time downloads
All-time downloads
24
Public
Repo size
103 MB
Likes
0
Public
Click a slice to open those files.
.pth103 MB · 100%
From the Hugging Face model README
Convolutional neural network that estimates the percentage of downy mildew on grape leaf images (0–100%).
| Property | Value |
|---|---|
| Task | Image regression |
| Variant | 5deg (5-degree rotation augmentation) |
| Input | RGB image, resized to 224×224 |
| Output | Single scalar (affected area %) |
| Architecture | 3-layer CNN + 2-layer MLP regressor |
transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
])
No ImageNet normalization is applied.
import torch
from PIL import Image
from torchvision import transforms
# Copy model.py from this repo or from the Django app ml/model.py
from model import GrapeLeafRegressor
model = GrapeLeafRegressor()
model.load_state_dict(torch.load("grape_leaf_model_5deg.pth", map_location="cpu"))
model.eval()
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
])
image = Image.open("leaf.jpg").convert("RGB")
tensor = transform(image).unsqueeze(0)
with torch.no_grad():
prediction = model(tensor).item()
prediction = max(0, min(100, prediction))
print(f"Estimated downy mildew: {prediction:.1f}%")
Deploy the companion Space from deploy/huggingface/space/ for a Gradio HTTP API used by the Vercel-hosted Django app.
data/final_images_5deg (train / validation / test split)python train_model.py --variant 5degMachine Learning Project — Shamir Institute (Dr. Lior Gur), with Daniel Kusai.