Skip to content

Overhaul of the detection moldule and new command-line Interface with ketos-run

Bruno Padovese requested to merge ketos-run into development

This change introduces many modifications and new functionalities:

Mainly, it is an overhaul of the detection moldule and the addition of the command-line Interface ketos-run to run trained models.

  • New method load_audio_representation_from_file <ketos.audio.load_audio_representation_from_file>. This method loads the parsed audio representation directly from a model_file. It also supports custom audio representations.

  • The dictionary with the audio representations available in ketos has been moved from the parsing module to the audio module.

  • New method load_input_transform_function <ketos.neural_networks.load_input_transform_function>. This method loads a custom input transform function directly from the model_file.

  • Method load_model_file <ketos.neural_networks.load_model_file> has been modified to support custom useer defined neural network architectures

  • User defined code such as custom audio representations and architectures will now be saved in the trained model file inside a folder named "custom". Custom audio orepresentations will be saved in a file named custom_audio_representation.py. Custom architectures will be saved in a file named custom_architecture.

  • Deprecated argument load_audio_repr in <ketos.neural_networks.load> in favor of the new method load_audio_representation_from_file.

Overhaul of the detection module:

  • Method merge_overlapping_detections <ketos.neural_networks.dev_utils.detection.merge_overlapping_detections> merges overlapping or adjacent detections.

  • New Method merge_consecutive_detections <ketos.neural_networks.dev_utils.detection.merge_consecutive_detections> merges consecutive detections.

  • New Method add_detection_buffer <ketos.neural_networks.dev_utils.detection.add_detection_buffer> adds a time buffer around detections

  • New Method convert_sequence_to_snapshot <ketos.neural_networks.dev_utils.detection.convert_sequence_to_snapshot> Converts the raw output from a sequence model to a standard snapshot format.

  • New Method apply_detection_threshold <ketos.neural_networks.dev_utils.detection.apply_detection_threshold> Filters out detection scores below or at a specified threshold and returns a list of tuples, where each tuple consists of a label (the index of the score) and the score itself.

  • New Method filter_by_threshold <ketos.neural_networks.dev_utils.detection.filter_by_threshold> Converts the raw output from a snapshot model to a standard format.

  • New Method filter_by_label <ketos.neural_networks.dev_utils.detection.filter_by_label> Filter a detection dataframe by a label.

  • New Method compute_score_running_avg <ketos.neural_networks.dev_utils.detection.compute_score_running_avg> Compute the running avg of scores given a window frame.

  • New Method batch_load_hdf5_data <ketos.neural_networks.dev_utils.detection.batch_load_hdf5_data> Loads HDF5 data in batches from a specified file and yields it for processing.

  • New Method batch_load_audio_file_data <ketos.neural_networks.dev_utils.detection.batch_load_audio_file_data> Loads data batches of audio data from a given AudioFrameLoader.

I have updated the pytest for the detection module, and tutorials, but havent created one yet for ketos-run.

I know this is a big change for just one branch. I will do my best to make it more modular and incremental going forward.

Merge request reports