nicetoolbox.detectors.method_detectors.whisperx.whisperx_detector.WhisperX¶
- class nicetoolbox.detectors.method_detectors.whisperx.whisperx_detector.WhisperX(io: SequenceIO, data: SequenceData, sequence_context: SequenceRuntimeConfig, algorithm_instance: str)[source]¶
Bases:
BaseMethodInitialize base method detector with references.
Methods
Compute extra output folders for all components.
Compute result folders for all components.
Compute visualization folders for all components.
Process individual speaker aligned transcription json outputs into our final json format.
Execute method detector: run subprocess inference + post_inference.
Generates visualizations overlaying SRTs subtitles onto video files.
Attributes
algorithm_typecomponentsinference_package_nameAccess predictions mapping from runtime config.
runtimeos_typeconda_pathvenvenv_namescript_pathvisualizerequires_out_folderout_foldersresult_foldersviz_foldersconfig_pathsdataiosequence_contextdetector_configalgorithm_instanceinference_config- compute_output_folders(requires_out_folder: bool) Dict[str, str]¶
Compute extra output folders for all components.
- compute_result_folders() Dict[str, str]¶
Compute result folders for all components.
- compute_viz_folders(visualize: bool) Dict[str, str]¶
Compute visualization folders for all components.
- post_inference() None[source]¶
Process individual speaker aligned transcription json outputs into our final json format.
Structure: {
- “track_name”: {
- “total”: {
“text”: “full concatenated transcription text for the track”, “start”: start_time_of_first_segment, “end”: end_time_of_last_segment,
}, “segments”: [
- {
“start”: segment_start_time, “end”: segment_end_time, “text”: “segment_transcription_text”, “avg_logprob”: segment_avg_log_probability,
], “word_segments”: [
- {
“word”: word_text, “start”: word_start_time, “end”: word_end_time, “score”: word log probability score, “speaker”: speaker_label provided by pyannote
], “language”: detected_language
}
- property predictions_mapping¶
Access predictions mapping from runtime config.
- run() None¶
Execute method detector: run subprocess inference + post_inference.
Returns None - visualization uses external data.
- visualization(_) None[source]¶
Generates visualizations overlaying SRTs subtitles onto video files.
Uses the generated SRT files from the extra outputs of the audio transcription component. These SRT files are raw outputs from WhisperX of the final speaker-aligned transcription segments with speaker labels.
We create a new video from scratch based on the video frames (if available) or a black background (if no video frames are available) and overlay the SRT subtitles onto it.