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

Added support to export annotations #140

Merged
merged 7 commits into from
Mar 2, 2018
Merged

Conversation

cheind
Copy link
Contributor

@cheind cheind commented Mar 2, 2018

The backend command supports sparse / dense annotations (as requested in #132) as and writes results in standard BeaverDam JSON format. Dense annotations are created between first and last keyframe using interpolation. Since BeaverDam uses html5 currentTime as timestamping mechanism, the command will need to know the fps of the video files. If not specified via command line, video files will automatically be probed using ffmpeg. This command should support local, remote video files and image lists.

Type python manage.py export_annotations --help for usage help.

A simple annotation viewer using OpenCV can be found here
https://gist.github.com/cheind/9850e35bb08cfe12500942fb8b55531f

Dense annotations will be stored in a new JSON field ('frames' per default) that follows this structure

{
    "frameid": 854,                     # Frame number with respect to start of video
    "frame": 68.32000000000001,         # Time measured in seconds from start computed as frameid * 1/FPS
    "state": "Red",                     # State copied from previous keyframe, or matching keyframe if refid is set
    "x": 1647.905947318195,             # interpolated x coordinate of bounds
    "y": 1142.1628561977332,            # interpolated y coordinate of bounds
    "w": 440.75167657459997,            # interpolated width of bounds
    "h": 451.9810186529337,             # interpolated height of bounds
    "continueInterpolation": true,      # -
    "refid": 17                         # Matched keyframe ID if any
}

Note that BeaverDam uses HTML5 currentTime to store keyframe times. These times vary between browsers and some browsers might even reduce the resolution of this field on purpose. See

https://stackoverflow.com/questions/32318333/html-5-currenttime-accuracy
https://bugs.chromium.org/p/chromium/issues/detail?id=555376

Therefore, the video probed FPS and hence computed frame times might not exactly match up the timestamps stored during browser annotation (except for image-lists where FPS is set to exactly 1).

@antingshen antingshen merged commit 3a7dc7d into antingshen:master Mar 2, 2018
@antingshen
Copy link
Owner

Thanks!

@cheind
Copy link
Contributor Author

cheind commented Mar 3, 2018

You're welcome. What I also wanted to mention is that I'm not really doing anyhting with the field continueInterpolation. What relevance does it have?

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.

2 participants