🌳 Tree Detection and Segmentation Pipeline (DINO + ViT + SAM + YOLO+)
A modern deep learning project combining the power of vision transformers and segment-anything models to accurately detect and isolate trees in complex scenes using advanced filtering and evaluation techniques.
📌 Key Components
| Model | Purpose |
|---|---|
| DINO | Vision Transformer-based object detection |
| ViT | Backbone feature extraction |
| SAM | Smart segmentation with mask refinement |
| YOLO+ | Real-time object detection |
- ✅ Refined Segmentation Masks: Removed irrelevant masks (e.g., humans, background) generated by SAM.
- ✅ Post-processing Isolation: Only tree-like objects are segmented with minimal overhead.
- ✅ Mask Filtering: Shape and size-based filtering improves mask quality.
- ✅ Evaluation Support: Built-in performance evaluation using:
- IoU (Intersection over Union)
- Precision & Recall
- AP (Average Precision)
🚀 Quick Start
Requirements
bash pip install jupyter
Inference
bash jupyter nbconvert --to script Sam_Filtered_ViT_Segmentation.ipynb python sam_filtered_vit_segmentation.py --image Images/Trees/Tree.jpg
Options
| Argument | Description |
|---|---|
| --model | Choose model: dino, yolo+, sam |
| --evaluate | Run evaluation metrics |
| --refine | Apply shape/size mask filtering |
📊 Evaluation
We evaluate performance using:
- IoU - Measures overlap of predicted vs ground truth
- Precision / Recall - Accuracy of segmentation results
- AP - Average precision across confidence thresholds
Results are printed and logged automatically.
📁 Project Structure
├── Images/ │ ├── Trees/ │ ├── NotTrees/ ├── Labels/ │ ├── Trees/ │ ├── NotTrees/ ├── dataset.yaml ├── Sam_Filtered_ViT_Segmentation ├── README.md └── LICENSE
🤖 Authors & Contributions
- 🔬 DINO & ViT Integration - @Zack4DEV
- 🧠 SAM Post-Processing - @Zack4DEV
- ⚙ Evaluation Engine - @Zack4DEV
📜 License
MIT License - see LICENSE for details.
🌍 Future Work
- ✅ Integrate image captioning for detected tree regions
- ⏳ Multi-class support (e.g., tree species)
- ⏳ Web UI with streamlit or Gradio