Skip to content

Commit

Permalink
[ext] Add video template (dev-1238) (#1799)
Browse files Browse the repository at this point in the history
* [ext] Add video template (dev-1238)

* Update value

* docs: Add video object detector template to docs

* Update config.yml

* Update video_object_detector.md

* Fix

Co-authored-by: smoreface <smoreface@users.noreply.github.com>
  • Loading branch information
makseq and smoreface authored Mar 3, 2022
1 parent b835bdb commit 33337e9
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 2 deletions.
58 changes: 58 additions & 0 deletions docs/source/templates/video_object_detector.tmp-md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Video Object Detection
type: templates
category: Videos
cat: videos
order: 803
is_new: t
meta_title: Video Object Detection Data Labeling Template
meta_description: Template for detecting objects in videos with Label Studio for your machine learning and data science projects.
---

## Labeling Configuration

```html
<View>
<Header>Label the video:</Header>
<Video name="video" value="$video" framerate="25.0"/>
<VideoRectangle name="box" toName="video" />
<Labels name="videoLabels" toName="video" allowEmpty="true">
<Label value="Man" background="blue"/>
<Label value="Woman" background="red"/>
<Label value="Other" background="green"/>
</Labels>
</View>
```

## About the labeling configuration

All labeling configurations must be wrapped in [View](/tags/view.html) tags.

You can add a [header](/tags/header.html) to provide instructions to the annotator:
```xml
<Header>Label the video:</Header>
```

Use the [Video](/tags/video.html) object tag to specify the video data. The `framerate` parameter sets the frame rate of all videos in the project.
```xml
<Video name="video" value="$video" framerate="25.0"/>
```

Use the [VideoRectangle](/tags/videorectangle.html) control tag to allow annotators to add rectangles to video frames:
```xml
<VideoRectangle name="box" toName="video" />
```

Use the [Labels](/tags/labels.html) control tag to specify labels that can be added to the rectangle regions added to the video frames:
```xml
<Labels name="videoLabels" toName="video" allowEmpty="true">
<Label value="Man" background="blue"/>
<Label value="Woman" background="red"/>
<Label value="Other" background="green"/>
</Labels>
```

## Related tags
- [Video](/tags/video.html)
- [VideoRectangle](/tags/videorectangle.html)
- [Labels](/tags/labels.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
title: Video Object Tracking
group: Videos
image: /static/templates/object-detection-with-bounding-boxes.png
details: <h1>Object tracking in video with bounding boxes</h1>
config: |
<View>
<Header>Label the video:</Header>
<!-- Please specify FPS carefully, it will be used for all project videos -->
<Video name="video" value="$video" framerate="25.0"/>
<VideoRectangle name="box" toName="video" />
<Labels name="videoLabels" toName="video" allowEmpty="true">
<Label value="Man" background="blue"/>
<Label value="Woman" background="red"/>
<Label value="Other" background="green"/>
</Labels>
</View>
<!--{
"video": "/static/samples/opossum_snow.mp4"
}-->
2 changes: 1 addition & 1 deletion label_studio/core/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
DATA_UNDEFINED_NAME = '$undefined$'
LICENSE = {}
VERSIONS = {}
VERSION_EDITION = 'Community Edition'
VERSION_EDITION = 'Community'
LATEST_VERSION_CHECK = True
VERSIONS_CHECK_TIME = 0
ALLOW_ORGANIZATION_WEBHOOKS = get_bool_env('ALLOW_ORGANIZATION_WEBHOOKS', False)
Expand Down
3 changes: 3 additions & 0 deletions label_studio/projects/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ def list(self, request, *args, **kwargs):
configs = []
for config_file in pathlib.Path(annotation_templates_dir).glob('**/*.yml'):
config = read_yaml(config_file)
if settings.VERSION_EDITION == 'Community':
if settings.VERSION_EDITION.lower() != config.get('type', 'community'):
continue
if config.get('image', '').startswith('/static') and settings.HOSTNAME:
# if hostname set manually, create full image urls
config['image'] = settings.HOSTNAME + config['image']
Expand Down
2 changes: 1 addition & 1 deletion label_studio/users/templates/users/user_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{% block content %}
<div class="login_page">
<h1>Welcome to Label Studio {{ settings.VERSION_EDITION }} {{versions.package.short_version}}</h1>
<h1>Welcome to Label Studio Community Edition {{versions.package.short_version}}</h1>
<h2>A full-fledged open source solution for data labeling</h2>

<img src="{{ settings.HOSTNAME }}{% static 'images/opossum_hanging.svg' %}" height="128px" />
Expand Down

0 comments on commit 33337e9

Please sign in to comment.