--- title: Instance Segmentation Demo emoji: 🖼️ colorFrom: pink colorTo: purple sdk: gradio sdk_version: 5.34.2 app_file: app.py pinned: false --- # 🖼️ Instance Segmentation with Mask2Former This demo performs **advanced instance segmentation** using [Mask2Former](https://huggingface.co/facebook/mask2former-swin-large-coco-instance) from Facebook AI. It identifies and highlights individual objects in an image with: - **Colored masks** - **Bounding boxes** - **Class labels and confidence scores** ## 🚀 How It Works - Input an image via upload or example selection. - The app uses the `facebook/mask2former-swin-large-coco-instance` model to detect objects. - Only the following classes are visualized: - `cat`, `dog`, `car`, `truck`, `bus`, `person` - Results are drawn on the image and displayed along with a status message. ## 🧠 Model - **Architecture:** Mask2Former with Swin-Large backbone - **Dataset:** COCO Instance - **Framework:** Hugging Face Transformers + PyTorch ## 💻 Technologies Used - Python 🐍 - [Gradio](https://gradio.app) for UI - Hugging Face Transformers - PIL & NumPy for image manipulation ## 📷 Example Images Try out with example images like: - Cats vs. Dogs - Street scenes with vehicles and people You can also upload your own images! ## 📌 Notes - Detection is limited to high-confidence predictions (`score > 0.9`) - This demo is optimized for CPU; inference may take up to 30 seconds. --- ## 🛠️ Developer Notes This app uses the following Gradio configuration: ```yaml sdk: gradio sdk_version: "4.24.0" app_file: app.py