π³ 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