xlt99 commited on
Commit
58fafe6
Β·
verified Β·
1 Parent(s): 77ea2c6

Support custom inference lengths

Browse files
Files changed (2) hide show
  1. README.md +20 -41
  2. 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="#inference">
25
- <img src="https://img.shields.io/badge/Inference-Custom_Music-8a2be2" alt="Inference">
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
- πŸŽ‰ **FlowerDance has been accepted to ECCV 2026!**
38
- ✨ Training and inference code released! ✨
 
 
39
 
40
  ---
41
 
@@ -107,60 +109,37 @@ accelerate launch train.py --batch_size 128 --epochs 4000 --feature_type baseli
107
  ```
108
  ---
109
 
110
- <a id="inference"></a>
111
 
112
- ## 🎡 Inference
113
 
114
- Generate a 3D dance sequence directly from your own music:
115
 
116
  ```bash
117
- python inference.py path/to/music.wav \
118
- --genre Hiphop \
119
- --duration 32 \
120
- --output-dir inference_outputs
121
  ```
122
 
123
- The input can be a WAV, MP3, FLAC, or OGG file. The script extracts the same 35-dimensional baseline music features used during training, supports genre-conditioned generation, and automatically downloads `train-3700.pt` from [Hugging Face](https://huggingface.co/xlt99/FlowerDance) when `--checkpoint` is omitted.
124
 
125
- List all 16 supported dance genres:
126
 
127
- ```bash
128
- python inference.py --list-genres
129
- ```
130
 
131
- Generate a 60-second sequence from a selected part of a longer track:
132
 
133
  ```bash
134
- python inference.py path/to/music.mp3 \
135
- --genre Popping \
136
- --start 10 \
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
- The PKL file contains `smpl_poses`, `smpl_trans`, and `full_pose` for downstream visualization or rendering.
151
-
152
- ---
153
-
154
- ## πŸ“ Evaluation
155
-
156
- ### πŸ§ͺ Evaluate the Model
157
-
158
- To evaluate the our model’s performance:
159
 
160
  ```bash
161
- python test.py --batch_size 128
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 not 0 < args.duration <= MAX_DURATION:
430
- parser.error(f"--duration must be in (0, {MAX_DURATION:g}] seconds")
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