예제 #1
0
def create_pipeline(data_path, batch_size, audio_frame_length,
                    prediction_only):
    """Create a pipeline to pre and post process the data.
    Inputs:
        - String data_path: path to the tfrecord file
        - Int batch_size: size of a batch
        - Float audio_frame_length: Length to which the audio will be trimmed in second
    Outputs:
        - Processeur pipeline: the pipeline to perform pre and post processing
        - Int sr: The sampling rate of the audio record in data_path"""

    data_loader = DataLoader.LoadData(data_path,
                                      sr=16000,
                                      batch_size=batch_size,
                                      audio_frame_length=audio_frame_length)
    dataset = data_loader.create_dataset()
    pipeline = Processing.Processeur(data_loader.sr,
                                     dataset,
                                     data_loader.length,
                                     audio_frame_length,
                                     window_size=0.025,
                                     overlap=0.75,
                                     prediction_only=prediction_only)
    return pipeline, data_loader.sr