Spaces:
Running
on
Zero
Running
on
Zero
Update README.md
Browse files
README.md
CHANGED
|
@@ -4,41 +4,131 @@ emoji: π±πΈπ©Ί
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
license:
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# Bean Plant Health
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
- Angular Leaf Spot
|
| 25 |
-
- Bean Rust
|
| 26 |
-
- Healthy
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
- **Image Processor**: The app uses the `ViTImageProcessor` for preparing images before classification.
|
| 32 |
-
- **Labels**: The possible outcomes are `angular_leaf_spot`, `bean_rust`, and `healthy`.
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
2. **Get Results**: The app will classify the image and display the probabilities for each category.
|
| 38 |
-
3. **Interpret the Results**: The app shows the confidence levels for each label, helping farmers identify whether the plant is healthy or requires treatment.
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.31.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Bean Plant Health ViT Classifier π±πΈπ©Ί
|
| 14 |
|
| 15 |
+
A web-based agricultural AI tool that helps farmers identify bean plant diseases using computer vision. Built with Vision Transformer (ViT) model and Gradio for real-time crop health monitoring and disease detection.
|
| 16 |
|
| 17 |
+

|
| 18 |
|
| 19 |
+
## π Live Demo
|
| 20 |
|
| 21 |
+
Try the app: [Bean-Plant-Health-Classifier](https://huggingface.co/spaces/ashish-soni08/Bean-plant-health-ViT-classifier)
|
| 22 |
|
| 23 |
+
## β¨ Features
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
- **Disease Detection**: Automatically identify angular leaf spot, bean rust, and healthy plants
|
| 26 |
+
- **Real-time Analysis**: Get instant classification results with confidence scores
|
| 27 |
+
- **Drone-Ready**: Designed for integration with drone technology for field monitoring
|
| 28 |
+
- **Clean Interface**: Intuitive web UI built with Gradio for farmers and agricultural professionals
|
| 29 |
|
| 30 |
+
## π οΈ Technology Stack
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
- **Backend**: Python, Hugging Face Transformers
|
| 33 |
+
- **Frontend**: Gradio
|
| 34 |
+
- **Model**: [Vision Transformer (ViT-base)](https://huggingface.co/google/vit-base-patch16-224) fine-tuned on [Beans dataset](https://huggingface.co/datasets/beans)
|
| 35 |
+
- **Deployment**: Hugging Face Spaces
|
| 36 |
|
| 37 |
+
## πββοΈ Quick Start
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
### Prerequisites
|
| 40 |
|
| 41 |
+
```bash
|
| 42 |
+
Python 3.8+
|
| 43 |
+
pip
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
### Installation
|
| 47 |
+
|
| 48 |
+
1. Clone the repository:
|
| 49 |
+
```bash
|
| 50 |
+
git clone https://github.com/Ashish-Soni08/bean-plant-health-classifier.git
|
| 51 |
+
cd bean-plant-health-vit-classifier
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
2. Install dependencies:
|
| 55 |
+
```bash
|
| 56 |
+
pip install -r requirements.txt
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
3. Run the application:
|
| 60 |
+
```bash
|
| 61 |
+
python app.py
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
4. Open your browser and navigate to `http://localhost:7860`
|
| 65 |
+
|
| 66 |
+
## π Usage
|
| 67 |
+
|
| 68 |
+
1. **Upload Image**: Click the image input field and upload a photo of a bean leaf
|
| 69 |
+
2. **Get Classification**: The app automatically analyzes the image and provides predictions
|
| 70 |
+
3. **View Results**: Check confidence scores for each disease category to make informed decisions
|
| 71 |
+
|
| 72 |
+
### Disease Categories
|
| 73 |
+
|
| 74 |
+
- **Angular Leaf Spot**: Fungal disease causing angular brown spots on leaves
|
| 75 |
+
- **Bean Rust**: Fungal disease creating rust-colored pustules on leaf surface
|
| 76 |
+
- **Healthy**: No visible signs of disease or infection
|
| 77 |
+
|
| 78 |
+
### Example
|
| 79 |
+
|
| 80 |
+
**Input Image:**
|
| 81 |
+
```
|
| 82 |
+
[Photo of bean leaf with brown spots]
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
**Output:**
|
| 86 |
+
```
|
| 87 |
+
Angular Leaf Spot: 87.5%
|
| 88 |
+
Bean Rust: 8.2%
|
| 89 |
+
Healthy: 4.3%
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## π§ Model Information
|
| 93 |
+
|
| 94 |
+
This app uses **Vision Transformer (ViT-base)** fine-tuned for agricultural disease detection:
|
| 95 |
+
|
| 96 |
+
- **Architecture**: Vision Transformer with 16x16 patches, 224x224 input resolution
|
| 97 |
+
- **Parameters**: ~86.6 million parameters
|
| 98 |
+
- **Training Data**: Beans dataset with 1,034 field images of bean leaves
|
| 99 |
+
- **Classes**: 3 categories (Angular Leaf Spot, Bean Rust, Healthy)
|
| 100 |
+
- **Base Model**: Pre-trained on ImageNet-21k, fine-tuned on beans disease dataset
|
| 101 |
+
|
| 102 |
+
## π Project Structure
|
| 103 |
+
|
| 104 |
+
```
|
| 105 |
+
bean-plant-health-vit-classifier/
|
| 106 |
+
βββ app.py # Main Gradio application
|
| 107 |
+
βββ requirements.txt # Python dependencies
|
| 108 |
+
βββ README.md # Project documentation
|
| 109 |
+
βββ images/ # Sample bean leaf images for testing
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## πΎ Agricultural Impact
|
| 113 |
+
|
| 114 |
+
This tool helps farmers:
|
| 115 |
+
- **Early Disease Detection**: Identify problems before they spread
|
| 116 |
+
- **Reduce Crop Loss**: Take timely action to treat diseased plants
|
| 117 |
+
- **Optimize Treatment**: Focus resources on affected areas only
|
| 118 |
+
- **Scale Monitoring**: Use with drones for large-field surveillance
|
| 119 |
+
|
| 120 |
+
## π License
|
| 121 |
+
|
| 122 |
+
This project is licensed under the Apache License 2.0
|
| 123 |
+
|
| 124 |
+
## π Acknowledgments
|
| 125 |
+
|
| 126 |
+
- [Hugging Face](https://huggingface.co/) for the Transformers library and model hosting
|
| 127 |
+
- [Gradio](https://gradio.app/) for the web interface framework
|
| 128 |
+
- [Google Research](https://github.com/google-research/vision_transformer) for the Vision Transformer architecture
|
| 129 |
+
|
| 130 |
+
## π Contact
|
| 131 |
+
|
| 132 |
+
Ashish Soni - [email protected]
|
| 133 |
+
|
| 134 |
+
Project Link: [github](https://github.com/Ashish-Soni08/bean-plant-health-classifier)
|