Skip to content

Commit 834de44

Browse files
committed
update README for results format
1 parent 5ee7526 commit 834de44

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Grounded SAM 2 does not introduce significant methodological changes compared to
2424
- [Grounded SAM 2 Demos](#grounded-sam-2-demos)
2525
- [Grounded SAM 2 Image Demo](#grounded-sam-2-image-demo-with-grounding-dino)
2626
- [Grounded SAM 2 Image Demo (with Grounding DINO 1.5 & 1.6)](#grounded-sam-2-image-demo-with-grounding-dino-15--16)
27+
- [Automatically Saving Grounding and Segmentation Results](#automatically-saving-grounding-results-image-demo)
2728
- [Grounded SAM 2 Video Object Tracking Demo](#grounded-sam-2-video-object-tracking-demo)
2829
- [Grounded SAM 2 Video Object Tracking Demo (with Grounding DINO 1.5 & 1.6)](#grounded-sam-2-video-object-tracking-demo-with-grounding-dino-15--16)
2930
- [Grounded SAM 2 Video Object Tracking with Custom Video Input (using Grounding DINO)](#grounded-sam-2-video-object-tracking-demo-with-custom-video-input-with-grounding-dino)
@@ -128,6 +129,37 @@ Apply your API token from our official website here: [request API token](https:/
128129
python grounded_sam2_gd1.5_demo.py
129130
```
130131

132+
### Automatically Saving Grounding Results (Image Demo)
133+
134+
After setting `DUMP_JSON_RESULTS=True` in the following Grounded SAM 2 Image Demos:
135+
- [grounded_sam2_local_demo.py](./grounded_sam2_local_demo.py)
136+
- [grounded_sam2_hf_model_demo.py](./grounded_sam2_hf_model_demo.py)
137+
- [grounded_sam2_gd1.5_demo.py](./grounded_sam2_gd1.5_demo.py)
138+
139+
The `grounding` and `segmentation` results will be automatically saved in the `outputs` dir with the following format:
140+
141+
```python
142+
{
143+
"image_path": "path/to/image.jpg",
144+
"annotations": [
145+
{
146+
"class_name": "class_name",
147+
"bbox": [x1, y1, x2, y2],
148+
"segmentation": {
149+
"size": [h, w],
150+
"counts": "rle_encoded_mask"
151+
},
152+
"score": confidence score
153+
}
154+
],
155+
"box_format": "xyxy",
156+
"img_width": w,
157+
"img_height": h
158+
}
159+
```
160+
161+
162+
131163
### Grounded SAM 2 Video Object Tracking Demo
132164

133165
Based on the strong tracking capability of SAM 2, we can combined it with Grounding DINO for open-set object segmentation and tracking. You can run the following scripts to get the tracking results with Grounded SAM 2:

0 commit comments

Comments
 (0)