Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
model_name: Wheat Anomaly Detection Model
|
| 3 |
+
tags:
|
| 4 |
+
- pytorch
|
| 5 |
+
- resnet
|
| 6 |
+
- agriculture
|
| 7 |
+
- anomaly-detection
|
| 8 |
+
- image-classification
|
| 9 |
+
- wheat-disease-detection
|
| 10 |
+
- pest-detection
|
| 11 |
+
- agricultural-ai
|
| 12 |
+
license: apache-2.0
|
| 13 |
+
library_name: pytorch
|
| 14 |
+
datasets:
|
| 15 |
+
- wheat-dataset # Replace with the actual dataset name on Hugging Face if available
|
| 16 |
+
model_type: resnet50
|
| 17 |
+
preprocessing:
|
| 18 |
+
- resize: 256
|
| 19 |
+
- center_crop: 224
|
| 20 |
+
- normalize: [0.485, 0.456, 0.406]
|
| 21 |
+
- normalize_std: [0.229, 0.224, 0.225]
|
| 22 |
+
framework: pytorch
|
| 23 |
+
task: image-classification
|
| 24 |
+
pipeline_tag: image-classification
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# Wheat Anomaly Detection Model
|
| 29 |
+
|
| 30 |
+
## Model Overview
|
| 31 |
+
|
| 32 |
+
This model is trained to detect anomalies in wheat crops, such as pest infections (e.g., Fall Armyworm), diseases, or nutrient deficiencies. The model is based on the **ResNet50** architecture and was fine-tuned on a dataset of wheat images.
|
| 33 |
+
|
| 34 |
+
## Model Details
|
| 35 |
+
|
| 36 |
+
- **Model Architecture**: ResNet50
|
| 37 |
+
- **Number of Classes**: 2 (Fall Armyworm, Healthy Wheat)
|
| 38 |
+
- **Input Shape**: 224x224 pixels, 3 channels (RGB)
|
| 39 |
+
- **Training Framework**: PyTorch
|
| 40 |
+
- **Optimizer**: Adam
|
| 41 |
+
- **Learning Rate**: 0.001
|
| 42 |
+
- **Epochs**: 20
|
| 43 |
+
- **Batch Size**: 32
|
| 44 |
+
|
| 45 |
+
## Training
|
| 46 |
+
|
| 47 |
+
The model was fine-tuned using a balanced dataset with images of healthy wheat and wheat infected by fall armyworms. The training involved transferring knowledge from a pretrained ResNet50 model and adjusting the final classification layer for the binary classification task.
|
| 48 |
+
|
| 49 |
+
### Dataset
|
| 50 |
+
|
| 51 |
+
The model was trained on a dataset hosted on Hugging Face. You can access it here:
|
| 52 |
+
|
| 53 |
+
- **Dataset**: `your_huggingface_username/your_dataset_name`
|
| 54 |
+
|
| 55 |
+
## How to Use
|
| 56 |
+
|
| 57 |
+
To load and use this model in PyTorch, follow the steps below:
|
| 58 |
+
|
| 59 |
+
### 1. Load the Model
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import torch
|
| 63 |
+
import timm
|
| 64 |
+
|
| 65 |
+
# Load the pre-trained model (fine-tuned ResNet50 for wheat anomaly detection)
|
| 66 |
+
model = timm.create_model("resnet50", pretrained=False, num_classes=2)
|
| 67 |
+
model.load_state_dict(torch.load("path_to_saved_model.pth"))
|
| 68 |
+
model.eval()
|