Skip to content

Zack4DEV/Sam_Filtered_ViT_Segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒณ 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

About

Advanced vision transformers and segmentation models (DINO, ViT, SAM, and YOLO+) to build a robust pipeline for identifying and isolating trees from images . With refined post-processing steps and enhanced mask filtering, high precision segmentation , improving overall performance through metrics such as IoU, precision, recall, and AP.

Topics

Resources

License

Stars

Watchers

Forks

Contributors