|
a |
|
b/tools/data/ucf101/README.md |
|
|
1 |
# Preparing UCF-101 |
|
|
2 |
|
|
|
3 |
## Introduction |
|
|
4 |
|
|
|
5 |
<!-- [DATASET] --> |
|
|
6 |
|
|
|
7 |
```BibTeX |
|
|
8 |
@article{Soomro2012UCF101AD, |
|
|
9 |
title={UCF101: A Dataset of 101 Human Actions Classes From Videos in The Wild}, |
|
|
10 |
author={K. Soomro and A. Zamir and M. Shah}, |
|
|
11 |
journal={ArXiv}, |
|
|
12 |
year={2012}, |
|
|
13 |
volume={abs/1212.0402} |
|
|
14 |
} |
|
|
15 |
``` |
|
|
16 |
|
|
|
17 |
For basic dataset information, you can refer to the dataset [website](https://www.crcv.ucf.edu/research/data-sets/ucf101/). |
|
|
18 |
Before we start, please make sure that the directory is located at `$MMACTION2/tools/data/ucf101/`. |
|
|
19 |
|
|
|
20 |
## Step 1. Prepare Annotations |
|
|
21 |
|
|
|
22 |
First of all, you can run the following script to prepare annotations. |
|
|
23 |
|
|
|
24 |
```shell |
|
|
25 |
bash download_annotations.sh |
|
|
26 |
``` |
|
|
27 |
|
|
|
28 |
## Step 2. Prepare Videos |
|
|
29 |
|
|
|
30 |
Then, you can run the following script to prepare videos. |
|
|
31 |
|
|
|
32 |
```shell |
|
|
33 |
bash download_videos.sh |
|
|
34 |
``` |
|
|
35 |
|
|
|
36 |
For better decoding speed, you can resize the original videos into smaller sized, densely encoded version by: |
|
|
37 |
|
|
|
38 |
``` |
|
|
39 |
python ../resize_videos.py ../../../data/ucf101/videos/ ../../../data/ucf101/videos_256p_dense_cache --dense --level 2 --ext avi |
|
|
40 |
``` |
|
|
41 |
|
|
|
42 |
## Step 3. Extract RGB and Flow |
|
|
43 |
|
|
|
44 |
This part is **optional** if you only want to use the video loader. |
|
|
45 |
|
|
|
46 |
Before extracting, please refer to [install.md](/docs/install.md) for installing [denseflow](https://github.com/open-mmlab/denseflow). |
|
|
47 |
|
|
|
48 |
If you have plenty of SSD space, then we recommend extracting frames there for better I/O performance. The extracted frames (RGB + Flow) will take up about 100GB. |
|
|
49 |
|
|
|
50 |
You can run the following script to soft link SSD. |
|
|
51 |
|
|
|
52 |
```shell |
|
|
53 |
# execute these two line (Assume the SSD is mounted at "/mnt/SSD/") |
|
|
54 |
mkdir /mnt/SSD/ucf101_extracted/ |
|
|
55 |
ln -s /mnt/SSD/ucf101_extracted/ ../../../data/ucf101/rawframes |
|
|
56 |
``` |
|
|
57 |
|
|
|
58 |
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. |
|
|
59 |
|
|
|
60 |
```shell |
|
|
61 |
bash extract_rgb_frames.sh |
|
|
62 |
``` |
|
|
63 |
|
|
|
64 |
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. |
|
|
65 |
|
|
|
66 |
```shell |
|
|
67 |
bash extract_rgb_frames_opencv.sh |
|
|
68 |
``` |
|
|
69 |
|
|
|
70 |
If both are required, run the following script to extract frames using "tvl1" algorithm. |
|
|
71 |
|
|
|
72 |
```shell |
|
|
73 |
bash extract_frames.sh |
|
|
74 |
``` |
|
|
75 |
|
|
|
76 |
## Step 4. Generate File List |
|
|
77 |
|
|
|
78 |
you can run the follow script to generate file list in the format of rawframes and videos. |
|
|
79 |
|
|
|
80 |
```shell |
|
|
81 |
bash generate_videos_filelist.sh |
|
|
82 |
bash generate_rawframes_filelist.sh |
|
|
83 |
``` |
|
|
84 |
|
|
|
85 |
## Step 5. Check Directory Structure |
|
|
86 |
|
|
|
87 |
After the whole data process for UCF-101 preparation, |
|
|
88 |
you will get the rawframes (RGB + Flow), videos and annotation files for UCF-101. |
|
|
89 |
|
|
|
90 |
In the context of the whole project (for UCF-101 only), the folder structure will look like: |
|
|
91 |
|
|
|
92 |
``` |
|
|
93 |
mmaction2 |
|
|
94 |
├── mmaction |
|
|
95 |
├── tools |
|
|
96 |
├── configs |
|
|
97 |
├── data |
|
|
98 |
│ ├── ucf101 |
|
|
99 |
│ │ ├── ucf101_{train,val}_split_{1,2,3}_rawframes.txt |
|
|
100 |
│ │ ├── ucf101_{train,val}_split_{1,2,3}_videos.txt |
|
|
101 |
│ │ ├── annotations |
|
|
102 |
│ │ ├── videos |
|
|
103 |
│ │ │ ├── ApplyEyeMakeup |
|
|
104 |
│ │ │ │ ├── v_ApplyEyeMakeup_g01_c01.avi |
|
|
105 |
|
|
|
106 |
│ │ │ ├── YoYo |
|
|
107 |
│ │ │ │ ├── v_YoYo_g25_c05.avi |
|
|
108 |
│ │ ├── rawframes |
|
|
109 |
│ │ │ ├── ApplyEyeMakeup |
|
|
110 |
│ │ │ │ ├── v_ApplyEyeMakeup_g01_c01 |
|
|
111 |
│ │ │ │ │ ├── img_00001.jpg |
|
|
112 |
│ │ │ │ │ ├── img_00002.jpg |
|
|
113 |
│ │ │ │ │ ├── ... |
|
|
114 |
│ │ │ │ │ ├── flow_x_00001.jpg |
|
|
115 |
│ │ │ │ │ ├── flow_x_00002.jpg |
|
|
116 |
│ │ │ │ │ ├── ... |
|
|
117 |
│ │ │ │ │ ├── flow_y_00001.jpg |
|
|
118 |
│ │ │ │ │ ├── flow_y_00002.jpg |
|
|
119 |
│ │ │ ├── ... |
|
|
120 |
│ │ │ ├── YoYo |
|
|
121 |
│ │ │ │ ├── v_YoYo_g01_c01 |
|
|
122 |
│ │ │ │ ├── ... |
|
|
123 |
│ │ │ │ ├── v_YoYo_g25_c05 |
|
|
124 |
|
|
|
125 |
``` |
|
|
126 |
|
|
|
127 |
For training and evaluating on UCF-101, please refer to [getting_started.md](/docs/getting_started.md). |