Init
Browse files- README.md +189 -0
- classes.py +194 -0
- something_something_v2.py +150 -0
README.md
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- other-charades
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
paperswithcode_id: something-something
|
13 |
+
pretty_name: Something Something v2
|
14 |
+
size_categories:
|
15 |
+
- 100K<n<1M
|
16 |
+
source_datasets:
|
17 |
+
- original
|
18 |
+
task_categories:
|
19 |
+
- other
|
20 |
+
task_ids:
|
21 |
+
- other
|
22 |
+
---
|
23 |
+
|
24 |
+
# Dataset Card for Something Something v2
|
25 |
+
|
26 |
+
## Table of Contents
|
27 |
+
- [Table of Contents](#table-of-contents)
|
28 |
+
- [Dataset Description](#dataset-description)
|
29 |
+
- [Dataset Summary](#dataset-summary)
|
30 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
31 |
+
- [Languages](#languages)
|
32 |
+
- [Dataset Structure](#dataset-structure)
|
33 |
+
- [Data Instances](#data-instances)
|
34 |
+
- [Data Fields](#data-fields)
|
35 |
+
- [Data Splits](#data-splits)
|
36 |
+
- [Dataset Creation](#dataset-creation)
|
37 |
+
- [Curation Rationale](#curation-rationale)
|
38 |
+
- [Source Data](#source-data)
|
39 |
+
- [Annotations](#annotations)
|
40 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
41 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
42 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
43 |
+
- [Discussion of Biases](#discussion-of-biases)
|
44 |
+
- [Other Known Limitations](#other-known-limitations)
|
45 |
+
- [Additional Information](#additional-information)
|
46 |
+
- [Dataset Curators](#dataset-curators)
|
47 |
+
- [Licensing Information](#licensing-information)
|
48 |
+
- [Citation Information](#citation-information)
|
49 |
+
- [Contributions](#contributions)
|
50 |
+
|
51 |
+
## Dataset Description
|
52 |
+
|
53 |
+
- **Homepage:** https://prior.allenai.org/projects/charades
|
54 |
+
- **Repository:** https://github.com/gsig/charades-algorithms
|
55 |
+
- **Paper:** https://arxiv.org/abs/1604.01753
|
56 |
+
- **Leaderboard:** https://paperswithcode.com/sota/action-classification-on-charades
|
57 |
+
- **Point of Contact:** mailto: vision.amt@allenai.org
|
58 |
+
|
59 |
+
### Dataset Summary
|
60 |
+
|
61 |
+
The Something-Something dataset (version 2) is a collection of 220,847 labeled video clips of humans performing pre-defined, basic actions with everyday objects. It is designed to train machine learning models in fine-grained understanding of human hand gestures like putting something into something, turning something upside down and covering something with something.
|
62 |
+
|
63 |
+
### Supported Tasks and Leaderboards
|
64 |
+
|
65 |
+
- `action-classification`: The goal of this task is to classify actions happening in a video. This is a multilabel classification. The leaderboard is available [here](https://paperswithcode.com/sota/action-classification-on-charades)
|
66 |
+
|
67 |
+
|
68 |
+
### Languages
|
69 |
+
|
70 |
+
The annotations in the dataset are in English.
|
71 |
+
|
72 |
+
## Dataset Structure
|
73 |
+
|
74 |
+
### Data Instances
|
75 |
+
|
76 |
+
```
|
77 |
+
{
|
78 |
+
"video_id": "46GP8",
|
79 |
+
"video": "/home/amanpreet_huggingface_co/.cache/huggingface/datasets/downloads/extracted/3f022da5305aaa189f09476dbf7d5e02f6fe12766b927c076707360d00deb44d/46GP8.mp4",
|
80 |
+
"subject": "HR43",
|
81 |
+
"scene": "Kitchen",
|
82 |
+
"quality": 6,
|
83 |
+
"relevance": 7,
|
84 |
+
"verified": "Yes",
|
85 |
+
"script": "A person cooking on a stove while watching something out a window.",
|
86 |
+
"objects": ["food", "stove", "window"],
|
87 |
+
"descriptions": [
|
88 |
+
"A person cooks food on a stove before looking out of a window."
|
89 |
+
],
|
90 |
+
"labels": [92, 147],
|
91 |
+
"action_timings": [
|
92 |
+
[11.899999618530273, 21.200000762939453],
|
93 |
+
[0.0, 12.600000381469727]
|
94 |
+
],
|
95 |
+
"length": 24.829999923706055
|
96 |
+
}
|
97 |
+
```
|
98 |
+
|
99 |
+
### Data Fields
|
100 |
+
|
101 |
+
- `video_id`: `str` Unique identifier for each video.
|
102 |
+
- `video`: `str` Path to the video file
|
103 |
+
- `subject`: `str` Unique identifier for each subject in the dataset
|
104 |
+
- `scene`: `str` One of 15 indoor scenes in the dataset, such as Kitchen
|
105 |
+
- `quality`: `int` The quality of the video judged by an annotator (7-point scale, 7=high quality), -100 if missing
|
106 |
+
- `relevance`: `int` The relevance of the video to the script judged by an annotated (7-point scale, 7=very relevant), -100 if missing
|
107 |
+
- `verified`: `str` 'Yes' if an annotator successfully verified that the video matches the script, else 'No'
|
108 |
+
- `script`: `str` The human-generated script used to generate the video
|
109 |
+
- `descriptions`: `List[str]` List of descriptions by annotators watching the video
|
110 |
+
- `labels`: `List[int]` Multi-label actions found in the video. Indices from 0 to 156.
|
111 |
+
- `action_timings`: `List[Tuple[int, int]]` Timing where each of the above actions happened.
|
112 |
+
- `length`: `float` The length of the video in seconds
|
113 |
+
|
114 |
+
<details>
|
115 |
+
<summary>
|
116 |
+
Click here to see the full list of ImageNet class labels mapping:
|
117 |
+
</summary>
|
118 |
+
|
119 |
+
</details>
|
120 |
+
|
121 |
+
### Data Splits
|
122 |
+
|
123 |
+
|
124 |
+
| |train |validation| test |
|
125 |
+
|-------------|------:|---------:|------:|
|
126 |
+
|# of examples|1281167|50000 |100000 |
|
127 |
+
|
128 |
+
|
129 |
+
## Dataset Creation
|
130 |
+
|
131 |
+
### Curation Rationale
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
### Source Data
|
136 |
+
|
137 |
+
#### Initial Data Collection and Normalization
|
138 |
+
|
139 |
+
|
140 |
+
#### Who are the source language producers?
|
141 |
+
|
142 |
+
|
143 |
+
### Annotations
|
144 |
+
|
145 |
+
#### Annotation process
|
146 |
+
|
147 |
+
|
148 |
+
#### Who are the annotators?
|
149 |
+
|
150 |
+
|
151 |
+
### Personal and Sensitive Information
|
152 |
+
|
153 |
+
|
154 |
+
## Considerations for Using the Data
|
155 |
+
|
156 |
+
### Social Impact of Dataset
|
157 |
+
|
158 |
+
[More Information Needed]
|
159 |
+
|
160 |
+
### Discussion of Biases
|
161 |
+
|
162 |
+
[More Information Needed]
|
163 |
+
|
164 |
+
### Other Known Limitations
|
165 |
+
|
166 |
+
[More Information Needed]
|
167 |
+
|
168 |
+
## Additional Information
|
169 |
+
|
170 |
+
### Dataset Curators
|
171 |
+
|
172 |
+
|
173 |
+
### Licensing Information
|
174 |
+
|
175 |
+
### Citation Information
|
176 |
+
|
177 |
+
```bibtex
|
178 |
+
@inproceedings{goyal2017something,
|
179 |
+
title={The" something something" video database for learning and evaluating visual common sense},
|
180 |
+
author={Goyal, Raghav and Ebrahimi Kahou, Samira and Michalski, Vincent and Materzynska, Joanna and Westphal, Susanne and Kim, Heuna and Haenel, Valentin and Fruend, Ingo and Yianilos, Peter and Mueller-Freitag, Moritz and others},
|
181 |
+
booktitle={Proceedings of the IEEE international conference on computer vision},
|
182 |
+
pages={5842--5850},
|
183 |
+
year={2017}
|
184 |
+
}
|
185 |
+
```
|
186 |
+
|
187 |
+
### Contributions
|
188 |
+
|
189 |
+
Thanks to [@apsdehal](https://github.com/apsdehal) for adding this dataset.
|
classes.py
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 the HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
|
17 |
+
from collections import OrderedDict
|
18 |
+
|
19 |
+
SOMETHING_SOMETHING_V2_CLASSES = [
|
20 |
+
"Approaching something with your camera",
|
21 |
+
"Attaching something to something",
|
22 |
+
"Bending something so that it deforms",
|
23 |
+
"Bending something until it breaks",
|
24 |
+
"Burying something in something",
|
25 |
+
"Closing something",
|
26 |
+
"Covering something with something",
|
27 |
+
"Digging something out of something",
|
28 |
+
"Dropping something behind something",
|
29 |
+
"Dropping something in front of something",
|
30 |
+
"Dropping something into something",
|
31 |
+
"Dropping something next to something",
|
32 |
+
"Dropping something onto something",
|
33 |
+
"Failing to put something into something because something does not fit",
|
34 |
+
"Folding something",
|
35 |
+
"Hitting something with something",
|
36 |
+
"Holding something",
|
37 |
+
"Holding something behind something",
|
38 |
+
"Holding something in front of something",
|
39 |
+
"Holding something next to something",
|
40 |
+
"Holding something over something",
|
41 |
+
"Laying something on the table on its side, not upright",
|
42 |
+
"Letting something roll along a flat surface",
|
43 |
+
"Letting something roll down a slanted surface",
|
44 |
+
"Letting something roll up a slanted surface, so it rolls back down",
|
45 |
+
"Lifting a surface with something on it but not enough for it to slide down",
|
46 |
+
"Lifting a surface with something on it until it starts sliding down",
|
47 |
+
"Lifting something up completely without letting it drop down",
|
48 |
+
"Lifting something up completely, then letting it drop down",
|
49 |
+
"Lifting something with something on it",
|
50 |
+
"Lifting up one end of something without letting it drop down",
|
51 |
+
"Lifting up one end of something, then letting it drop down",
|
52 |
+
"Moving away from something with your camera",
|
53 |
+
"Moving part of something",
|
54 |
+
"Moving something across a surface until it falls down",
|
55 |
+
"Moving something across a surface without it falling down",
|
56 |
+
"Moving something and something away from each other",
|
57 |
+
"Moving something and something closer to each other",
|
58 |
+
"Moving something and something so they collide with each other",
|
59 |
+
"Moving something and something so they pass each other",
|
60 |
+
"Moving something away from something",
|
61 |
+
"Moving something away from the camera",
|
62 |
+
"Moving something closer to something",
|
63 |
+
"Moving something down",
|
64 |
+
"Moving something towards the camera",
|
65 |
+
"Moving something up",
|
66 |
+
"Opening something",
|
67 |
+
"Picking something up",
|
68 |
+
"Piling something up",
|
69 |
+
"Plugging something into something",
|
70 |
+
"Plugging something into something but pulling it right out as you remove your hand",
|
71 |
+
"Poking a hole into some substance",
|
72 |
+
"Poking a hole into something soft",
|
73 |
+
"Poking a stack of something so the stack collapses",
|
74 |
+
"Poking a stack of something without the stack collapsing",
|
75 |
+
"Poking something so it slightly moves",
|
76 |
+
"Poking something so lightly that it doesn't or almost doesn't move",
|
77 |
+
"Poking something so that it falls over",
|
78 |
+
"Poking something so that it spins around",
|
79 |
+
"Pouring something into something",
|
80 |
+
"Pouring something into something until it overflows",
|
81 |
+
"Pouring something onto something",
|
82 |
+
"Pouring something out of something",
|
83 |
+
"Pretending or failing to wipe something off of something",
|
84 |
+
"Pretending or trying and failing to twist something",
|
85 |
+
"Pretending to be tearing something that is not tearable",
|
86 |
+
"Pretending to close something without actually closing it",
|
87 |
+
"Pretending to open something without actually opening it",
|
88 |
+
"Pretending to pick something up",
|
89 |
+
"Pretending to poke something",
|
90 |
+
"Pretending to pour something out of something, but something is empty",
|
91 |
+
"Pretending to put something behind something",
|
92 |
+
"Pretending to put something into something",
|
93 |
+
"Pretending to put something next to something",
|
94 |
+
"Pretending to put something on a surface",
|
95 |
+
"Pretending to put something onto something",
|
96 |
+
"Pretending to put something underneath something",
|
97 |
+
"Pretending to scoop something up with something",
|
98 |
+
"Pretending to spread air onto something",
|
99 |
+
"Pretending to sprinkle air onto something",
|
100 |
+
"Pretending to squeeze something",
|
101 |
+
"Pretending to take something from somewhere",
|
102 |
+
"Pretending to take something out of something",
|
103 |
+
"Pretending to throw something",
|
104 |
+
"Pretending to turn something upside down",
|
105 |
+
"Pulling something from behind of something",
|
106 |
+
"Pulling something from left to right",
|
107 |
+
"Pulling something from right to left",
|
108 |
+
"Pulling something onto something",
|
109 |
+
"Pulling something out of something",
|
110 |
+
"Pulling two ends of something but nothing happens",
|
111 |
+
"Pulling two ends of something so that it gets stretched",
|
112 |
+
"Pulling two ends of something so that it separates into two pieces",
|
113 |
+
"Pushing something from left to right",
|
114 |
+
"Pushing something from right to left",
|
115 |
+
"Pushing something off of something",
|
116 |
+
"Pushing something onto something",
|
117 |
+
"Pushing something so it spins",
|
118 |
+
"Pushing something so that it almost falls off but doesn't",
|
119 |
+
"Pushing something so that it falls off the table",
|
120 |
+
"Pushing something so that it slightly moves",
|
121 |
+
"Pushing something with something",
|
122 |
+
"Putting number of something onto something",
|
123 |
+
"Putting something and something on the table",
|
124 |
+
"Putting something behind something",
|
125 |
+
"Putting something in front of something",
|
126 |
+
"Putting something into something",
|
127 |
+
"Putting something next to something",
|
128 |
+
"Putting something on a flat surface without letting it roll",
|
129 |
+
"Putting something on a surface",
|
130 |
+
"Putting something on the edge of something so it is not supported and falls down",
|
131 |
+
"Putting something onto a slanted surface but it doesn't glide down",
|
132 |
+
"Putting something onto something",
|
133 |
+
"Putting something onto something else that cannot support it so it falls down",
|
134 |
+
"Putting something similar to other things that are already on the table",
|
135 |
+
"Putting something that can't roll onto a slanted surface, so it slides down",
|
136 |
+
"Putting something that can't roll onto a slanted surface, so it stays where it is",
|
137 |
+
"Putting something that cannot actually stand upright upright on the table, so it falls on its side",
|
138 |
+
"Putting something underneath something",
|
139 |
+
"Putting something upright on the table",
|
140 |
+
"Putting something, something and something on the table",
|
141 |
+
"Removing something, revealing something behind",
|
142 |
+
"Rolling something on a flat surface",
|
143 |
+
"Scooping something up with something",
|
144 |
+
"Showing a photo of something to the camera",
|
145 |
+
"Showing something behind something",
|
146 |
+
"Showing something next to something",
|
147 |
+
"Showing something on top of something",
|
148 |
+
"Showing something to the camera",
|
149 |
+
"Showing that something is empty",
|
150 |
+
"Showing that something is inside something",
|
151 |
+
"Something being deflected from something",
|
152 |
+
"Something colliding with something and both are being deflected",
|
153 |
+
"Something colliding with something and both come to a halt",
|
154 |
+
"Something falling like a feather or paper",
|
155 |
+
"Something falling like a rock",
|
156 |
+
"Spilling something behind something",
|
157 |
+
"Spilling something next to something",
|
158 |
+
"Spilling something onto something",
|
159 |
+
"Spinning something so it continues spinning",
|
160 |
+
"Spinning something that quickly stops spinning",
|
161 |
+
"Spreading something onto something",
|
162 |
+
"Sprinkling something onto something",
|
163 |
+
"Squeezing something",
|
164 |
+
"Stacking number of something",
|
165 |
+
"Stuffing something into something",
|
166 |
+
"Taking one of many similar things on the table",
|
167 |
+
"Taking something from somewhere",
|
168 |
+
"Taking something out of something",
|
169 |
+
"Tearing something into two pieces",
|
170 |
+
"Tearing something just a little bit",
|
171 |
+
"Throwing something",
|
172 |
+
"Throwing something against something",
|
173 |
+
"Throwing something in the air and catching it",
|
174 |
+
"Throwing something in the air and letting it fall",
|
175 |
+
"Throwing something onto a surface",
|
176 |
+
"Tilting something with something on it slightly so it doesn't fall down",
|
177 |
+
"Tilting something with something on it until it falls off",
|
178 |
+
"Tipping something over",
|
179 |
+
"Tipping something with something in it over, so something in it falls out",
|
180 |
+
"Touching (without moving) part of something",
|
181 |
+
"Trying but failing to attach something to something because it doesn't stick",
|
182 |
+
"Trying to bend something unbendable so nothing happens",
|
183 |
+
"Trying to pour something into something, but missing so it spills next to it",
|
184 |
+
"Turning something upside down",
|
185 |
+
"Turning the camera downwards while filming something",
|
186 |
+
"Turning the camera left while filming something",
|
187 |
+
"Turning the camera right while filming something",
|
188 |
+
"Turning the camera upwards while filming something",
|
189 |
+
"Twisting (wringing) something wet until water comes out",
|
190 |
+
"Twisting something",
|
191 |
+
"Uncovering something",
|
192 |
+
"Unfolding something",
|
193 |
+
"Wiping something off of something",
|
194 |
+
]
|
something_something_v2.py
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""The Something-Something dataset (version 2) is a collection of 220,847 labeled video clips of humans performing pre-defined, basic actions with everyday objects."""
|
18 |
+
|
19 |
+
|
20 |
+
import csv
|
21 |
+
import json
|
22 |
+
import os
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
from .classes import SOMETHING_SOMETHING_V2_CLASSES
|
27 |
+
|
28 |
+
_CITATION = """
|
29 |
+
@inproceedings{goyal2017something,
|
30 |
+
title={The" something something" video database for learning and evaluating visual common sense},
|
31 |
+
author={Goyal, Raghav and Ebrahimi Kahou, Samira and Michalski, Vincent and Materzynska, Joanna and Westphal, Susanne and Kim, Heuna and Haenel, Valentin and Fruend, Ingo and Yianilos, Peter and Mueller-Freitag, Moritz and others},
|
32 |
+
booktitle={Proceedings of the IEEE international conference on computer vision},
|
33 |
+
pages={5842--5850},
|
34 |
+
year={2017}
|
35 |
+
}
|
36 |
+
"""
|
37 |
+
|
38 |
+
_DESCRIPTION = """\
|
39 |
+
The Something-Something dataset (version 2) is a collection of 220,847 labeled video clips of humans performing pre-defined, basic actions with everyday objects. It is designed to train machine learning models in fine-grained understanding of human hand gestures like putting something into something, turning something upside down and covering something with something.
|
40 |
+
"""
|
41 |
+
|
42 |
+
|
43 |
+
class SomethingSomethingV2(datasets.GeneratorBasedBuilder):
|
44 |
+
"""Charades is dataset composed of 9848 videos of daily indoors activities collected through Amazon Mechanical Turk"""
|
45 |
+
|
46 |
+
BUILDER_CONFIGS = [datasets.BuilderConfig(name="default")]
|
47 |
+
DEFAULT_CONFIG_NAME = "default"
|
48 |
+
|
49 |
+
def _info(self):
|
50 |
+
return datasets.DatasetInfo(
|
51 |
+
description=_DESCRIPTION,
|
52 |
+
features=datasets.Features(
|
53 |
+
{
|
54 |
+
"video_id": datasets.Value("string"),
|
55 |
+
"video": datasets.Value("string"),
|
56 |
+
"text": datasets.Value("string"),
|
57 |
+
"labels": datasets.features.ClassLabel(
|
58 |
+
num_classes=len(SOMETHING_SOMETHING_V2_CLASSES), names=SOMETHING_SOMETHING_V2_CLASSES
|
59 |
+
),
|
60 |
+
"objects": datasets.Sequence(datasets.Value("string")),
|
61 |
+
}
|
62 |
+
),
|
63 |
+
supervised_keys=None,
|
64 |
+
homepage="",
|
65 |
+
citation=_CITATION,
|
66 |
+
)
|
67 |
+
|
68 |
+
@property
|
69 |
+
def manual_download_instructions(self):
|
70 |
+
return (
|
71 |
+
"To use Something-Something-v2, please download the 19 data files and the labels file "
|
72 |
+
"from 'https://developer.qualcomm.com/software/ai-datasets/something-something'. "
|
73 |
+
"Unzip the 19 files and concatenate the extracts in order into a tar file named '20bn-something-something-v2.tar.gz. "
|
74 |
+
"Use command like `cat 20bn-something-something-v2-?? >> 20bn-something-something-v2.tar.gz` "
|
75 |
+
"Place the labels zip file and the tar file into a folder '/path/to/data/' and load the dataset using "
|
76 |
+
"`load_dataset('something-something-v2', data_dir='/path/to/data')`"
|
77 |
+
)
|
78 |
+
|
79 |
+
def _split_generators(self, dl_manager, data_dir):
|
80 |
+
labels_path = os.path.join(data_dir, "labels.zip")
|
81 |
+
videos_path = os.path.join(data_dir, "20bn-something-something-v2.tar.gz")
|
82 |
+
if not os.path.exists(labels_path):
|
83 |
+
raise FileNotFoundError(f"labels.zip doesn't exist in {data_dir}. Please follow manual download instructions.")
|
84 |
+
|
85 |
+
if not os.path.exists(videos_path):
|
86 |
+
raise FileNotFoundError(f"20bn-something-sokmething-v2.tar.gz doesn't exist in {data_dir}. Please follow manual download instructions.")
|
87 |
+
|
88 |
+
labels_path = dl_manager.extract(labels_path)
|
89 |
+
return [
|
90 |
+
datasets.SplitGenerator(
|
91 |
+
name=datasets.Split.TRAIN,
|
92 |
+
gen_kwargs={
|
93 |
+
"annotation_file": os.path.join(labels_path, "train.json"),
|
94 |
+
"videos_files": dl_manager.iter_archive(videos_path),
|
95 |
+
},
|
96 |
+
),
|
97 |
+
datasets.SplitGenerator(
|
98 |
+
name=datasets.Split.VALIDATION,
|
99 |
+
gen_kwargs={
|
100 |
+
"annotation_file": os.path.join(labels_path, "validation.json"),
|
101 |
+
"videos_files": dl_manager.iter_archive(videos_path),
|
102 |
+
},
|
103 |
+
),
|
104 |
+
datasets.SplitGenerator(
|
105 |
+
name=datasets.Split.TRAIN,
|
106 |
+
gen_kwargs={
|
107 |
+
"annotation_file": os.path.join(labels_path, "test.json"),
|
108 |
+
"videos_files": dl_manager.iter_archive(videos_path),
|
109 |
+
"labels_file": os.path.join(labels_path, "test_labels.csv"),
|
110 |
+
},
|
111 |
+
),
|
112 |
+
]
|
113 |
+
|
114 |
+
def _generate_examples(self, annotation_file, video_files, labels_file=None):
|
115 |
+
data = {}
|
116 |
+
labels = None
|
117 |
+
if labels_file is not None:
|
118 |
+
with open(labels_file, "r", encoding="utf-8") as fobj:
|
119 |
+
labels = {}
|
120 |
+
for label in fobj.readlines():
|
121 |
+
label = label.strip().split(";")
|
122 |
+
labels[label[0]] = label[1]
|
123 |
+
|
124 |
+
with open(annotation_file, "r", encoding="utf-8") as fobj:
|
125 |
+
annotations = json.load(fobj)
|
126 |
+
for annotation in annotations:
|
127 |
+
if "template" in annotation:
|
128 |
+
annotation["template"] = annotation["template"].replace("[something]", "something")
|
129 |
+
if labels:
|
130 |
+
annotation["template"] = labels[annotation["id"]]
|
131 |
+
data[annotation["id"]] = annotation
|
132 |
+
|
133 |
+
idx = 0
|
134 |
+
for path, file in video_files:
|
135 |
+
video_id = os.path.splitext(os.path.split(path)[1])[0]
|
136 |
+
|
137 |
+
if video_id not in data:
|
138 |
+
continue
|
139 |
+
|
140 |
+
info = data[video_id]
|
141 |
+
|
142 |
+
yield idx, {
|
143 |
+
"video_id": video_id,
|
144 |
+
"video": file,
|
145 |
+
"objects": info["objects"],
|
146 |
+
"label": data["template"],
|
147 |
+
"text": data["text"] if "text" in data else -1
|
148 |
+
}
|
149 |
+
|
150 |
+
idx += 1
|