Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: handle predicted annotations with no segments, fix #393 #394

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

NickleDave
Copy link
Collaborator

See rationale for this fix on that issue:
https://github.com/NickleDave/vak/issues/393
and related bug report in
https://github.com/NickleDave/vak/issues/386

  • change lbl_tb2segments to return all Nones
    when lbl_tb passed in is all 'unlabeled' class
  • also add logic to lbl_tb2segment to handle case
    where post-processing removes all labeled segments;
    in that case again return all Nones
  • change vak.core.predict so it just continues
    when lbl_tb2segments returns all Nones
    • i.e. do not create an Annotation instance for the vocalization

See rationale for this fix on that issue:
https://github.com/NickleDave/vak/issues/393
and related bug report in
https://github.com/NickleDave/vak/issues/386

- change `lbl_tb2segments` to return all `None`s
  when `lbl_tb` passed in is all 'unlabeled' class
- also add logic to `lbl_tb2segment` to handle case
  where post-processing removes all labeled segments;
  in that case again return all `None`s
- change `vak.core.predict` so it just `continue`s
  when `lbl_tb2segments` returns all `None`s
  + i.e. do not create an `Annotation` instance for the vocalization
@NickleDave
Copy link
Collaborator Author

@avanikop after making these fixes I was able to run vak predict using your config + checkpoint + data without a crash

I will also add tests for this.
Would you be okay @avanikop with me adding your checkpoint and a couple of the data files (specifically the ones that end up being "not labeled") to this public dataset?
https://osf.io/vz48c/
I will not share all the files, just the one or two I need to replicate the cases where it predicts no segments

It would be great @avanikop @marichard123 if you could check this branch out and test that it works for you, and also behaves as you expect.

To do that, you'd need to

  • set up a development install with a local copy of this repo
  • check out the branch

For a dev install, you'll want to follow instructions here:
https://vak.readthedocs.io/en/latest/get_started/installation.html#installation-from-source-e-g-for-development
@avanikop I think the steps for setting up an environment should work as-is for you on Mac but I haven't tested.
@marichard123 you might run into issues with torch not playing well with poetry. If so, please let me know and we can figure out a workaround.
Once you get the code copied and cloned into an environment, you'll want to check out the branch.
You can do that with git wherever you clone the code:

(vak-env) ~/code/vak $ git checkout -t origin/add-logic-handle-predicted-no-annotations-#393

Let me know and I can help if you get stuck on any of that.
Any feedback you can give me will be much appreciated!

@NickleDave
Copy link
Collaborator Author

Unit tests passed for me locally so this doesn't seem to have broken anything else.
Will wait to see what the CI says.

@NickleDave
Copy link
Collaborator Author

I am going to go ahead and merge this and release a new dev version, so ppl can test by installing that

@NickleDave NickleDave merged commit 4939785 into main Nov 23, 2021
@NickleDave NickleDave deleted the add-logic-handle-predicted-no-annotations-#393 branch November 23, 2021 14:28
@NickleDave
Copy link
Collaborator Author

@all-contributors please add @Luke-Poeppel for doc

@Luke-Poeppel I'll be sure to credit you for other contributions when I merge them (like a contributing.md!) -- working on it!

@allcontributors
Copy link
Contributor

@NickleDave

I've put up a pull request to add @Luke-Poeppel! 🎉

@NickleDave
Copy link
Collaborator Author

whoops @Luke-Poeppel I meant to comment on your PR
🤔 It still seemed to work though, shows your commits when I click on the book emoji in the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant