Instructions to use Shaq2/chashibhai-corn-disease-cls with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use Shaq2/chashibhai-corn-disease-cls with ultralytics:
# Couldn't find a valid YOLO version tag. # Replace XX with the correct version. from ultralytics import YOLOvXX model = YOLOvXX.from_pretrained("Shaq2/chashibhai-corn-disease-cls") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
ChashiBhAI Corn Disease Classifier
| Author | Shaq2 (Shakil Ahmed) |
| Crop | corn (ভুট্টা) |
| Task | Image classification (leaf disease) |
| Architecture | YOLO26-cls → TFLite FP16 |
| Input | [1, 640, 640, 3] NHWC RGB /255.0 |
| Output | [1, 4] softmax probabilities (nms: false) |
| Status | production-demo |
| App | ChashiBhAI (Expo / React Native, on-device diagnosis) |
| Code | GitHub |
| Collection | ChashiBhAI on-device classifiers |
Disease ID in ChashiBhAI always runs on-device. Gemini / KrishokChat generate advisory text only and never see the photo.
Files
| File | Role |
|---|---|
model.tflite |
On-device graph used by the Android app (~10.93 MB) |
labels.json |
Canonical class names and preprocess contract |
best.pt |
Ultralytics source weights (export parent) |
Classes (4)
| Label | English | Bangla |
|---|---|---|
Common_Rust |
Common Rust | কমন রাস্ট |
Gray_Leaf_Spot |
Gray Leaf Spot | ধূসর পাতা দাগ |
Healthy |
Healthy | সুস্থ |
Northern_Leaf_Blight |
Northern Leaf Blight | নর্দার্ন লিফ ব্লাইট |
Preprocessing (variant C) — required
Do not letterbox. Letterbox disagreed with the .pt on non-square photos.
- Resize the shortest side to
imgsz= 640, keep aspect ratio. - Centre-crop to
640×640. - RGB, NHWC,
float32 / 255.0.
labels.json is the source of truth (preprocess: centercrop).
Measured export checks
| Check | Result |
|---|---|
Preprocess verified vs .pt |
yes (variant C; independent machine test pass) |
| FP16 vs FP32 top-1 agreement | 1.0 |
| FP16 vs FP32 max softmax diff | 1.19209e-07 |
| Independent machine test | pass (August 2026) |
| Bundled in APK | no — Model Manager download |
Validation
Independent test on a separate machine (August 2026) confirmed this TFLite export loads and classifies correctly with the variant-C contract in labels.json. Rice, brassica, and corn all passed the same check.
Intended use
- On-device diagnosis in ChashiBhAI for Bangladeshi farmers (Bangla-first UI).
- Research reproduction of the mobile export.
Out of scope: detection / bounding boxes, crop auto-routing, chemical dosage (handled by a separate advisory stack with a refuse gate).
Limitations
Four-class corn head. Downloaded on demand in the app (not bundled). Not a plant-pathologist substitute. Retake if confidence is low or the leaf is not centred.
Load (Python)
import json
from pathlib import Path
import numpy as np
from PIL import Image
import tensorflow as tf
def preprocess_centercrop(path: str, imgsz: int = 640) -> np.ndarray:
im = Image.open(path).convert("RGB")
w, h = im.size
scale = imgsz / min(w, h)
nw, nh = int(round(w * scale)), int(round(h * scale))
im = im.resize((nw, nh), Image.BILINEAR)
left, top = (nw - imgsz) // 2, (nh - imgsz) // 2
im = im.crop((left, top, left + imgsz, top + imgsz))
return (np.asarray(im, dtype=np.float32) / 255.0)[None, ...]
labels = json.loads(Path("labels.json").read_text(encoding="utf-8"))
it = tf.lite.Interpreter(model_path="model.tflite")
it.allocate_tensors()
inp, out = it.get_input_details()[0], it.get_output_details()[0]
it.set_tensor(inp["index"], preprocess_centercrop("leaf.jpg", labels["imgsz"]))
it.invoke()
p = it.get_tensor(out["index"])[0]
i = int(p.argmax())
print(labels["names"][i], float(p[i]))
Related models (same author)
- Rice
- Brassica
- Corn
- Suite index: chashibhai-disease-classifiers
Credit (not this model)
KrishokChat Bengali advisory LLM / RAG is not this classifier. See RaiyanKhaan/KrishokChat-Advisory-System and arXiv:2606.29243 (Reza & Shahid).
Citation
@software{ahmed2026chashibhai_corn_cls,
author = {Ahmed, Shakil},
title = {ChashiBhAI Corn Disease Classifier},
year = {2026},
url = {https://huggingface.co/Shaq2/chashibhai-corn-disease-cls}
}
License
MIT (see LICENSE). Ultralytics remains under its own license. This pack redistributes weights, not training images.
- Downloads last month
- -