Comments (8)
I agree it's cumbersome, but time/duration are baked into the definition of an observation:
Lines 597 to 599 in 255a5ee
I may be wrong but I believe that supporting observations both with and without time/duration would require a major overhaul that would impact a significant number of lines (apart from the core structure, think validation and every operation currently supported on annotations), if it's even feasible under the current design.
Since @bmcfee was the main architect behind the observation tuple, he should probably chime in here.
from jams.
I agree it's cumbersome, but time/duration are baked into the definition of an observation:
Yes, the schema is written such that all observations have a time and duration (non-negative float) to validate properly.
I think the correct thing to do here is as @justinsalamon says: make the implicit quantities explicit by documenting the length of the track in the observation fields. Of course, nobody forces you to use that information, but it needs to be there to validate in the schema.
from jams.
AFAIK every observation in JAMS must have a time and duration, it's baked into the basic observation structure. The convention is that tags (track-level annotations) have a duration that matches the track duration.
If you're working with data that lives exclusively in tag space (i.e. not mixing strong labels and tags) so you could, for example, use the tag_open
namespace and just assume the tag is track-level and ignore the time/duration values. Or does that not address your situation?
from jams.
That's what I thought too, but tag_open
still requires time and duration with the current API (or perhaps I'm doing something wrong?). Ideally, I'd like to do something like this:
jam = jams.JAMS()
ann = jams.Annotation(namespace='tag_open', time=0, duration=total_track_dur)
ann.append(confidence=conf, value=tag1)
ann.append(confidence=conf, value=tag2)
...
from jams.
Sorry, I meant ignore the actual values of time/duration, but you must still set them because it's baked into JAMS observations.
So you could either do:
ann.append(confidence=conf, value=tag1, time=0, duration=total_track_dur)
or
ann.append(confidence=conf, value=tag2, time=0, duration=0)
And just ignore the time/duration values in the rest of your code. I'd opt for the former just because it means if you ever do need the duration of the observation it's set correctly.
from jams.
p.s - another motivation for using total_track_dur
is that, if you ever end up trimming or slicing the audio/jams, if the trimmed section doesn't intersect with the start/end times of an observation, the observation will be removed from the annotation. So by setting time=0, duration=total_track_dur
you guarantee that any trimming/slicing operation will still maintain all the tags.
from jams.
It still feels a bit cumbersome to having to add these values at the observation level (and have them repeated along the whole raw JSON annotation), when you just want to use the global ones that are already available at the annotation level.
Maybe something to consider for the next release?
from jams.
Sounds good. Thanks for your help!
from jams.
Related Issues (20)
- jam.validate() is True, but jam.save(path) crashes. Bug? HOT 2
- Feature Request: jams.convert(a, 'namespace'): from 'note_midi' to 'pitch_contour' HOT 7
- Support Decimal format/Quantization HOT 4
- notebook rendering does not work in jupyterlab HOT 3
- sed_eval bindings? HOT 6
- sortedcontainers updates
- display(meta=False) by default? HOT 2
- support jsonschema >= 3.0 HOT 3
- load jams mapping error? HOT 5
- More than one curator? HOT 13
- on possible (minor) tweaks to Annotation.to_samples HOT 6
- jams.load does not seem to work with one of your example files HOT 3
- support pytest 4.0
- `jams.Annotation.trim()` doesn't include events with 0 duration that's on the trim boundary HOT 4
- __get_dtype fails when type is list
- tag_medleydb_instruments points to a 404 error HOT 3
- Next generation jams HOT 6
- display.events labels and lines are misaligned HOT 1
- Install fails on Python 3.12: `imp` Module Missing HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jams.