File size: 5,424 Bytes
d3dbf03 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# Preparing Moments in Time
## Introduction
<!-- [DATASET] -->
```BibTeX
@article{monfortmoments,
title={Moments in Time Dataset: one million videos for event understanding},
author={Monfort, Mathew and Andonian, Alex and Zhou, Bolei and Ramakrishnan, Kandan and Bargal, Sarah Adel and Yan, Tom and Brown, Lisa and Fan, Quanfu and Gutfruend, Dan and Vondrick, Carl and others},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
year={2019},
issn={0162-8828},
pages={1--8},
numpages={8},
doi={10.1109/TPAMI.2019.2901464},
}
```
For basic dataset information, you can refer to the dataset [website](http://moments.csail.mit.edu/).
Before we start, please make sure that the directory is located at `$MMACTION2/tools/data/mit/`.
## Step 1. Prepare Annotations and Videos
First of all, you have to visit the official [website](http://moments.csail.mit.edu/), fill in an application form for downloading the dataset. Then you will get the download link. You can use `bash preprocess_data.sh` to prepare annotations and videos. However, the download command is missing in that script. Remember to download the dataset to the proper place follow the comment in this script.
For better decoding speed, you can resize the original videos into smaller sized, densely encoded version by:
```shell
python ../resize_videos.py ../../../data/mit/videos/ ../../../data/mit/videos_256p_dense_cache --dense --level 2
```
## Step 2. Extract RGB and Flow
This part is **optional** if you only want to use the video loader.
Before extracting, please refer to [install.md](/docs/en/get_started/installation.md) for installing [denseflow](https://github.com/open-mmlab/denseflow).
If you have plenty of SSD space, then we recommend extracting frames there for better I/O performance. And you can run the following script to soft link the extracted frames.
```shell
# execute these two line (Assume the SSD is mounted at "/mnt/SSD/")
mkdir /mnt/SSD/mit_extracted/
ln -s /mnt/SSD/mit_extracted/ ../../../data/mit/rawframes
```
If you only want to play with RGB frames (since extracting optical flow can be time-consuming), consider running the following script to extract **RGB-only** frames using denseflow.
```shell
bash extract_rgb_frames.sh
```
If you didn't install denseflow, you can still extract RGB frames using OpenCV by the following script, but it will keep the original size of the images.
```shell
bash extract_rgb_frames_opencv.sh
```
If both are required, run the following script to extract frames.
```shell
bash extract_frames.sh
```
## Step 4. Generate File List
you can run the follow script to generate file list in the format of rawframes and videos.
```shell
bash generate_{rawframes, videos}_filelist.sh
```
## Step 5. Check Directory Structure
After the whole data process for Moments in Time preparation,
you will get the rawframes (RGB + Flow), videos and annotation files for Moments in Time.
In the context of the whole project (for Moments in Time only), the folder structure will look like:
```
mmaction2
βββ data
βΒ Β βββ mit
βΒ Β βββ annotations
βΒ Β βΒ Β βββ license.txt
βΒ Β βΒ Β βββ moments_categories.txt
βΒ Β βΒ Β βββ README.txt
βΒ Β βΒ Β βββ trainingSet.csv
βΒ Β βΒ Β βββ validationSet.csv
βΒ Β βββ mit_train_rawframe_anno.txt
βΒ Β βββ mit_train_video_anno.txt
βΒ Β βββ mit_val_rawframe_anno.txt
βΒ Β βββ mit_val_video_anno.txt
βΒ Β βββ rawframes
βΒ Β βΒ Β βββ training
βΒ Β βΒ Β βΒ Β βββ adult+female+singing
βΒ Β βΒ Β βΒ Β βΒ Β βββ 0P3XG_vf91c_35
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ flow_x_00001.jpg
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ flow_x_00002.jpg
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ ...
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ flow_y_00001.jpg
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ flow_y_00002.jpg
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ ...
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ img_00001.jpg
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ img_00002.jpg
βΒ Β βΒ Β βΒ Β βΒ Β βββ yt-zxQfALnTdfc_56
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ ...
βΒ Β βΒ Β βΒ Β βββ yawning
βΒ Β βΒ Β βΒ Β βββ _8zmP1e-EjU_2
βΒ Β βΒ Β βΒ Β Β Β βΒ Β βββ ...
βΒ Β βΒ Β βββ validation
βΒ Β βΒ Β βΒ Β βββ ...
βΒ Β βββ videos
βΒ Β βββ training
βΒ Β βΒ Β βββ adult+female+singing
βΒ Β βΒ Β βΒ Β βββ 0P3XG_vf91c_35.mp4
βΒ Β βΒ Β βΒ Β βββ ...
βΒ Β βΒ Β βΒ Β βββ yt-zxQfALnTdfc_56.mp4
βΒ Β βΒ Β βββ yawning
βΒ Β βΒ Β βββ ...
βΒ Β βββ validation
βΒ Β βΒ Β βββ ...
βββ mmaction
βββ ...
```
For training and evaluating on Moments in Time, please refer to [Training and Test Tutorial](/docs/en/user_guides/train_test.md).
|