A newer version of the Gradio SDK is available:
5.35.0
metadata
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 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 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:
sdk: gradio
sdk_version: "4.24.0"
app_file: app.py