| | --- |
| | license: mit |
| | library_name: rfdetr |
| | tags: |
| | - plant-disease |
| | - disease-detection |
| | - agriculture |
| | - computer-vision |
| | - object-detection |
| | - rf-detr |
| | - precision-agriculture |
| | - crop-health |
| | datasets: |
| | - plant-disease-faxnj |
| | metrics: |
| | - map |
| | pipeline_tag: object-detection |
| | --- |
| | |
| | # CropScan - Plant Disease Detection Model |
| |
|
| | CropScan is a plant disease detection model based on RF-DETR, designed to help farmers quickly identify health issues in their crops. |
| |
|
| | ## Why CropScan? |
| |
|
| | Farming is hard work. Farmers face countless daily challenges: unpredictable weather, economic pressures, and most critically, crop diseases that can devastate entire harvests in just a few days. |
| |
|
| | **CropScan was built to:** |
| |
|
| | - **Help farmers** detect diseases early, before they spread |
| | - **Reduce crop losses** through rapid and targeted intervention |
| | - **Optimize treatment usage** by precisely identifying affected areas |
| | - **Democratize access** to advanced diagnostic tools, once reserved for experts |
| |
|
| | Whether you're a small-scale farmer or a large producer, CropScan gives you the power to protect your crops with artificial intelligence. |
| |
|
| | ## Detection Example |
| |
|
| | | Original Image | Detection Result | |
| | |:--------------:|:----------------:| |
| | |  |  | |
| |
|
| | The left image shows a leaf with disease symptoms. The right image shows CropScan's result: each diseased region is identified and segmented with precision using SAM2 integration. |
| |
|
| | ## Technical Details |
| |
|
| | | Specification | Value | |
| | |--------------|-------| |
| | | **Architecture** | RF-DETR (medium) | |
| | | **Task** | Object Detection / Disease Localization | |
| | | **Performance** | mAP@50: 0.502 | |
| | | **Model Size** | 134 MB | |
| | | **Format** | PyTorch (.pth) | |
| |
|
| | ## Usage |
| |
|
| | ### Installation |
| |
|
| | ```bash |
| | pip install rfdetr torch torchvision |
| | ``` |
| |
|
| | ### Inference |
| |
|
| | ```python |
| | import torch |
| | from rfdetr import RFDETRBase |
| | from PIL import Image |
| | |
| | # Load the model |
| | model = RFDETRBase() |
| | checkpoint = torch.load("checkpoint_best_total.pth", map_location="cpu") |
| | model.load_state_dict(checkpoint) |
| | model.eval() |
| | |
| | # Load an image |
| | image = Image.open("your_image.jpg") |
| | |
| | # Run detection |
| | with torch.no_grad(): |
| | predictions = model(image) |
| | |
| | # predictions contains bounding boxes of diseased regions |
| | ``` |
| |
|
| | ### SAM2 Integration (Recommended) |
| |
|
| | For precise segmentation masks instead of bounding boxes, combine CropScan with SAM2: |
| |
|
| | ```python |
| | from sam2.sam2_image_predictor import SAM2ImagePredictor |
| | |
| | # Use CropScan boxes as prompts for SAM2 |
| | predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-small") |
| | predictor.set_image(image) |
| | |
| | for box in predictions.boxes: |
| | masks, scores, _ = predictor.predict(box=box, multimask_output=False) |
| | # masks contains the precise segmentation mask |
| | ``` |
| |
|
| | ## Training Data |
| |
|
| | This model was trained on the Plant Disease dataset from Roboflow Universe, containing images of leaves with various diseases. |
| |
|
| | ```bibtex |
| | @misc{plant-disease-faxnj_dataset, |
| | title = { Plant disease Dataset }, |
| | type = { Open Source Dataset }, |
| | author = { Project }, |
| | howpublished = { \url{ https://universe.roboflow.com/project-oklwn/plant-disease-faxnj } }, |
| | url = { https://universe.roboflow.com/project-oklwn/plant-disease-faxnj }, |
| | journal = { Roboflow Universe }, |
| | publisher = { Roboflow }, |
| | year = { 2024 }, |
| | month = { feb }, |
| | } |
| | ``` |
| |
|
| | ## Use Cases |
| |
|
| | - **Precision Agriculture**: Automated crop monitoring via drone or fixed camera |
| | - **Field Diagnosis**: Mobile app for rapid disease identification |
| | - **Agricultural Research**: Study of plant disease propagation |
| | - **Education**: Teaching tool for agronomy students |
| |
|
| | ## Limitations |
| |
|
| | - Trained primarily on PlantVillage-style images |
| | - Best performance on individual leaf images with clear backgrounds |
| | - SAM2 recommended for precise segmentation masks |
| | - Does not replace expert agronomist diagnosis |
| |
|
| | ## License |
| |
|
| | This model is distributed under the MIT license. You are free to use, modify, and distribute it for commercial or non-commercial purposes. |
| |
|
| | --- |
| |
|
| | *Built with passion to support those who feed us.* |
| |
|