Support custom inference lengths
Browse files- README.md +20 -41
- inference.py +2 -3
README.md
CHANGED
|
@@ -21,8 +21,8 @@ tags:
|
|
| 21 |
<a href="#code">
|
| 22 |
<img src="https://img.shields.io/badge/Conference-ECCV%202026-orange" alt="Conference">
|
| 23 |
</a>
|
| 24 |
-
<a href="
|
| 25 |
-
<img src="https://img.shields.io/badge/
|
| 26 |
</a>
|
| 27 |
</p>
|
| 28 |
|
|
@@ -34,8 +34,10 @@ tags:
|
|
| 34 |
>
|
| 35 |
> FlowerDance combines MeanFlow with Physical Consistency Constraints for high-quality few-step sampling, and uses a lightweight non-autoregressive BiMamba backbone with Channel-Level Fusion for long-horizon music-to-dance synthesis. It also supports motion editing through time-decayed soft masking, enabling users to refine generated dance sequences interactively.
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
| 39 |
|
| 40 |
---
|
| 41 |
|
|
@@ -107,60 +109,37 @@ accelerate launch train.py --batch_size 128 --epochs 4000 --feature_type baseli
|
|
| 107 |
```
|
| 108 |
---
|
| 109 |
|
| 110 |
-
|
| 111 |
|
| 112 |
-
##
|
| 113 |
|
| 114 |
-
|
| 115 |
|
| 116 |
```bash
|
| 117 |
-
python
|
| 118 |
-
--genre Hiphop \
|
| 119 |
-
--duration 32 \
|
| 120 |
-
--output-dir inference_outputs
|
| 121 |
```
|
| 122 |
|
| 123 |
-
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
| 128 |
-
python inference.py --list-genres
|
| 129 |
-
```
|
| 130 |
|
| 131 |
-
Generate a
|
| 132 |
|
| 133 |
```bash
|
| 134 |
-
python inference.py path/to/music.
|
| 135 |
-
--genre
|
| 136 |
-
--
|
| 137 |
-
--duration 60
|
| 138 |
-
```
|
| 139 |
-
|
| 140 |
-
The default duration is 32 seconds and the maximum supported duration is 60 seconds. A CUDA GPU is required. Each run saves:
|
| 141 |
-
|
| 142 |
-
```text
|
| 143 |
-
inference_outputs/
|
| 144 |
-
βββ music_Hiphop.wav
|
| 145 |
-
βββ music_Hiphop_features.npy
|
| 146 |
-
βββ 0/
|
| 147 |
-
βββ music_Hiphop.pkl
|
| 148 |
```
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
---
|
| 153 |
-
|
| 154 |
-
## π Evaluation
|
| 155 |
-
|
| 156 |
-
### π§ͺ Evaluate the Model
|
| 157 |
-
|
| 158 |
-
To evaluate the our modelβs performance:
|
| 159 |
|
| 160 |
```bash
|
| 161 |
-
python
|
| 162 |
```
|
| 163 |
|
|
|
|
| 164 |
|
| 165 |
---
|
| 166 |
|
|
|
|
| 21 |
<a href="#code">
|
| 22 |
<img src="https://img.shields.io/badge/Conference-ECCV%202026-orange" alt="Conference">
|
| 23 |
</a>
|
| 24 |
+
<a href="https://huggingface.co/xlt99/FlowerDance">
|
| 25 |
+
<img src="https://img.shields.io/badge/Hugging_Face-%F0%9F%A4%97_Model-FFD21E" alt="Hugging Face">
|
| 26 |
</a>
|
| 27 |
</p>
|
| 28 |
|
|
|
|
| 34 |
>
|
| 35 |
> FlowerDance combines MeanFlow with Physical Consistency Constraints for high-quality few-step sampling, and uses a lightweight non-autoregressive BiMamba backbone with Channel-Level Fusion for long-horizon music-to-dance synthesis. It also supports motion editing through time-decayed soft masking, enabling users to refine generated dance sequences interactively.
|
| 36 |
|
| 37 |
+
<p align="center">
|
| 38 |
+
<strong>π FlowerDance has been accepted to ECCV 2026! π</strong><br>
|
| 39 |
+
<em>β¨ Training and inference code are now available. β¨</em>
|
| 40 |
+
</p>
|
| 41 |
|
| 42 |
---
|
| 43 |
|
|
|
|
| 109 |
```
|
| 110 |
---
|
| 111 |
|
| 112 |
+
## π Evaluation
|
| 113 |
|
| 114 |
+
### π§ͺ Evaluate the Model
|
| 115 |
|
| 116 |
+
To evaluate the our modelβs performance:
|
| 117 |
|
| 118 |
```bash
|
| 119 |
+
python test.py --batch_size 128
|
|
|
|
|
|
|
|
|
|
| 120 |
```
|
| 121 |
|
| 122 |
+
---
|
| 123 |
|
| 124 |
+
<a id="inference"></a>
|
| 125 |
|
| 126 |
+
## π΅ Inference
|
|
|
|
|
|
|
| 127 |
|
| 128 |
+
Generate a genre-conditioned dance sequence of a custom length from your own music:
|
| 129 |
|
| 130 |
```bash
|
| 131 |
+
python inference.py path/to/music.wav \
|
| 132 |
+
--genre Hiphop \
|
| 133 |
+
--duration 32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
```
|
| 135 |
|
| 136 |
+
List all supported dance genres:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
```bash
|
| 139 |
+
python inference.py --list-genres
|
| 140 |
```
|
| 141 |
|
| 142 |
+
The checkpoint is downloaded automatically from [Hugging Face](https://huggingface.co/xlt99/FlowerDance) when `--checkpoint` is omitted. Generated motions are saved to `inference_outputs/`.
|
| 143 |
|
| 144 |
---
|
| 145 |
|
inference.py
CHANGED
|
@@ -18,7 +18,6 @@ SAMPLE_RATE = FPS * HOP_LENGTH
|
|
| 18 |
FEATURE_DIM = 35
|
| 19 |
MOTION_DIM = 151
|
| 20 |
DEFAULT_DURATION = 32.0
|
| 21 |
-
MAX_DURATION = 60.0
|
| 22 |
|
| 23 |
GENRES = (
|
| 24 |
"Dai",
|
|
@@ -426,8 +425,8 @@ def main():
|
|
| 426 |
music_path = args.music.expanduser().resolve()
|
| 427 |
if not music_path.is_file():
|
| 428 |
parser.error(f"Music file not found: {music_path}")
|
| 429 |
-
if
|
| 430 |
-
parser.error(
|
| 431 |
if args.steps < 2:
|
| 432 |
parser.error("--steps must be at least 2")
|
| 433 |
|
|
|
|
| 18 |
FEATURE_DIM = 35
|
| 19 |
MOTION_DIM = 151
|
| 20 |
DEFAULT_DURATION = 32.0
|
|
|
|
| 21 |
|
| 22 |
GENRES = (
|
| 23 |
"Dai",
|
|
|
|
| 425 |
music_path = args.music.expanduser().resolve()
|
| 426 |
if not music_path.is_file():
|
| 427 |
parser.error(f"Music file not found: {music_path}")
|
| 428 |
+
if args.duration <= 0:
|
| 429 |
+
parser.error("--duration must be positive")
|
| 430 |
if args.steps < 2:
|
| 431 |
parser.error("--steps must be at least 2")
|
| 432 |
|