Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,62 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
5 |
sdk: gradio
|
|
|
6 |
app_file: app.py
|
7 |
pinned: false
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Instance Segmentation Demo
|
3 |
+
emoji: 🖼️
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: "4.24.0"
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
# 🖼️ Instance Segmentation with Mask2Former
|
13 |
+
|
14 |
+
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:
|
15 |
+
- **Colored masks**
|
16 |
+
- **Bounding boxes**
|
17 |
+
- **Class labels and confidence scores**
|
18 |
+
|
19 |
+
## 🚀 How It Works
|
20 |
+
|
21 |
+
- Input an image via upload or example selection.
|
22 |
+
- The app uses the `facebook/mask2former-swin-large-coco-instance` model to detect objects.
|
23 |
+
- Only the following classes are visualized:
|
24 |
+
- `cat`, `dog`, `car`, `truck`, `bus`, `person`
|
25 |
+
- Results are drawn on the image and displayed along with a status message.
|
26 |
+
|
27 |
+
## 🧠 Model
|
28 |
+
|
29 |
+
- **Architecture:** Mask2Former with Swin-Large backbone
|
30 |
+
- **Dataset:** COCO Instance
|
31 |
+
- **Framework:** Hugging Face Transformers + PyTorch
|
32 |
+
|
33 |
+
## 💻 Technologies Used
|
34 |
+
|
35 |
+
- Python 🐍
|
36 |
+
- [Gradio](https://gradio.app) for UI
|
37 |
+
- Hugging Face Transformers
|
38 |
+
- PIL & NumPy for image manipulation
|
39 |
+
|
40 |
+
## 📷 Example Images
|
41 |
+
|
42 |
+
Try out with example images like:
|
43 |
+
- Cats vs. Dogs
|
44 |
+
- Street scenes with vehicles and people
|
45 |
+
|
46 |
+
You can also upload your own images!
|
47 |
+
|
48 |
+
## 📌 Notes
|
49 |
+
|
50 |
+
- Detection is limited to high-confidence predictions (`score > 0.9`)
|
51 |
+
- This demo is optimized for CPU; inference may take up to 30 seconds.
|
52 |
+
|
53 |
+
---
|
54 |
+
|
55 |
+
## 🛠️ Developer Notes
|
56 |
+
|
57 |
+
This app uses the following Gradio configuration:
|
58 |
+
|
59 |
+
```yaml
|
60 |
+
sdk: gradio
|
61 |
+
sdk_version: "4.24.0"
|
62 |
+
app_file: app.py
|