Ir para o conteúdo
ModelListadosExterno
Baixar

Cabbage Disease Rexnet150

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

TipoOtherVersãoCabbage best modelCnota

Fonte do modelo

Tipo
Other
Tamanho do arquivo
30,2 MB
Versão
vCabbage best model
Atualizado
10 de out. de 2026
Fonte
Hugging Face

Descrição da fonte

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())

Fontes

1 fonte
Hugging FacePrimárioVersão aa7f8afcf7de4645dda0d59e8fa27a2545d3b0d4
huggingface.co/Huyt/cabbage-disease-rexnet150/tree/aa7f8afcf7de4645dda0d59e8fa27a2545d3b0d4

Verificado 10 de out.

Artefatos de modelo

1 artefato

cabbage_best_model.pth

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

Baixar

Trechos de fonte

2 trechos

--- 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