src.detect package#

Submodules#

src.detect.detect_onsets module#

src.detect.detect_utils module#

src.detect.optimise_detection_parameters module#

Optimises the parameters used in onset detection by running a large-scale search using ground truth files

class src.detect.optimise_detection_parameters.OptimizeBeatTrackRNN(items: dict, **kwargs)#

Bases: Optimizer

Optimizes the OnsetMaker.beat_track_rnn function

analyze_track(item: dict, **kwargs) dict#

Detect beats in one track using a given combination of parameters.

args = [('threshold', <class 'float'>, 0, 1, 0.05), ('transition_lambda', <class 'float'>, 0, 500, 5), ('passes', <class 'int'>, 1, 5, 3)]#
audio_cutoff = 60#
csv_name: str = ''#
static enable_logger() Logger#
get_f_score(onsetmaker) float#

Returns F-score between detected onsets and manual annotation file

instr = 'mix'#
joblib_backend = 'threading'#
log_iteration(cached_ids: list, f_scores: list) None#

Log the results from a single iteration

lookup_results_from_cache(params: dict) tuple[list, list]#

Returns lists of IDs and F-scores for tracks that have already been processed with this set of parameters

n_jobs = 1#
objective_function(x: ndarray, _) float#

Objective function for maximising F-score of detected onsets

return_kwargs(x: ndarray) dict#

Formats arguments from NLopt into the required keyword argument format

run_optimization() tuple[dict, float]#

Runs optimization in NLopt

class src.detect.optimise_detection_parameters.OptimizeOnsetDetectCNN(items: dict, instr: str, **kwargs)#

Bases: Optimizer

Optimizes the OnsetMaker.onset_detect_cnn function for a single instrument

analyze_track(item: dict, **kwargs) dict#

Detect onsets in one track using a given combination of parameters.

args = [('threshold', <class 'float'>, 0, 10, 0.54), ('smooth', <class 'float'>, 0, 2, 0.05), ('pre_avg', <class 'float'>, 0, 2, 0), ('post_avg', <class 'float'>, 0, 2, 0), ('pre_max', <class 'float'>, 0, 2, 0.01), ('post_max', <class 'float'>, 0, 2, 0.01)]#
audio_cutoff = None#
csv_name: str = ''#
static enable_logger() Logger#
fps = 100#
get_f_score(onsetmaker) float#

Returns F-score between detected onsets and manual annotation file

joblib_backend = 'threading'#
log_iteration(cached_ids: list, f_scores: list) None#

Log the results from a single iteration

lookup_results_from_cache(params: dict) tuple[list, list]#

Returns lists of IDs and F-scores for tracks that have already been processed with this set of parameters

n_jobs = -1#
objective_function(x: ndarray, _) float#

Objective function for maximising F-score of detected onsets

return_kwargs(x: ndarray) dict#

Formats arguments from NLopt into the required keyword argument format

run_optimization() tuple[dict, float]#

Runs optimization in NLopt

class src.detect.optimise_detection_parameters.Optimizer(items: list[dict], instr: str, args: list[tuple], **kwargs)#

Bases: object

Base class for non-linear optimization of parameters

analyze_track(item: dict, **kwargs) dict#

Placeholder for analysis function, run in parallel; overridden in child classes

audio_cutoff = None#
csv_name = ''#
static enable_logger() Logger#
get_f_score(onsetmaker) float#

Returns F-score between detected onsets and manual annotation file

joblib_backend = 'threading'#
log_iteration(cached_ids: list, f_scores: list) None#

Log the results from a single iteration; overriden in child classes

lookup_results_from_cache(params: dict) tuple[list, list]#

Returns lists of IDs and F-scores for tracks that have already been processed with this set of parameters

n_jobs = -1#
objective_function(x: ndarray, _) float#

Objective function for maximising F-score of detected onsets

return_kwargs(x: ndarray) dict#

Formats arguments from NLopt into the required keyword argument format

run_optimization() tuple[dict, float]#

Runs optimization in NLopt

src.detect.optimise_detection_parameters.optimize_beat_tracking(tracks: list[dict], **kwargs) None#

Central function for optimizing onset detection across all reference tracks and instrument stems

Arguments:

tracks (list[dict]): the metadata for the tracks to be used in optimization **kwargs: passed onto optimization class

src.detect.optimise_detection_parameters.optimize_onset_detection_cnn(tracks: list[dict], **kwargs) None#

Central function for optimizing onset detection across all reference tracks and instrument stems

Arguments:

tracks (list[dict]): the metadata for the tracks to be used in optimization **kwargs: passed onto optimization class

Module contents#