Spaces:
Sleeping
Sleeping
A newer version of the Streamlit SDK is available:
1.45.1
metadata
title: Red Spider Mite Detection (Streamlit)
emoji: 🕷️
colorFrom: green
colorTo: yellow
sdk: streamlit
sdk_version: 1.36.0
app_file: streamlit_app.py
pinned: false
Hugging Face Gradio Demo: Red Spider Mite Detection
This application detects potential red spider mite infections on leaves in videos.
How it Works
- Upload a video or select an example.
- Click the "Detect" button.
- The application processes every 100th frame.
- It uses SAM 2 (Segment Anything Model 2) to generate masks for potential objects.
- Masks are filtered based on:
- Non-Maximum Suppression (NMS) to remove overlaps.
- Aspect Ratio (to remove likely branches).
- Color (HSV range check within the mask).
- Sharpness (Laplacian variance).
- Segments passing all filters are classified as 'Infected' or 'Not Infected' using a fine-tuned MobileNetV3 model.
- Results are displayed in two galleries:
- Top: Cropped images of the filtered leaf segments with their classification.
- Bottom: Full processed frames showing bounding boxes around detected infected leaves.
Setup (Local)
- Ensure Python 3.9+ is installed.
- Clone the repository (if not already done).
- Install dependencies:
pip install -r requirements.txt
- Run the app:
python app.py
- Open the local URL provided in your browser.
Files
app.py
: Main Gradio application script.requirements.txt
: Python dependencies.checkpoints/
: Contains the SAM 2 model checkpoint.models/
: Contains the classification model.sam2/
: Contains the necessary SAM 2 library source code.test_videos/
: Contains example videos for the demo.README.md
: This file.LICENSE
: Copied license file..gitignore
: Standard Python gitignore.