How to transform the timestamps output by the model to seconds? #1184
-
|
How to transform the timestamps output by the model to seconds? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
看了源码,请问是否÷1000就可以了? |
Beta Was this translation helpful? Give feedback.
-
|
Yes. For the standard FunASR For character/word timestamps: result = model.generate(input="audio.wav")
item = result[0]
timestamps_seconds = [
[start_ms / 1000.0, end_ms / 1000.0]
for start_ms, end_ms in item.get("timestamp", [])
]For VAD/speaker sentence segments: sentences_seconds = [
{
**segment,
"start": segment["start"] / 1000.0,
"end": segment["end"] / 1000.0,
}
for segment in item.get("sentence_info", [])
]For example, Current source references: |
Beta Was this translation helpful? Give feedback.
Yes. For the standard FunASR
AutoModel.generate()result, timestamps are in milliseconds, so divide both boundaries by1000.0.For character/word timestamps:
For VAD/speaker sentence segments:
For example,
[1230, 2480]becomes[1.23, 2.48]seconds. Keep the original millisecond values if you need integer subtitle or alignment …