Open sammlapp opened 1 year ago
Hi @sammlapp thank you for raising this issue and linking back to the thread in the forum.
I know my reply there was a bit lengthy 😅
Long story short:
I think you are right, that we should implement a class representing bounding boxes the way you suggest, as a pandas Dataframe.
If you would still like to take a stab at an implementing that, it would be more than welcome.
I will raise a separate issue about that shortly.
There's some other housekeeping we'll need to do (probably drop the BBox
class) that I will outline on that issue.
Unfortunately we can't represent sequences the same way, because by definition a sequence is a series of non-overlapping line segments. I think we also need to change the way we represent sequences--I've been giving this some thought as I do some related work to VocalPy itself. I'll make a separate issue discussing how to change the implementation of sequences, and I'll link related issues from VocalPy here and on that issue.
@all-contributors please add @sammlapp for ideas
@NickleDave
I've put up a pull request to add @sammlapp! :tada:
Is your feature request related to a problem? Please describe. I find it confusing that the base class for all annotations (
Annotation
) stores data in different ways for "sequence" and "bounding box" type annotations, since these fundamentally contain similar (overlapping) data types.Describe the solution you'd like
Annotation
class could be refactored to store annotations in a dataframe with columns for time0, time1, freq0, freq1. It would contain methods or properties that allow the user to get either a list of bbox or a sequence/ list of sequences. This would enable all of the current functionality while storing data in a consistent format regardless of the source of the annotation.Describe alternatives you've considered Alternatively to storing annotations as a dataframe,
Annotation
could store a list of BBox objects, and asequences
property could call a method_bbox_to_seq()
to convert the list of BBox to a sequence.Additional context This vocalpy thread contains discussion of this idea https://forum.vocalpy.org/t/use-of-both-sequence-and-bbox-in-annotation-class/63/6