FangSen9000 commited on
Commit ·
8f5c273
1
Parent(s): 7b643c6
add 03refine
Browse files- .gitignore +1 -0
- README_old_v1.md +0 -199
- README_old_v2.md +0 -199
- pipeline03_pose2video.sh +39 -13
.gitignore
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
*.jpg
|
| 2 |
*.png
|
| 3 |
*.npy
|
|
|
|
| 4 |
部分尝试
|
| 5 |
论文工具
|
| 6 |
论文所需
|
|
|
|
| 1 |
*.jpg
|
| 2 |
*.png
|
| 3 |
*.npy
|
| 4 |
+
.history/
|
| 5 |
部分尝试
|
| 6 |
论文工具
|
| 7 |
论文所需
|
README_old_v1.md
DELETED
|
@@ -1,199 +0,0 @@
|
|
| 1 |
-
# Intro
|
| 2 |
-
|
| 3 |
-
The entire project is divided into two parts: `text_or_gloss2pose` and `pose2video`. "Pose" here refers to the skeleton pose video after drawing.
|
| 4 |
-
|
| 5 |
-
- In the text2pose section (`Expected 4 seconds / one video`), I first used the DWpose tool to extract the npz format pose information for each word video frame by frame, and then merged each frame's npz into a large npz file. That is to say, we know the consecutive poses corresponding to each word. These consecutive poses are stored in the merged npz file. (We can also use deep learning models to generate these poses, but for commercial-level accuracy, this original data Dict method will be much more accurate.)
|
| 6 |
-
|
| 7 |
-
- In the pose2video section (`Expected 6 minutes / one video`), we render the visualized poses of the skeletons generated by each word. I used the ControlNext-SVD model for this.
|
| 8 |
-
|
| 9 |
-
# For Users
|
| 10 |
-
|
| 11 |
-
1. cd StableSigner
|
| 12 |
-
2. conda env create -f env/environment02_controlnext.yml
|
| 13 |
-
3. run `conda activate controlnext`
|
| 14 |
-
4. run `pip install -r env/requirements02_controlnext.txt`
|
| 15 |
-
|
| 16 |
-
first, change `good morning afternoon`, and run:
|
| 17 |
-
|
| 18 |
-
```python
|
| 19 |
-
python text2pose.py --gloss "good morning afternoon" --scale-y 1.3 --scale-x 1.2 --npz-interpolation 20 --width 512 --height 768 --fps 30 --hide-torso-lines true --ref-image-path ref_img_dict/01.jpeg
|
| 20 |
-
|
| 21 |
-
or
|
| 22 |
-
|
| 23 |
-
python text2pose.py --gloss "where is my cat" --scale-y 1.4 --scale-x 1.3 --npz-interpolation 20 --width 512 --height 768 --fps 30 --hide-torso-lines false
|
| 24 |
-
```
|
| 25 |
-
|
| 26 |
-
second, change `generated_pose_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832.mp4` & `ref_img_dict/03.jpeg`, and run:
|
| 27 |
-
|
| 28 |
-
```python
|
| 29 |
-
CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \
|
| 30 |
-
--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \
|
| 31 |
-
--output_dir generated_sign_video \
|
| 32 |
-
--max_frame_num 240 \
|
| 33 |
-
--guidance_scale 3 \
|
| 34 |
-
--batch_frames 24 \
|
| 35 |
-
--sample_stride 2 \
|
| 36 |
-
--overlap 4 \
|
| 37 |
-
--height 768 \
|
| 38 |
-
--width 512 \
|
| 39 |
-
--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \
|
| 40 |
-
--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \
|
| 41 |
-
--pose_video_path generated_pose_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832.mp4 \
|
| 42 |
-
--ref_image_path ref_img_dict/03.jpeg \
|
| 43 |
-
--precision fp16 \
|
| 44 |
-
--decode_chunk_size 2 \
|
| 45 |
-
--enable_geglu_optimization \
|
| 46 |
-
--enable_xformers
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
**Note:** In fact, I haven't installed xformer and haven't conducted a comprehensive test of it. If not installed, it will not affect the normal operation.
|
| 50 |
-
|
| 51 |
-
**Note:** It seems that the first time using pose2vid will result in poor quality and speed, and some kind of warm-up is necessary.
|
| 52 |
-
|
| 53 |
-
**Note:** I have tried running two stages with a resolution of `512*512`, but it seems that it causes instability in the background.
|
| 54 |
-
|
| 55 |
-
**Note:** In some cases, `512w*768h` can cause abnormalities in the torso. In rare instances, the torso may be mistaken for a hand. This issue should be able to be resolved by hiding the torso.
|
| 56 |
-
|
| 57 |
-
**BUG:** For some unknown reason, the current robustness is not as good as before (24.12 of the demos I tried were better than the current pose2video). The background is relatively prone to change, and the bottom part of the upper body is prone to become blurry. I have taken two or three improvements to solve this problem, but so far, it seems to still occur strangely and persistently. If this phenomenon continues, I am considering directly using Docker in 24.12 as a replacement. (Later, I discovered that simply using Docker did not lead to any significant improvement: Just the background and the hands became a little more stable. I felt that I needed to try to find the most stable configuration.)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
## Demo Gallery
|
| 61 |
-
|
| 62 |
-
<details>
|
| 63 |
-
<summary>🎬 Click to view generated examples</summary>
|
| 64 |
-
|
| 65 |
-
### Example 1: "good morning afternoon"
|
| 66 |
-
|
| 67 |
-
<div align="center">
|
| 68 |
-
<h4>Pose Video & Final Video</h4>
|
| 69 |
-
<video width="80%" controls>
|
| 70 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832_combined.mp4" type="video/mp4">
|
| 71 |
-
Your browser does not support the video tag.
|
| 72 |
-
</video>
|
| 73 |
-
</div>
|
| 74 |
-
|
| 75 |
-
---
|
| 76 |
-
|
| 77 |
-
### Example 2: "hello world"
|
| 78 |
-
|
| 79 |
-
<div align="center">
|
| 80 |
-
<h4>Pose Video & Final Video</h4>
|
| 81 |
-
<video width="80%" controls>
|
| 82 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/HELLO_WORLD_27184_63831_20250804_163910_combined.mp4" type="video/mp4">
|
| 83 |
-
Your browser does not support the video tag.
|
| 84 |
-
</video>
|
| 85 |
-
</div>
|
| 86 |
-
|
| 87 |
-
---
|
| 88 |
-
|
| 89 |
-
### Example 3: "I will attend this dinner party"
|
| 90 |
-
|
| 91 |
-
<div align="center">
|
| 92 |
-
<h4>Pose Video & Final Video</h4>
|
| 93 |
-
<video width="80%" controls>
|
| 94 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/I_WILL_ATTEND_THIS_DINNER_PARTY_28794_63364_04007_66628_16327_41325_20250804_164010_combined.mp4" type="video/mp4">
|
| 95 |
-
Your browser does not support the video tag.
|
| 96 |
-
</video>
|
| 97 |
-
</div>
|
| 98 |
-
|
| 99 |
-
---
|
| 100 |
-
|
| 101 |
-
### Example 4: "not find yet"
|
| 102 |
-
|
| 103 |
-
<div align="center">
|
| 104 |
-
<h4>Pose Video & Final Video</h4>
|
| 105 |
-
<video width="80%" controls>
|
| 106 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/NOT_FIND_YET_38868_21853_18535_20250804_164149_combined.mp4" type="video/mp4">
|
| 107 |
-
Your browser does not support the video tag.
|
| 108 |
-
</video>
|
| 109 |
-
</div>
|
| 110 |
-
|
| 111 |
-
---
|
| 112 |
-
|
| 113 |
-
### Example 5: "where is my cat"
|
| 114 |
-
|
| 115 |
-
<div align="center">
|
| 116 |
-
<h4>Pose Video & Final Video</h4>
|
| 117 |
-
<video width="80%" controls>
|
| 118 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/WHERE_IS_MY_CAT_63084_57261_37469_65313_20250804_164233_combined.mp4" type="video/mp4">
|
| 119 |
-
Your browser does not support the video tag.
|
| 120 |
-
</video>
|
| 121 |
-
</div>
|
| 122 |
-
|
| 123 |
-
### Note on video types:
|
| 124 |
-
- **Pose video**: Shows the skeleton/pose generated from input text/gloss
|
| 125 |
-
- **Final video**: The rendered sign language video with a virtual signer
|
| 126 |
-
- **Combined view**: Side-by-side comparison of pose and final video
|
| 127 |
-
|
| 128 |
-
</details>
|
| 129 |
-
<br>
|
| 130 |
-
|
| 131 |
-
# For developers
|
| 132 |
-
|
| 133 |
-
1. git clone https://huggingface.co/datasets/FangSen9000/StableSigner
|
| 134 |
-
2. cd StableSigner
|
| 135 |
-
|
| 136 |
-
## tutorial00 Use DWpose to preprocess the original sign language video
|
| 137 |
-
|
| 138 |
-
`tools-new-2025` is a tool that can extract the original video into a npz file containing dwpose skeleton posture information (a type of skeleton posture that is almost compatible with all current pose2video models).
|
| 139 |
-
|
| 140 |
-
1. conda env create -f env/environment01_dwpose.yml
|
| 141 |
-
2. run `conda activate dwpose`
|
| 142 |
-
3. run `pip install -r env/requirements01_dwpose.txt`
|
| 143 |
-
4. put raw sign viseos, like `tools-new-2025/input/test_dataset`
|
| 144 |
-
5. cd `StableSigner/tools-new-2025/main`
|
| 145 |
-
6. run `python pipeline00_extract_split_video_to_image.py` (Default frame rate is 30fps, and the video will be automatically cropped to a square shape.)
|
| 146 |
-
7. run `python pipeline01_extract_dwpose_from_video.py` (It will generate files other than npz. We usually don't need them and can comment out the relevant code.)
|
| 147 |
-
8. run `conda deactivate`, we finish the preprocess.
|
| 148 |
-
|
| 149 |
-
## tutorial01 prepare pose dict
|
| 150 |
-
|
| 151 |
-
1. cd StableSigner
|
| 152 |
-
2. run `python utils/pipeline01_merge_frame_level_npz_from_video_dir.py tools-new-2025/output/test_dataset_results`
|
| 153 |
-
3. Place the corresponding "gloss-videoID" mapping in the pose dict
|
| 154 |
-
|
| 155 |
-
## tutorial02 get pose video from text input
|
| 156 |
-
|
| 157 |
-
```python
|
| 158 |
-
|
| 159 |
-
# Default
|
| 160 |
-
python text2pose.py --gloss "good morning afternoon" --npz-interpolation 20 --width 512 --height 768 --fps 30
|
| 161 |
-
|
| 162 |
-
# Single gloss
|
| 163 |
-
python text2pose.py --gloss "hello"
|
| 164 |
-
|
| 165 |
-
# Multiple glosses with smoothing
|
| 166 |
-
python text2pose.py --gloss "hello world" --smoothing fade --smoothing-frames 5
|
| 167 |
-
|
| 168 |
-
# Custom video parameters
|
| 169 |
-
python text2pose.py --gloss "good afternoon" --width 512 --height 768 --fps 30
|
| 170 |
-
```
|
| 171 |
-
|
| 172 |
-
## tutorial03 render pose video
|
| 173 |
-
|
| 174 |
-
1. cd StableSigner
|
| 175 |
-
2. conda env create -f env/environment02_controlnext.yml
|
| 176 |
-
3. run `conda activate controlnext`
|
| 177 |
-
4. run `pip install -r env/requirements02_controlnext.txt`
|
| 178 |
-
|
| 179 |
-
```python
|
| 180 |
-
CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \
|
| 181 |
-
--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \
|
| 182 |
-
--output_dir generated_sign_video \
|
| 183 |
-
--max_frame_num 240 \
|
| 184 |
-
--guidance_scale 3 \
|
| 185 |
-
--batch_frames 24 \
|
| 186 |
-
--sample_stride 2 \
|
| 187 |
-
--overlap 4 \
|
| 188 |
-
--height 768 \
|
| 189 |
-
--width 512 \
|
| 190 |
-
--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \
|
| 191 |
-
--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \
|
| 192 |
-
--pose_video_path generated_pose_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832.mp4 \
|
| 193 |
-
--ref_image_path ref_img_dict/03.jpeg \
|
| 194 |
-
--precision fp16 \
|
| 195 |
-
--decode_chunk_size 2 \
|
| 196 |
-
--enable_geglu_optimization \
|
| 197 |
-
--enable_xformers
|
| 198 |
-
```
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README_old_v2.md
DELETED
|
@@ -1,199 +0,0 @@
|
|
| 1 |
-
# Intro
|
| 2 |
-
|
| 3 |
-
The entire project is divided into two parts: `text_or_gloss2pose` and `pose2video`. "Pose" here refers to the skeleton pose video after drawing.
|
| 4 |
-
|
| 5 |
-
- In the gloss2pose section (`Expected 4 seconds / one video`), I first used the DWpose tool to extract the npz format pose information for each word video frame by frame, and then merged each frame's npz into a large npz file. That is to say, we know the consecutive poses corresponding to each word. These consecutive poses are stored in the merged npz file. (We can also use deep learning models to generate these poses, but for commercial-level accuracy, this original data Dict method will be much more accurate.)
|
| 6 |
-
|
| 7 |
-
- In the pose2video section (`Expected 6 minutes / one video`), we render the visualized poses of the skeletons generated by each word. I used the ControlNext-SVD model for this.
|
| 8 |
-
|
| 9 |
-
# For Users
|
| 10 |
-
|
| 11 |
-
1. cd StableSigner
|
| 12 |
-
2. conda env create -f env/environment02_controlnext.yml
|
| 13 |
-
3. run `conda activate controlnext`
|
| 14 |
-
4. run `pip install -r env/requirements02_controlnext.txt`
|
| 15 |
-
|
| 16 |
-
first, change `good morning afternoon`, and run:
|
| 17 |
-
|
| 18 |
-
```python
|
| 19 |
-
python gloss2pose.py --gloss "good morning afternoon" --scale-y 1.4 --scale-x 1.3 --npz-interpolation 20 --width 512 --height 768 --fps 30 --hide-torso-lines true --ref-image-path ref_img_dict/01.jpeg
|
| 20 |
-
|
| 21 |
-
or
|
| 22 |
-
|
| 23 |
-
python gloss2pose.py --gloss "where is my cat" --scale-y 1.5 --scale-x 1.5 --npz-interpolation 20 --width 512 --height 512 --fps 30 --hide-torso-lines false --draw-style openpose
|
| 24 |
-
```
|
| 25 |
-
|
| 26 |
-
second, change `generated_pose_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832.mp4` & `ref_img_dict/03.jpeg`, and run:
|
| 27 |
-
|
| 28 |
-
```python
|
| 29 |
-
CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \
|
| 30 |
-
--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \
|
| 31 |
-
--output_dir generated_sign_video \
|
| 32 |
-
--max_frame_num 240 \
|
| 33 |
-
--guidance_scale 3 \
|
| 34 |
-
--batch_frames 24 \
|
| 35 |
-
--sample_stride 2 \
|
| 36 |
-
--overlap 4 \
|
| 37 |
-
--height 768 \
|
| 38 |
-
--width 512 \
|
| 39 |
-
--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \
|
| 40 |
-
--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \
|
| 41 |
-
--pose_video_path generated_pose_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832.mp4 \
|
| 42 |
-
--ref_image_path ref_img_dict/03.jpeg \
|
| 43 |
-
--precision fp16 \
|
| 44 |
-
--decode_chunk_size 2 \
|
| 45 |
-
--enable_geglu_optimization \
|
| 46 |
-
--enable_xformers
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
**Note:** In fact, I haven't installed xformer and haven't conducted a comprehensive test of it. If not installed, it will not affect the normal operation.
|
| 50 |
-
|
| 51 |
-
**Note:** It seems that the first time using pose2vid will result in poor quality and speed, and some kind of warm-up is necessary.
|
| 52 |
-
|
| 53 |
-
**Note:** I have tried running two stages with a resolution of `512*512`, but it seems that it causes instability in the background.
|
| 54 |
-
|
| 55 |
-
**Note:** In some cases, `512w*768h` can cause abnormalities in the torso. In rare instances, the torso may be mistaken for a hand. This issue should be able to be resolved by hiding the torso.
|
| 56 |
-
|
| 57 |
-
**BUG:** For some unknown reason, the current robustness is not as good as before (24.12 of the demos I tried were better than the current pose2video). The background is relatively prone to change, and the bottom part of the upper body is prone to become blurry. I have taken two or three improvements to solve this problem, but so far, it seems to still occur strangely and persistently. If this phenomenon continues, I am considering directly using Docker in 24.12 as a replacement. (Later, I discovered that simply using Docker did not lead to any significant improvement: Just the background and the hands became a little more stable. I felt that I needed to try to find the most stable configuration.)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
## Demo Gallery
|
| 61 |
-
|
| 62 |
-
<details>
|
| 63 |
-
<summary>🎬 Click to view generated examples</summary>
|
| 64 |
-
|
| 65 |
-
### Example 1: "good morning afternoon"
|
| 66 |
-
|
| 67 |
-
<div align="center">
|
| 68 |
-
<h4>Pose Video & Final Video</h4>
|
| 69 |
-
<video width="80%" controls>
|
| 70 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832_combined.mp4" type="video/mp4">
|
| 71 |
-
Your browser does not support the video tag.
|
| 72 |
-
</video>
|
| 73 |
-
</div>
|
| 74 |
-
|
| 75 |
-
---
|
| 76 |
-
|
| 77 |
-
### Example 2: "hello world"
|
| 78 |
-
|
| 79 |
-
<div align="center">
|
| 80 |
-
<h4>Pose Video & Final Video</h4>
|
| 81 |
-
<video width="80%" controls>
|
| 82 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/HELLO_WORLD_27184_63831_20250804_163910_combined.mp4" type="video/mp4">
|
| 83 |
-
Your browser does not support the video tag.
|
| 84 |
-
</video>
|
| 85 |
-
</div>
|
| 86 |
-
|
| 87 |
-
---
|
| 88 |
-
|
| 89 |
-
### Example 3: "I will attend this dinner party"
|
| 90 |
-
|
| 91 |
-
<div align="center">
|
| 92 |
-
<h4>Pose Video & Final Video</h4>
|
| 93 |
-
<video width="80%" controls>
|
| 94 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/I_WILL_ATTEND_THIS_DINNER_PARTY_28794_63364_04007_66628_16327_41325_20250804_164010_combined.mp4" type="video/mp4">
|
| 95 |
-
Your browser does not support the video tag.
|
| 96 |
-
</video>
|
| 97 |
-
</div>
|
| 98 |
-
|
| 99 |
-
---
|
| 100 |
-
|
| 101 |
-
### Example 4: "not find yet"
|
| 102 |
-
|
| 103 |
-
<div align="center">
|
| 104 |
-
<h4>Pose Video & Final Video</h4>
|
| 105 |
-
<video width="80%" controls>
|
| 106 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/NOT_FIND_YET_38868_21853_18535_20250804_164149_combined.mp4" type="video/mp4">
|
| 107 |
-
Your browser does not support the video tag.
|
| 108 |
-
</video>
|
| 109 |
-
</div>
|
| 110 |
-
|
| 111 |
-
---
|
| 112 |
-
|
| 113 |
-
### Example 5: "where is my cat"
|
| 114 |
-
|
| 115 |
-
<div align="center">
|
| 116 |
-
<h4>Pose Video & Final Video</h4>
|
| 117 |
-
<video width="80%" controls>
|
| 118 |
-
<source src="https://huggingface.co/datasets/FangSen9000/StableSigner/resolve/main/generated_sign_video/WHERE_IS_MY_CAT_63084_57261_37469_65313_20250804_164233_combined.mp4" type="video/mp4">
|
| 119 |
-
Your browser does not support the video tag.
|
| 120 |
-
</video>
|
| 121 |
-
</div>
|
| 122 |
-
|
| 123 |
-
### Note on video types:
|
| 124 |
-
- **Pose video**: Shows the skeleton/pose generated from input text/gloss
|
| 125 |
-
- **Final video**: The rendered sign language video with a virtual signer
|
| 126 |
-
- **Combined view**: Side-by-side comparison of pose and final video
|
| 127 |
-
|
| 128 |
-
</details>
|
| 129 |
-
<br>
|
| 130 |
-
|
| 131 |
-
# For developers
|
| 132 |
-
|
| 133 |
-
1. git clone https://huggingface.co/datasets/FangSen9000/StableSigner
|
| 134 |
-
2. cd StableSigner
|
| 135 |
-
|
| 136 |
-
## tutorial00 Use DWpose to preprocess the original sign language video
|
| 137 |
-
|
| 138 |
-
`tools-new-2025` is a tool that can extract the original video into a npz file containing dwpose skeleton posture information (a type of skeleton posture that is almost compatible with all current pose2video models).
|
| 139 |
-
|
| 140 |
-
1. conda env create -f env/environment01_dwpose.yml
|
| 141 |
-
2. run `conda activate dwpose`
|
| 142 |
-
3. run `pip install -r env/requirements01_dwpose.txt`
|
| 143 |
-
4. put raw sign viseos, like `tools-new-2025/input/test_dataset`
|
| 144 |
-
5. cd `StableSigner/tools-new-2025/main`
|
| 145 |
-
6. run `python pipeline00_extract_split_video_to_image.py` (Default frame rate is 30fps, and the video will be automatically cropped to a square shape.)
|
| 146 |
-
7. run `python pipeline01_extract_dwpose_from_video.py` (It will generate files other than npz. We usually don't need them and can comment out the relevant code.)
|
| 147 |
-
8. run `conda deactivate`, we finish the preprocess.
|
| 148 |
-
|
| 149 |
-
## tutorial01 prepare pose dict
|
| 150 |
-
|
| 151 |
-
1. cd StableSigner
|
| 152 |
-
2. run `python utils/pipeline01_merge_frame_level_npz_from_video_dir.py tools-new-2025/output/test_dataset_results`
|
| 153 |
-
3. Place the corresponding "gloss-videoID" mapping in the pose dict
|
| 154 |
-
|
| 155 |
-
## tutorial02 get pose video from text input
|
| 156 |
-
|
| 157 |
-
```python
|
| 158 |
-
|
| 159 |
-
# Default
|
| 160 |
-
python gloss2pose.py --gloss "good morning afternoon" --npz-interpolation 20 --width 512 --height 768 --fps 30
|
| 161 |
-
|
| 162 |
-
# Single gloss
|
| 163 |
-
python gloss2pose.py --gloss "hello"
|
| 164 |
-
|
| 165 |
-
# Multiple glosses with smoothing
|
| 166 |
-
python gloss2pose.py --gloss "hello world" --smoothing fade --smoothing-frames 5
|
| 167 |
-
|
| 168 |
-
# Custom video parameters
|
| 169 |
-
python gloss2pose.py --gloss "good afternoon" --width 512 --height 768 --fps 30
|
| 170 |
-
```
|
| 171 |
-
|
| 172 |
-
## tutorial03 render pose video
|
| 173 |
-
|
| 174 |
-
1. cd StableSigner
|
| 175 |
-
2. conda env create -f env/environment02_controlnext.yml
|
| 176 |
-
3. run `conda activate controlnext`
|
| 177 |
-
4. run `pip install -r env/requirements02_controlnext.txt`
|
| 178 |
-
|
| 179 |
-
```python
|
| 180 |
-
CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \
|
| 181 |
-
--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \
|
| 182 |
-
--output_dir generated_sign_video \
|
| 183 |
-
--max_frame_num 240 \
|
| 184 |
-
--guidance_scale 3 \
|
| 185 |
-
--batch_frames 24 \
|
| 186 |
-
--sample_stride 2 \
|
| 187 |
-
--overlap 4 \
|
| 188 |
-
--height 768 \
|
| 189 |
-
--width 512 \
|
| 190 |
-
--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \
|
| 191 |
-
--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \
|
| 192 |
-
--pose_video_path generated_pose_video/GOOD_MORNING_AFTERNOON_25073_36863_01435_20250804_160832.mp4 \
|
| 193 |
-
--ref_image_path ref_img_dict/03.jpeg \
|
| 194 |
-
--precision fp16 \
|
| 195 |
-
--decode_chunk_size 2 \
|
| 196 |
-
--enable_geglu_optimization \
|
| 197 |
-
--enable_xformers
|
| 198 |
-
```
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pipeline03_pose2video.sh
CHANGED
|
@@ -3,21 +3,47 @@ set -euo pipefail
|
|
| 3 |
|
| 4 |
source /research/cbim/vast/sf895/miniforge3/bin/activate one-to-all
|
| 5 |
|
| 6 |
-
cd "$(dirname "$0")"
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
CUDA_VISIBLE_DEVICES=5 python inference_1.3b.py --pose_video TODAY_WEATHER_NICE_20251215_142126_openpose_style.mp4 --ref_image woman.jpg &
|
| 17 |
-
CUDA_VISIBLE_DEVICES=6 python inference_1.3b.py --pose_video WEHRE_IS_MY_CAT_20251215_142307_openpose_style.mp4 --ref_image woman.jpg &
|
| 18 |
-
CUDA_VISIBLE_DEVICES=7 python inference_1.3b.py --pose_video I_GO_SCHOOL_LATER_20251215_142204_openpose_style.mp4 --ref_image woman.jpg &
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
echo "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
source /research/cbim/vast/sf895/miniforge3/bin/activate one-to-all
|
| 5 |
|
| 6 |
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 7 |
+
VIDEO_GEN_DIR="${ROOT_DIR}/One-to-All-Animation/video-generation"
|
| 8 |
|
| 9 |
+
POSE_VIDEO="${POSE_VIDEO:-HELLO_GOOD_MORNING_20251215_142658_openpose_style.mp4}"
|
| 10 |
+
REF_IMAGE="${REF_IMAGE:-${ROOT_DIR}/ref_img_dict/man.jpg}"
|
| 11 |
+
GPU_ID="${GPU_ID:-1}"
|
| 12 |
+
REF_CFG="${REF_CFG:-2.5}"
|
| 13 |
+
POSE_CFG="${POSE_CFG:-1.5}"
|
| 14 |
+
STAGE1_OUT_DIR="${STAGE1_OUT_DIR:-${ROOT_DIR}/generated_sign_video}"
|
| 15 |
+
STAGE2_OUT_DIR="${STAGE2_OUT_DIR:-${ROOT_DIR}/generated_sign_video_refine}"
|
| 16 |
|
| 17 |
+
echo "Stage1: pose2video"
|
| 18 |
+
(
|
| 19 |
+
cd "${VIDEO_GEN_DIR}"
|
| 20 |
+
ONE_TO_ALL_OUTPUT_DIR="${STAGE1_OUT_DIR}" \
|
| 21 |
+
CUDA_VISIBLE_DEVICES="${GPU_ID}" \
|
| 22 |
+
python inference_1.3b.py --pose_video "${POSE_VIDEO}" --ref_image "${REF_IMAGE}"
|
| 23 |
+
)
|
| 24 |
|
| 25 |
+
pose_base="$(basename "${POSE_VIDEO}")"
|
| 26 |
+
pose_base="${pose_base%.*}"
|
| 27 |
+
ref_base="$(basename "${REF_IMAGE}")"
|
| 28 |
+
ref_base="${ref_base%.*}"
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
stage1_pattern="${STAGE1_OUT_DIR}"/*_ref_${REF_CFG}_pose_${POSE_CFG}/"ref_${ref_base}_vid_${pose_base}_ref_${REF_CFG}_pose_${POSE_CFG}.mp4"
|
| 31 |
+
stage1_video="$(ls -t ${stage1_pattern} 2>/dev/null | head -n 1 || true)"
|
| 32 |
+
if [[ -z "${stage1_video}" ]]; then
|
| 33 |
+
echo "Stage1 output not found. Pattern: ${stage1_pattern}" >&2
|
| 34 |
+
exit 1
|
| 35 |
+
fi
|
| 36 |
|
| 37 |
+
echo "Stage2: refine on ${stage1_video}"
|
| 38 |
+
(
|
| 39 |
+
cd "${VIDEO_GEN_DIR}"
|
| 40 |
+
./infer_refine.sh \
|
| 41 |
+
--input "${stage1_video}" \
|
| 42 |
+
--ref "${REF_IMAGE}" \
|
| 43 |
+
--ref-cfg "${REF_CFG}" \
|
| 44 |
+
--pose-cfg "${POSE_CFG}" \
|
| 45 |
+
--out-dir "${STAGE2_OUT_DIR}" \
|
| 46 |
+
--gpu "${GPU_ID}"
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
echo "Done."
|