Skip to content

Commit 38d993a

Browse files
committed
update code for grounded_sam_osx_demo
1 parent 30f0bfb commit 38d993a

8 files changed

+12
-34
lines changed

README.md

+11-18
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ Using BLIP to generate caption, extracting tags with ChatGPT, and using Grounded
4141

4242
**Grounded-SAM+OSX: Reconstruct 3D Human Whole-Body Mesh!**
4343

44-
Using Grounded-SAM for box and mask generating, Using [OSX](https://github.com/IDEA-Research/OSX) to estimate the SMPLX parameters and reconstruct 3D whole-body (body, face and hand) human mesh. Here's a demo:
44+
Using Grounded-SAM for box and mask generating, using [OSX](https://github.com/IDEA-Research/OSX) to estimate the SMPLX parameters and reconstruct 3D whole-body (body, face and hand) human mesh. Here's a demo:
4545

4646
<p align="middle">
47-
<img src="./assets/grouned_sam_osx_demo.gif">
47+
<img src="assets/osx/grouned_sam_osx_demo.gif">
4848
<br>
4949
</p>
5050

@@ -139,8 +139,8 @@ pip install --upgrade diffusers[torch]
139139
Install osx:
140140

141141
```bash
142-
cd osx
143-
bash install.sh
142+
git submodule update --init --recursive
143+
cd grounded-sam-osx & bash install.sh
144144
```
145145

146146
The following optional dependencies are necessary for mask post-processing, saving masks in COCO format, the example notebooks, and exporting the model in ONNX format. `jupyter` is also required to run the example notebooks.
@@ -149,7 +149,7 @@ The following optional dependencies are necessary for mask post-processing, savi
149149
pip install opencv-python pycocotools matplotlib onnxruntime onnx ipykernel
150150
```
151151

152-
More details can be found in [install segment anything](https://github.com/facebookresearch/segment-anything#installation) and [install GroundingDINO](https://github.com/IDEA-Research/GroundingDINO#install)
152+
More details can be found in [install segment anything](https://github.com/facebookresearch/segment-anything#installation) and [install GroundingDINO](https://github.com/IDEA-Research/GroundingDINO#install) and [install OSX](https://github.com/IDEA-Research/OSX)
153153

154154

155155
## :runner: Run Grounding DINO Demo
@@ -358,7 +358,7 @@ python chatbot.py
358358
## :man_dancing: Run Grounded-Segment-Anything + OSX Demo
359359

360360
- Download the checkpoint `osx_l_wo_decoder.pth.tar` from [here](https://drive.google.com/drive/folders/1x7MZbB6eAlrq5PKC9MaeIm4GqkBpokow?usp=share_link) for OSX:
361-
- Download the human model files and place it into `osx/utils/human_model_files` following the instruction of [OSX](https://github.com/IDEA-Research/OSX).
361+
- Download the human model files and place it into `grounded-sam-osx/utils/human_model_files` following the instruction of [OSX](https://github.com/IDEA-Research/OSX).
362362

363363
- Run Demo
364364

@@ -369,7 +369,7 @@ python grounded_sam_osx_demo.py \
369369
--grounded_checkpoint groundingdino_swint_ogc.pth \
370370
--sam_checkpoint sam_vit_h_4b8939.pth \
371371
--osx_checkpoint osx_l_wo_decoder.pth.tar \
372-
--input_image assets/grounded_sam_osx_demo2.png \
372+
--input_image assets/osx/grounded_sam_osx_demo.png \
373373
--output_dir "outputs" \
374374
--box_threshold 0.3 \
375375
--text_threshold 0.25 \
@@ -379,15 +379,15 @@ python grounded_sam_osx_demo.py \
379379

380380
- The model prediction visualization will be saved in `output_dir` as follow:
381381

382-
<img src="./assets/grounded_sam_osx_output.jpg" style="zoom: 49%;" />
382+
<img src="assets/osx/grounded_sam_osx_output.jpg" style="zoom: 49%;" />
383383

384-
- You can also track someone and estimate his 3D pose and shape with a text prompt, for example:
384+
- We also support promptable 3D whole-body mesh recovery. For example, you can also track someone and estimate his 3D pose and shape with a text prompt, for example:
385385

386-
| ![space-1.jpg](./assets/grounded_sam_osx_output1.jpg) |
386+
| ![space-1.jpg](assets/osx/grounded_sam_osx_output1.jpg) |
387387
| :---------------------------------------------------: |
388388
| *A person with pink clothes* |
389389

390-
| ![space-1.jpg](./assets/grounded_sam_osx_output2.jpg) |
390+
| ![space-1.jpg](assets/osx/grounded_sam_osx_output2.jpg) |
391391
| :---------------------------------------------------: |
392392
| *A man with a sunglasses* |
393393

@@ -411,11 +411,4 @@ If you find this project helpful for your research, please consider citing the f
411411
author={Shilong Liu and Zhaoyang Zeng and Tianhe Ren and Feng Li and Hao Zhang and Jie Yang and Chunyuan Li and Jianwei Yang and Hang Su and Jun Zhu and Lei Zhang},
412412
year={2023}
413413
}
414-
415-
@article{lin2023one,
416-
title={One-Stage 3D Whole-Body Mesh Recovery with Component Aware Transformer},
417-
author={Lin, Jing and Zeng, Ailing and Wang, Haoqian and Zhang, Lei and Li, Yu},
418-
journal={arXiv preprint arXiv:2303.16160},
419-
year={2023}
420-
}
421414
```

assets/osx/grounded_sam_osx_demo.png

1.47 MB
Loading
File renamed without changes.

grounded_sam_osx_demo.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import os.path as osp
2-
import random
3-
41
import torchvision.transforms as transforms
52
from torch.nn.parallel.data_parallel import DataParallel
63
import torch.backends.cudnn as cudnn
@@ -25,7 +22,7 @@
2522

2623
# OSX
2724
import sys
28-
sys.path.insert(0, 'osx')
25+
sys.path.insert(0, 'grounded-sam-osx')
2926
from osx import get_model
3027
from config import cfg
3128
from utils.preprocessing import load_img, process_bbox, generate_patch_image

grounded_sam_osx_demo.sh

-12
This file was deleted.

0 commit comments

Comments
 (0)