Brightsun10's picture
Update README.md
3115638 verified

A newer version of the Gradio SDK is available: 5.35.0

Upgrade
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