macaodha / batdetect2

Other
48 stars 9 forks source link

Fix/gh 15 spectrogram features computation #16

Closed mbsantiago closed 1 year ago

mbsantiago commented 1 year ago

This pull request aims to resolve the issue related to spectrogram feature computation. The main changes introduced are as follows:

  1. Fixing Spectrogram Shape Mismatch: The primary concern was a discrepancy between the expected and provided spectrogram shape in the feature extraction function. This issue has been successfully resolved by applying the "np.squeeze" operation, which eliminates unnecessary dimensions required for the model to operate.

  2. Modularization of Feature Extraction: To enhance the testability of the codebase, the feature extraction function has been refactored into distinct, individual feature extraction functions. This modular approach not only promotes better organization but also facilitates more effective unit testing.

  3. Unit and Integration Testing:

    • Unit tests have been implemented for several of the newly created feature extraction functions. This ensures that each component operates as intended in isolation.
    • Additionally, an integration test has been introduced to validate the correct functioning of the CLI command when executed with the "--spec_features" flag. This guarantees that the overall functionality remains intact even with the restructuring.

These changes collectively address the spectrogram feature computation issue and contribute to a more robust and maintainable codebase.