Skip to content

Conversation

@BryonLewis
Copy link
Collaborator

@BryonLewis BryonLewis commented Jan 16, 2026

resolves #304

  • Adding batbot as a dependency
    • For right now it is using github until they publish a pypi version of batbot
  • Test UV script for running and looking at metadata inside of ./scripts/batbot/
    • Also added a introductory script for contours in ./scripts/contours
  • Created the ./batai/core/utils/batbot_metadata.py file to manage batbot and the resulting data
    • This contains some types from batbot to make it easier to develop with
    • Also the main function is generate_spectrogram_assets meant to be a drop-in replacement for the older generate_spectrogram_assets but this one may contain additional information in the future (contours + curves and knee, heel, toe points)
  • Altered all annotations to be Floats instead of Integers for more accuracy (also batbot will return more accurate numbers than ints for the millisecond timing)
  • Client Side
    • Added in the TransparencyFilter (Noise Filter) to the interface
      • These spectrograms are bit noisier so I figured I would add this in to be able to filter the noise out.

@BryonLewis BryonLewis changed the title initial testing and integration BatBot initial testing and integration Jan 18, 2026
@BryonLewis BryonLewis requested a review from naglepuff January 30, 2026 14:00
@BryonLewis BryonLewis marked this pull request as ready for review January 30, 2026 14:01
Copy link
Collaborator

@naglepuff naglepuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks pretty good, excited to get this integration done. I had some feedback, but nothing too major.

Comment on lines +21 to +22
width = models.FloatField() # pixels
height = models.FloatField() # pixels
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these two fields specifically, which I believe are just a pixel count, would it make sense to just keep them as integers?

Comment on lines +15 to +16
width = models.FloatField() # pixels
height = models.FloatField() # pixels
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here. Would it be more accurate to use integers for height/width?

"sentry-sdk[celery,django,pure_eval]",
"gunicorn",
"geopandas>=1.1.1",
"batbot",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything that we can remove from our direct dependencies in favor of batbot? Maybe some (or all) of those listed under the # Spectrogram Generation comment?

Noise Filter {{ transparencyThreshold }}%
</v-card-title>
<v-card-text>
<p>Removes amplitudes below the percentage</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Removes amplitudes below the percentage</p>
<p>Removes low-intensity background noise in the spectrogram</p>

Feel free to disregard this suggestion, but the wording struck me as a little bit technical, which might be fine, but I'm not exactly sure how much meaning it will have for the target user.

Comment on lines +177 to 181
left: -geoViewer.value.bounds().right * 0.1,
top: 0,
right: originalDimensions.width,
bottom: originalDimensions.height,
right: geoViewer.value.bounds().right * 1.1,
bottom: geoViewer.value.bounds().bottom,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the significance of 0.1 and 1.1 here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's left/right padding around the spectrogram. We could change it to something more static instead.

Comment on lines +63 to +64
# TODO: Disabled until prediction is in batbot
if config and config.run_inference_on_upload and False:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue in batbot or BatAI tracking this? It would be nice to have a link to an issue in either of the GH repos here while we wait for this feature.

It might also be nice to add some sort of banner in the UI somewhere that tells users that prediction is disabled for now.

Comment on lines +92 to +93
# TODO: Disabled until prediction is in batbot
if config and config.run_inference_on_upload and False:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same idea here about a linked issue/visibility for users on the front-end web side.


with tempfile.TemporaryDirectory() as tmpdir:
results = generate_spectrogram_assets(recording.audio_file, tmpdir)
# Copy the audio file from FileField to a temporary file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed because of how batbot handles spectrogram generation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it no longer is using a fileHandle or something like that it. It needs a real file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this file has a lot of duplicated code in it. Can bats_ai be added as a dependency so we can import the pydantic models and spectrogram generation code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BatBot] Replace spectrogram integration with BatBot

2 participants