This project utilizes various image segmentation models to analyze and process images. The implemented code supports different segmentation models such as YOLO, SegFormer, Mask2Former, and DETR, allowing users to experiment with different segmentation techniques.
Ensure you have the following dependencies installed before running the code:
- ultralytics
- transformers
- timm
- torch
- torchvision
- matplotlib
- requests
- PIL
You can install these dependencies using the following:
pip install ultralytics transformers[torch] timm torch torchvision matplotlib requests Pillow
- Open the Jupyter notebook
fastersam.ipynb
in a suitable environment (e.g., Google Colab). - Run the notebook cell by cell, making sure to install dependencies if prompted.
- The notebook includes the ability to choose different segmentation models (
detr
,mask2former
,yolo
,segformer
) and provides visualization of the segmented images.
- DETR: Facebook DETR ResNet-50 Panoptic segmentation model.
- Mask2Former: Facebook Mask2Former Swin Base COCO Panoptic segmentation model.
- YOLO: Ultralytics YOLOv8x segmentation model.
- SegFormer: NVIDIA SegFormer B1 Cityscapes 1024x1024 fine-tuned segmentation model.
Returns the computing device (CPU).
Provides the desired image segmentation model based on the specified model type.
Finds the bounding box of non-zero values in a 2D NumPy array.
Displays a masked image with transparency.
Akshat Kumar Gupta (210050010), Arhaan Ahmad (210050016), Chaitanya Aggarwal (210050038), Hitesh Kumar (210050066), Yash Virani (210050170)
For any inquiries, please contact [210050016[at]iitb.ac.in].