|
| 1 | +--- |
| 2 | +title: Video Frame Classification |
| 3 | +type: templates |
| 4 | +category: Videos |
| 5 | +cat: videos |
| 6 | +order: 804 |
| 7 | +is_new: t |
| 8 | +meta_title: Video Frame Classification |
| 9 | +meta_description: Template for classifying frames within a video. |
| 10 | +--- |
| 11 | + |
| 12 | +<img src="/images/templates/video-frame-classification.png" alt="" class="gif-border" width="552px" height="408px" /> |
| 13 | + |
| 14 | +Video frame classification is the process of assigning labels to individual frames within a video. This technique is useful when you need to analyze specific moments or events in a video, such as detecting actions, states, or changes over time, rather than classifying the entire video as a whole. |
| 15 | + |
| 16 | +<iframe width="560" height="315" src="https://www.youtube.com/embed/DsTsbg5NSWQ?si=uOfseQ1CNJ_-uIGv" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> |
| 17 | + |
| 18 | +## Labeling configuration |
| 19 | + |
| 20 | +```xml |
| 21 | +<View> |
| 22 | + <TimelineLabels name="videoLabels" toName="video"> |
| 23 | + <Label value="Movement" background="#c813ec"/> |
| 24 | + <Label value="Still" background="#1d81cd"/> |
| 25 | + <Label value="Slow Motion" background="#54d651"/> |
| 26 | + </TimelineLabels> |
| 27 | + <Video name="video" value="$video" frameRate="25.0" timelineHeight="120" /> |
| 28 | +</View> |
| 29 | +``` |
| 30 | + |
| 31 | +## About the labeling configuration |
| 32 | + |
| 33 | +#### <View> |
| 34 | + |
| 35 | +All labeling configurations must be wrapped in `<View>` tags. |
| 36 | + |
| 37 | +#### Video object tag |
| 38 | + |
| 39 | +Use the `<Video>` object tag to specify the video data. |
| 40 | + |
| 41 | +* The `frameRate` parameter sets the frame rate of the video. Ensure this matches the video's framerate. If your video has defects or variable framerate, it might cause discrepancies. Transcoding the video to a constant framerate before uploading can help. |
| 42 | +* Use `timelineHeight` to control the height of your timeline where you are selecting frames. |
| 43 | + |
| 44 | +For more parameters, see the [Video tag page](/tags/video). |
| 45 | + |
| 46 | +```xml |
| 47 | + <Video name="video" value="$video" frameRate="25.0" timelineHeight="120"/> |
| 48 | +``` |
| 49 | + |
| 50 | +#### TimelineLabels control tag |
| 51 | + |
| 52 | +Use the [TimelineLabels control tag](/tags/timelinelabels) to define labels that can be applied to specific frames of the video. |
| 53 | + |
| 54 | +Use `Label` tags within `TimelineLabels` to define the labels that you want to use. |
| 55 | + |
| 56 | +```xml |
| 57 | +<TimelineLabels name="videoLabels" toName="video"> |
| 58 | + <Label value="Movement" background="#c813ec"/> |
| 59 | + <Label value="Still" background="#1d81cd"/> |
| 60 | + <Label value="Slow Motion" background="#54d651"/> |
| 61 | +</TimelineLabels> |
| 62 | +``` |
| 63 | + |
| 64 | +## Input data format |
| 65 | + |
| 66 | +Prepare your input data with the video field pointing to your video URL. If you want to test out a video, you can use a JSON file with the following example: |
| 67 | + |
| 68 | +```json |
| 69 | +[ |
| 70 | + { |
| 71 | + "video": "/static/samples/opossum_snow.mp4" |
| 72 | + } |
| 73 | +] |
| 74 | +``` |
| 75 | + |
| 76 | + |
| 77 | +## Related Tags |
| 78 | +- [TimelineLabels](/tags/timelinelabels.html) |
| 79 | +- [Video](/tags/video.html) |
| 80 | +- [Label](/tags/label.html) |
| 81 | +- [Example of ML Backend for Frame Classification](https://github.com/HumanSignal/label-studio-ml-backend/blob/master/label_studio_ml/examples/yolo/README_TIMELINE_LABELS.md) |
0 commit comments