CoolFace
Apppublic

Brightsun10/instance-segmentation-demo

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿ–ผ๏ธ 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:

yaml
sdk: gradio
sdk_version: "4.24.0"
app_file: app.py