Simplify README to a brief dataset and file overview
Browse filesKeep dataset counts, a short description of each file, and the timing units.
README.md
CHANGED
|
@@ -1,147 +1,12 @@
|
|
| 1 |
# Moment-Video
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
## Files
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
| [`data/annotation_all.json`](https://huggingface.co/datasets/VisionXLab/Moment-Video/blob/main/data/annotation_all.json) | The same 1,000 sample-level records as a JSON list of objects. | Use for loading the full question-answer annotations in code. |
|
| 12 |
-
| [`data/event_annotations_300_samples.csv`](https://huggingface.co/datasets/VisionXLab/Moment-Video/blob/main/data/event_annotations_300_samples.csv) | 609 event-level rows for 300 distinct samples, with 30 columns. | Use to locate annotated events in time and analyze their duration or position within a video. |
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
## Full sample-level annotations
|
| 17 |
-
|
| 18 |
-
Both `annotation_all.csv` and `annotation_all.json` use the following fields:
|
| 19 |
-
|
| 20 |
-
| Field | Meaning |
|
| 21 |
-
| --- | --- |
|
| 22 |
-
| `Category` | Video category, matching the category directory under `data/videos/`. |
|
| 23 |
-
| `Subclass` | Subclass within the category, matching the next directory level. |
|
| 24 |
-
| `Index` | Video identifier within the category and subclass. |
|
| 25 |
-
| `QuestionType` | Question-type code as recorded in the annotations. |
|
| 26 |
-
| `AnswerType` | Answer-type label as recorded in the annotations. |
|
| 27 |
-
| `Question` | Question about the video. |
|
| 28 |
-
| `Answer` | Corresponding answer. |
|
| 29 |
-
|
| 30 |
-
Identify a sample using the combination of `Category`, `Subclass`, and `Index`. The video is stored under `data/videos/<Category>/<Subclass>/<Index>.mp4`. Preserve the actual filename case when opening or downloading files; one video uses the extension `.MP4`.
|
| 31 |
-
|
| 32 |
-
## Event-level temporal annotations
|
| 33 |
-
|
| 34 |
-
`event_annotations_300_samples.csv` contains 300 distinct `sample_id` values and 609 event rows. Group rows by `sample_id` to collect all events for a sample. Use `(sample_id, event_id)` to identify an individual event.
|
| 35 |
-
|
| 36 |
-
The main fields are:
|
| 37 |
-
|
| 38 |
-
| Field | Meaning |
|
| 39 |
-
| --- | --- |
|
| 40 |
-
| `sample_id` | Sample identifier in the form `Category/Subclass/Index`, using the same names and video number as the full annotations and video directories. |
|
| 41 |
-
| `event_id` | Event identifier within a sample. |
|
| 42 |
-
| `start_sec` | Event start time in seconds from the beginning of the video. |
|
| 43 |
-
| `end_sec` | Event end time in seconds from the beginning of the video. |
|
| 44 |
-
| `event_duration_sec` | Event duration in seconds: `end_sec - start_sec`. |
|
| 45 |
-
| `video_duration_sec` | Total video duration in seconds. |
|
| 46 |
-
| `question`, `answer` | Question and answer associated with the sample, repeated across its event rows. |
|
| 47 |
-
| `event_count_in_sample` | Total number of annotated events for the sample. |
|
| 48 |
-
| `event_role` | Event role: `single evidence`, `repeated occurrence`, `prerequisite event`, or `outcome event`. |
|
| 49 |
-
|
| 50 |
-
Additional fields provide annotation metadata and derived timing values:
|
| 51 |
-
|
| 52 |
-
| Fields | Meaning |
|
| 53 |
-
| --- | --- |
|
| 54 |
-
| `sample_order` | Sample order in the event annotation table. |
|
| 55 |
-
| `category`, `subclass` | Category and subclass names, matching `Category` and `Subclass` in the full annotations. |
|
| 56 |
-
| `question_type`, `answer_type` | Question-type and answer-type metadata. |
|
| 57 |
-
| `duration_bucket` | Video-duration group. |
|
| 58 |
-
| `annotator_id`, `annotation_status`, `annotation_revision` | Annotator identifier, annotation status, and revision metadata. |
|
| 59 |
-
| `is_required`, `confidence` | Recorded event requirement flag and confidence label. |
|
| 60 |
-
| `start_sec_raw`, `end_sec_raw` | Raw event boundary values retained alongside `start_sec` and `end_sec`. |
|
| 61 |
-
| `event_center_sec` | Event midpoint in seconds: `(start_sec + end_sec) / 2`. |
|
| 62 |
-
| `relative_event_start`, `relative_event_center`, `relative_event_end` | Start, midpoint, and end times divided by `video_duration_sec`, expressed as fractions of the video duration. |
|
| 63 |
-
| `description`, `event_notes`, `general_notes` | Optional text fields; these are empty in the current release. |
|
| 64 |
-
|
| 65 |
-
Use `start_sec` and `end_sec` to seek to or extract an annotated interval. Absolute times and durations are in seconds; relative positions are fractions, not percentages.
|
| 66 |
-
|
| 67 |
-
### Matching event samples to videos
|
| 68 |
-
|
| 69 |
-
Category and subclass names are consistent across the event table, the full annotations, and the video directories. The categories are `AIGC`, `GUI`, `animal`, `games`, `human`, `industrial`, and `nature`.
|
| 70 |
-
|
| 71 |
-
Split `sample_id` into its three parts and join them to `Category`, `Subclass`, and `Index` in the full annotations. For example, `AIGC/artifacts/4` corresponds to `data/videos/AIGC/artifacts/4.mp4`, and `games/combat/11` corresponds to `data/videos/games/combat/11.mp4`.
|
| 72 |
-
|
| 73 |
-
All 300 event samples resolve to an existing video and a record in the full annotations. Use these identifiers to join the files; question and answer text can be shared by different samples. The Python example below looks up the actual video filename to preserve its extension's case.
|
| 74 |
-
|
| 75 |
-
## Python example
|
| 76 |
-
|
| 77 |
-
Install the download helper:
|
| 78 |
-
|
| 79 |
-
```bash
|
| 80 |
-
pip install huggingface_hub
|
| 81 |
-
```
|
| 82 |
-
|
| 83 |
-
This example downloads the two annotation files, groups events by sample, and finds the video and full annotation for the first event sample. Listing video filenames does not download the videos.
|
| 84 |
-
|
| 85 |
-
```python
|
| 86 |
-
import csv
|
| 87 |
-
import json
|
| 88 |
-
from collections import defaultdict
|
| 89 |
-
from pathlib import Path, PurePosixPath
|
| 90 |
-
|
| 91 |
-
from huggingface_hub import hf_hub_download, list_repo_files
|
| 92 |
-
|
| 93 |
-
repo_id = "VisionXLab/Moment-Video"
|
| 94 |
-
|
| 95 |
-
full_path = hf_hub_download(
|
| 96 |
-
repo_id=repo_id,
|
| 97 |
-
repo_type="dataset",
|
| 98 |
-
filename="data/annotation_all.json",
|
| 99 |
-
)
|
| 100 |
-
samples = json.loads(Path(full_path).read_text(encoding="utf-8"))
|
| 101 |
-
sample_lookup = {
|
| 102 |
-
(row["Category"], row["Subclass"], str(row["Index"])): row
|
| 103 |
-
for row in samples
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
event_path = hf_hub_download(
|
| 107 |
-
repo_id=repo_id,
|
| 108 |
-
repo_type="dataset",
|
| 109 |
-
filename="data/event_annotations_300_samples.csv",
|
| 110 |
-
)
|
| 111 |
-
with open(event_path, encoding="utf-8-sig", newline="") as file:
|
| 112 |
-
events = list(csv.DictReader(file))
|
| 113 |
-
|
| 114 |
-
events_by_sample = defaultdict(list)
|
| 115 |
-
for event in events:
|
| 116 |
-
events_by_sample[event["sample_id"]].append(event)
|
| 117 |
-
|
| 118 |
-
# Keep the exact filename, including the extension's case.
|
| 119 |
-
video_files = {
|
| 120 |
-
str(PurePosixPath(filename).with_suffix("")): filename
|
| 121 |
-
for filename in list_repo_files(repo_id, repo_type="dataset")
|
| 122 |
-
if filename.startswith("data/videos/")
|
| 123 |
-
and PurePosixPath(filename).suffix.lower() == ".mp4"
|
| 124 |
-
}
|
| 125 |
-
|
| 126 |
-
sample_id = events[0]["sample_id"]
|
| 127 |
-
key = tuple(sample_id.split("/"))
|
| 128 |
-
annotation = sample_lookup[key]
|
| 129 |
-
video_filename = video_files["data/videos/" + "/".join(key)]
|
| 130 |
-
|
| 131 |
-
print(len(samples)) # 1000 sample-level records
|
| 132 |
-
print(len(events_by_sample)) # 300 samples with event annotations
|
| 133 |
-
print(len(events)) # 609 annotated events
|
| 134 |
-
print(sample_id, video_filename)
|
| 135 |
-
print(annotation["Question"], annotation["Answer"])
|
| 136 |
-
for event in events_by_sample[sample_id]:
|
| 137 |
-
start = float(event["start_sec"])
|
| 138 |
-
end = float(event["end_sec"])
|
| 139 |
-
print(event["event_id"], start, end)
|
| 140 |
-
|
| 141 |
-
# To download this video, uncomment:
|
| 142 |
-
# local_video = hf_hub_download(
|
| 143 |
-
# repo_id=repo_id, repo_type="dataset", filename=video_filename
|
| 144 |
-
# )
|
| 145 |
-
```
|
| 146 |
-
|
| 147 |
-
CSV readers return strings, so convert timing values to numbers before calculating durations, comparing timestamps, or seeking within a video. To analyze events across the subset, use the 609 event rows; to analyze samples, first group them by the 300 distinct `sample_id` values.
|
|
|
|
| 1 |
# Moment-Video
|
| 2 |
|
| 3 |
+
Moment-Video contains 1,000 videos with question-answer annotations, plus temporal event annotations for a subset of 300 samples (609 events).
|
| 4 |
|
| 5 |
+
## Files
|
| 6 |
|
| 7 |
+
- `data/videos/`: Video files organized by category and subclass.
|
| 8 |
+
- `data/annotation_all.csv`: Question-answer annotations for all 1,000 samples.
|
| 9 |
+
- `data/annotation_all.json`: The same annotations in JSON format.
|
| 10 |
+
- `data/event_annotations_300_samples.csv`: Temporal annotations for 300 samples (609 events), with one event per row.
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
Event timestamps and durations are in seconds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|