-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: fix frame classification model to work with BioSoundSegBench (#774)
This PR consists mainly of fixes needed for FrameClassificationModel to work with the BioSoundSegBench dataset. * Hack a learning rate scheduler into FrameClassificationModel * Add boundary_labels parameter to transforms.frame_labels.transforms.PostProcess.__call__ * Add background_label to post_tfm_kwargs in src/vak/eval/frame_classification.py * In `validation_step` of FrameClassificationModel, use boundary labels when they are present to post-process multi-class frame labels' * Unpack `dataset_path` from dataset_config in code block for built-in datasets in eval/frame_classification.py, to make sure this variable exists when we build the DataFrame with eval results" * Make variable `frame_dur` inside code block for built-in datasets inside eval/frame_classification.py so this variable exists when we get the post-processing transform * Pass `background_label` into transforms.frame_labels.PostProcess inside eval/frame_classification.py, using `constants.DEFAULT_BACKGROUND_LABEL` * Fix how we call self.manual_backwward in FrameClassificationModel to handle the case when the loss function returns a dict * In FrameClassificationModel.validation_step, convert boundary_preds to numpy when we pass them in to self.post_tfm * In FrameClassificationModel.validation_step, when logging accuracy, call it 'val_multi_acc' to distinguish from boundary_acc and for consistency with val_multi_acc_tfm * Change how we get and log frame_dur in train/frame_classification.py so we have it as a separate variable; will use for post_tfm kwargs when we add those later * Change one-line summary of __call__ method for frame_labels.transforms.PostProcess * BUG: Ensure boundary_labels is 1d in post-process transform, fix #767 * Fix what metric we use for learning rate scheduler: use val_multi_acc for models with multiple accuracies * Remove trainer module from common, code is used only for frame classification model * Add get_trainer and get_callbacks to train/frame_classification.py, fix so that we monitor 'val_multi_acc' when a model has multiple targets, and just 'val_acc' otherwise * Add missing self.manual_backward in training_step of FrameClassificationModel * Fix how we determine whether there are multiple targets and what to monitor in train/frame_classification.py * Fix how we validate boundary_labels in transforms.frame_labels.functional.postprocess -- don't if boundary_labels is None * Fix vak/predict/frame_classification.py to handle edge case where no non-background segments are predicted for any sample in dataset * Revise comment * Catch edge case in transforms.frame_labels.functional.boundary_inds_from_frame_boundary_labels * Add minimal unit tests for vak.transforms.frame_labels.functional.boundary_inds_from_boundary_labels * Remove learning rate scheduler for now
- Loading branch information
1 parent
f4afc5c
commit 5ebe407
Showing
9 changed files
with
190 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.