ChashiBhAI Brassica Disease Classifier

Author Shaq2 (Shakil Ahmed)
Crop brassica (বাঁধাকপি / ফুলকপি)
Task Image classification (leaf disease)
Architecture YOLO26-cls → TFLite FP16
Input [1, 640, 640, 3] NHWC RGB /255.0
Output [1, 11] 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.95 MB)
labels.json Canonical class names and preprocess contract
best.pt Ultralytics source weights (export parent)

Classes (11)

Label English Bangla
Cabbage__Alternaria_Spot Cabbage Alternaria Spot বাঁধাকপি অল্টারনারিয়া
Cabbage__Black_Rot Cabbage Black Rot কালো পচন
Cabbage__Downy_Mildew Cabbage Downy Mildew ডাউনি মিলডিউ
Cabbage__Healthy_Leaf Cabbage Healthy সুস্থ বাঁধাকপি
Cauliflower__Alternaria_Disease Cauliflower Alternaria ফুলকপি অল্টারনারিয়া
Cauliflower__Bacterial_Soft_Rot Bacterial Soft Rot ব্যাকটেরিয়া নরম পচন
Cauliflower__Bacterial_Spot Bacterial Spot ব্যাকটেরিয়া দাগ
Cauliflower__Black_Spot Black Spot কালো দাগ
Cauliflower__Downy_Mildew Cauliflower Downy Mildew ফুলকপি ডাউনি মিলডিউ
Cauliflower__Healthy Cauliflower Healthy সুস্থ ফুলকপি
Cauliflower__Nutrient_Deficiency Nutrient Deficiency পুষ্টি ঘাটতি

Preprocessing (variant C) — required

Do not letterbox. Letterbox disagreed with the .pt on non-square photos.

  1. Resize the shortest side to imgsz = 640, keep aspect ratio.
  2. Centre-crop to 640×640.
  3. 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 0.00210267
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

Covers cabbage and cauliflower classes in one head. Downloaded on demand in the app (not bundled).

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)

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_brassica_cls,
  author = {Ahmed, Shakil},
  title  = {ChashiBhAI Brassica Disease Classifier},
  year   = {2026},
  url    = {https://huggingface.co/Shaq2/chashibhai-brassica-disease-cls}
}

License

MIT (see LICENSE). Ultralytics remains under its own license. This pack redistributes weights, not training images.

Downloads last month
69
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including Shaq2/chashibhai-brassica-disease-cls

Paper for Shaq2/chashibhai-brassica-disease-cls