Image Classification
ultralytics
ONNX
GGUF
agriculture
plant-pathology
crop-disease
computer-vision
yolo26
efficientnet
soil-moisture
bangladesh
multimodal
conversational
Instructions to use RaiyanKhaan/KrishokTech-Models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use RaiyanKhaan/KrishokTech-Models with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("RaiyanKhaan/KrishokTech-Models", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use RaiyanKhaan/KrishokTech-Models with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf RaiyanKhaan/KrishokTech-Models:F16 # Run inference directly in the terminal: llama cli -hf RaiyanKhaan/KrishokTech-Models:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf RaiyanKhaan/KrishokTech-Models:F16 # Run inference directly in the terminal: llama cli -hf RaiyanKhaan/KrishokTech-Models:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf RaiyanKhaan/KrishokTech-Models:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf RaiyanKhaan/KrishokTech-Models:F16
Use Docker
docker model run hf.co/RaiyanKhaan/KrishokTech-Models:F16
- Llama new
- LM Studio
- Jan
- Ollama
How to use RaiyanKhaan/KrishokTech-Models with Ollama:
ollama run hf.co/RaiyanKhaan/KrishokTech-Models:F16
- Unsloth Desktop
- Pi
How to use RaiyanKhaan/KrishokTech-Models with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RaiyanKhaan/KrishokTech-Models:F16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "RaiyanKhaan/KrishokTech-Models:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use RaiyanKhaan/KrishokTech-Models with Docker Model Runner:
docker model run hf.co/RaiyanKhaan/KrishokTech-Models:F16
- Lemonade
How to use RaiyanKhaan/KrishokTech-Models with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull RaiyanKhaan/KrishokTech-Models:F16
Run and chat with the model
lemonade run user.KrishokTech-Models-F16
List all available models
lemonade list
- Hermes Agent
How to use RaiyanKhaan/KrishokTech-Models with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RaiyanKhaan/KrishokTech-Models:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default RaiyanKhaan/KrishokTech-Models:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use RaiyanKhaan/KrishokTech-Models with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RaiyanKhaan/KrishokTech-Models:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "RaiyanKhaan/KrishokTech-Models:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 9,634 Bytes
12631d6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | ---
license: apache-2.0
tags:
- agriculture
- plant-pathology
- crop-disease
- computer-vision
- yolo26
- efficientnet
- soil-moisture
- bangladesh
- multimodal
datasets:
- agricultural-vision
metrics:
- accuracy
- rmse
library_name: ultralytics
pipeline_tag: image-classification
---
# KrishokChat: Agricultural Vision & Soil Intelligence Model Suite
This repository contains the complete, production-ready suite of machine learning models developed for the **KrishokChat Advisory System**. These models are packaged into self-contained, folderized directories to enable academic reviewers, agronomists, and developers to reproduce and run our full diagnostic pipeline locally without requiring expensive cloud GPU servers.
---
## 1. Architectural Overview
The KrishokChat perception and diagnostic stack uses a multi-tier decoupled architecture:
1. **Tier 1: Crop Species Identification** β A `YOLO26-cls` model identifying 10 major crop families in Bangladesh to eliminate cross-crop pesticide misbinding hazard.
2. **Tier 2: Specialized Crop Pathology Diagnosis** β Six per-crop dedicated `YOLO26-cls` models diagnosing foliar fungal, bacterial, viral, and physiological diseases.
3. **Tier 3: Soil Moisture Matric Tension Estimation** β A 5-fold cross-validated `EfficientNet-B0` regression model predicting continuous soil suction pressure ($\text{kPa}$) directly from field images for precision irrigation guidance.
```
[ Farmer Field Leaf Image ]
β
βΌ
[ 01_crop_classifier ] (YOLO26-cls)
βββββββββββββββββββΌββββββββββββββββββ
β β β
βΌ βΌ βΌ
[ 02_potato_disease ] [ 03_rice_disease ] [ 04_wheat_disease ] ...
β β β
βββββββββββββββββββΌββββββββββββββββββ
βΌ
[ Diagnosis + Bangla Treatment Advice ]
```
---
## 2. Model Catalog & Checkpoint Manifest
Every PyTorch weight (`.pt`) is named distinctively with zero ambiguity. Corresponding optimized `ONNX` weights are included for cross-platform edge deployment.
| # | Directory | PyTorch Weight (`.pt`) | Edge ONNX (`.onnx`) | Architecture | Classes / Output | Target Crop / Task |
|:---:|:---|:---|:---|:---:|:---:|:---|
| **1** | `01_crop_classifier` | `crop_classifier.pt` (10.5 MB) | `crop_classifier.onnx` (20.8 MB) | YOLO26-cls | 10 classes | Multi-crop species classification |
| **2** | `02_potato_disease` | `potato_disease.pt` (10.5 MB) | `potato_disease.onnx` (20.8 MB) | YOLO26-cls | 3 classes | Potato (*Solanum tuberosum*) |
| **3** | `03_rice_disease` | `rice_disease.pt` (19.9 MB) | `rice_disease.onnx` (39.6 MB) | YOLO26-cls | 10 classes | Rice (*Oryza sativa*) |
| **4** | `04_wheat_disease` | `wheat_disease.pt` (9.0 MB) | `wheat_disease.onnx` (5.9 MB) | YOLO26-cls | 11 classes | Wheat (*Triticum aestivum*) |
| **5** | `05_corn_disease` | `corn_disease.pt` (10.5 MB) | `corn_disease.onnx` (20.8 MB) | YOLO26-cls | 4 classes | Corn / Maize (*Zea mays*) |
| **6** | `06_chilli_disease` | `chilli_disease.pt` (3.1 MB) | `chilli_disease.onnx` (5.9 MB) | YOLO26-cls | 8 classes | Chilli (*Capsicum annuum*) |
| **7** | `07_brassica_disease` | `brassica_disease.pt` (10.5 MB) | `brassica_disease.onnx` (20.8 MB) | YOLO26-cls | 11 classes | Cabbage & Cauliflower (*Brassica spp.*) |
| **8** | `08_soil_moisture` | `effnetb0_fold[0-4].pt` (81 MB) | N/A (PyTorch state_dict) | EfficientNet-B0 | 1 continuous (kPa) | Soil matric tension estimation |
---
## 3. Directory Layout
```text
backend_models/
βββ README.md # Main Model Card & Reviewer Documentation
βββ requirements.txt # Minimal pip dependencies
βββ verify_all_models.py # Single-click automated diagnostic verification suite
βββ run_inference.py # Multi-model CLI inference runner
βββ upload_to_huggingface.py # Hugging Face Hub upload automation script
β
βββ 01_crop_classifier/ # Intake Crop Classifier (10 classes)
β βββ crop_classifier.pt
β βββ crop_classifier.onnx
β βββ class_names.json
β βββ README.md
β
βββ 02_potato_disease/ # Potato Pathology (Early Blight, Late Blight, Healthy)
β βββ potato_disease.pt
β βββ potato_disease.onnx
β βββ class_names.json
β βββ disease_details.json
β βββ README.md
β
βββ 03_rice_disease/ # Rice Pathology (Blast, BLB, Sheath Blight, etc.)
β βββ rice_disease.pt
β βββ rice_disease.onnx
β βββ class_names.json
β βββ disease_details.json
β βββ README.md
β
βββ 04_wheat_disease/ # Wheat Pathology (Rusts, Blast, Tan Spot, etc.)
β βββ wheat_disease.pt
β βββ wheat_disease.onnx
β βββ class_names.json
β βββ disease_details.json
β βββ metadata.json
β βββ README.md
β
βββ 05_corn_disease/ # Corn Pathology (Rust, Leaf Spot, Blight)
β βββ corn_disease.pt
β βββ corn_disease.onnx
β βββ class_names.json
β βββ disease_details.json
β βββ README.md
β
βββ 06_chilli_disease/ # Chilli Pathology (Bacterial Spot, Curl Virus, etc.)
β βββ chilli_disease.pt
β βββ chilli_disease.onnx
β βββ class_names.json
β βββ disease_details.json
β βββ README.md
β
βββ 07_brassica_disease/ # Crucifers (Cabbage / Cauliflower diseases)
β βββ brassica_disease.pt
β βββ brassica_disease.onnx
β βββ class_names.json
β βββ disease_details.json
β βββ README.md
β
βββ 08_soil_moisture/ # Soil Moisture Tensiometer Regression (5-fold ensemble)
β βββ effnetb0_fold0.pt ... fold4.pt
β βββ oof_predictions.csv
β βββ pred_vs_actual.png
β βββ model_def.py
β βββ README.md
β
βββ sample_images/ # Representative leaf images for zero-setup verification
βββ crop_sample.jpg
βββ potato_sample.jpg
βββ rice_sample.jpg
βββ wheat_sample.jpg
βββ corn_sample.jpg
βββ chilli_sample.jpg
βββ brassica_sample.jpg
```
---
## 4. Quickstart Guide for Academic Reviewers
### Step 1: Install Dependencies
```bash
cd backend_models
pip install -r requirements.txt
```
### Step 2: Automated Verification of All Models
Run the automated test runner to verify that every single model checkpoint loads into memory, performs forward inference, and verifies against class specifications:
```bash
python verify_all_models.py
```
### Step 3: Run Standalone Inferences
**Test Potato Disease Diagnosis:**
```bash
python run_inference.py --crop potato --image sample_images/potato_sample.jpg
```
**Test Rice Disease Diagnosis:**
```bash
python run_inference.py --crop rice --image sample_images/rice_sample.jpg
```
**Test Wheat Disease Diagnosis:**
```bash
python run_inference.py --crop wheat --image sample_images/wheat_sample.jpg
```
**Test Soil Moisture Regression:**
```bash
python run_inference.py --task soil --image sample_images/crop_sample.jpg
```
---
## 5. Python API Usage
### Vision Models (YOLO26)
```python
from ultralytics import YOLO
# Load any specialized YOLO26 pathology classifier
model = YOLO("02_potato_disease/potato_disease.pt")
# Predict on an RGB image
results = model.predict("sample_images/potato_sample.jpg", imgsz=224, verbose=False)[0]
top_class = model.names[results.probs.top1]
confidence = float(results.probs.top1conf)
print(f"Result: {top_class} ({confidence:.2%})")
```
### Soil Moisture Regression (5-Fold Ensemble)
```python
import sys
sys.path.insert(0, "08_soil_moisture")
from model_def import load_soil_model
import torch
import torchvision.transforms as T
from PIL import Image
transform = T.Compose([
T.Resize((224, 224)),
T.ToTensor(),
T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
img = transform(Image.open("sample_images/crop_sample.jpg").convert("RGB")).unsqueeze(0)
# Ensemble average across 5 folds
predictions = []
for fold in range(5):
m = load_soil_model(f"08_soil_moisture/effnetb0_fold{fold}.pt")
with torch.no_grad():
predictions.append(m(img).item())
mean_kpa = sum(predictions) / len(predictions)
print(f"Estimated Soil Matric Potential: {mean_kpa:.2f} kPa")
```
---
## 6. Uploading to Hugging Face Hub
To publish this suite to the official Hugging Face repository:
```bash
python upload_to_huggingface.py --token <YOUR_HF_TOKEN>
```
Target repository: `https://huggingface.co/RaiyanKhaan/KrishokTech-Models`
---
## 7. Citation
If you use these model weights or the KrishokChat pipeline in your research, please cite our paper:
```bibtex
@inproceedings{krishokchat2026,
title={KrishokChat: A Grounded Multi-Modal Agricultural Advisory and Pathology Diagnostic System for Smallholder Farming},
author={Reza, Raiyaan and Khaan, Raiyan and Collaborators},
booktitle={Proceedings of the European Chapter of the Association for Computational Linguistics (EACL)},
year={2026}
}
```
|