Saltar al contenido
ModelPublicadoExterno
Descargar

Cabbage Disease Rexnet150

A rexnet150 (timm) image classifier fine-tuned to detect cabbage plant diseases.

TipoOtherVersiónCabbage best modelCcalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
30,2 MB
Versión
vCabbage best model
Actualizado
10 oct 2026
Fuente
Hugging Face

Descripción de la fuente

Cabbage Disease Classifier (rexnet_150)

A rexnet_150 (timm) image classifier fine-tuned to detect cabbage plant diseases.

  • Classes (8): ['Alternaria_Leaf_Spot', 'club root', 'Downy Mildew', 'Cabbage aphid colony', 'ring spot', 'Black Rot', 'Bacterial spot rot', 'No disease']
  • Input size: 224x224
  • Normalization: mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]

How to use

See the "Inference: How to Use This Model" section of the training notebook, or the snippet below:

import json, torch, timm
from huggingface_hub import hf_hub_download
from PIL import Image
from torchvision import transforms as T

REPO_ID = "Huyt/cabbage-disease-rexnet150"

config_path = hf_hub_download(repo_id=REPO_ID, filename="config.json")
weights_path = hf_hub_download(repo_id=REPO_ID, filename="cabbage_best_model.pth")

with open(config_path) as f:
    config = json.load(f)
idx_to_class = {v: k for k, v in config["classes"].items()}

device = "cuda" if torch.cuda.is_available() else "cpu"
model = timm.create_model(config["model_name"], pretrained=False, num_classes=config["num_classes"])
model.load_state_dict(torch.load(weights_path, map_location=device))
model.to(device).eval()

tfs = T.Compose([
    T.Resize((config["image_size"], config["image_size"])),
    T.ToTensor(),
    T.Normalize(mean=config["mean"], std=config["std"]),
])

im = Image.open("path/to/image.jpg").convert("RGB")
x = tfs(im).unsqueeze(0).to(device)
with torch.no_grad():
    probs = torch.softmax(model(x), dim=1)[0]
pred_idx = int(torch.argmax(probs))
print(idx_to_class[pred_idx], probs[pred_idx].item())

Fuentes

1 fuente
Hugging FacePrincipalVersión aa7f8afcf7de4645dda0d59e8fa27a2545d3b0d4
huggingface.co/Huyt/cabbage-disease-rexnet150/tree/aa7f8afcf7de4645dda0d59e8fa27a2545d3b0d4

Verificado 10 oct

Artefactos del modelo

1 artefacto

cabbage_best_model.pth

pth · 30,2 MB · SHA-256 cdcede9ba271…2a9b · Hugging Face

Descargar

Extractos de fuentes

2 extractos

--- tags: - image-classification - timm - pytorch library_name: timm --- # Cabbage Disease Classifier (rexnet_150) A `rexnet_150` ([timm](https://github.com/huggingface/pytorch-image-models)) image classifier fine-tuned to detect cabbage plant diseases. - **Classes (8):** ['Alternaria_Leaf_Spot', 'club root', 'Downy Mildew', 'Cabbage aphid colony', 'ring spot', 'Black Rot', 'Bacterial spot rot', 'No disease'] - **Input size:** 224x224 - **Normalization:** mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] ## How to use See the "Inference: How to Use This Model" section of the training notebook, or the snippet below: ```python import json, torch, timm from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms as T REPO_ID = "Huyt/cabbage-disease-rexnet150" config_path = hf_hub_download(repo_id=REPO_ID, filename="config.json") weights_path = hf_hub_download(repo_id=REPO_ID, filename="cabbage_best_model.pth") with open(config_path) as f: config = json.load(f) idx_to_class = {v: k for k, v in config["classes"].items()} device = "cuda" if torch.cuda.is_available() else "cpu" model = timm.create_model(config["model_name"], pretrained=False, num_classes=config["num_classes"]) model.load_state_dict(torch.load(weights_path, map_location=device)) model.to(device).eval() tfs = T.Compose([ T.Resize((config["image_size"], config["image_size"])), T.ToTensor(), T.Normalize(mean=config["mean"], std=config["std"]), ]) im = Image.open("path/to/image.jpg").convert("RGB") x = tfs(im).unsqueeze(0).to(device) with torch.no_grad(): probs = torch.softmax(model(x), dim=1)[0] pred_idx = int(torch.argmax(probs)) print(idx_to_class[pred_idx], probs[pred_idx].item()) ```

Source context: 0 downloads · 0 likes · Pipeline image-classification · Library timm · Repo Huyt/cabbage-disease-rexnet150