提交 8d3b1ecf 编写于 作者: L linjintao

Merge branch 'tjq/sthv2_doc' into 'master'

Add sthv2 doc.

See merge request open-mmlab/mmaction-lite!294
#! /usr/bin/bash env #! /usr/bin/bash env
cd ../ cd ../
python build_rawframes.py ../../data/mit/videos/training ../../data/mit/rawframes/training/ --level 2 --flow_type tvl1 --ext mp4 --task both python build_rawframes.py ../../data/mit/videos/training ../../data/mit/rawframes/training/ --level 2 --flow_type tvl1 --ext mp4 --task both
echo "Raw frames (RGB and tv-l1) Generated for train set" echo "Raw frames (RGB and tv-l1) Generated for train set"
python build_rawframes.py ../../data/mit/vides/validation/ ../../data/mit/rawframes/validation/ --level 2 --flow_type tvl1 --ext mp4 --task both python build_rawframes.py ../../data/mit/vides/validation/ ../../data/mit/rawframes/validation/ --level 2 --flow_type tvl1 --ext mp4 --task both
echo "Raw frames (RGB and tv-l1) Generated for val set" echo "Raw frames (RGB and tv-l1) Generated for val set"
cd mit/ cd mit/
#! /usr/bin/bash env
FLOW_TYPE=$1
cd ../
python build_rawframes.py ../../data/sthv2/videos/ ../../data/sthv2/rawframes/ --task both --level 1 --flow_type ${FLOW_TYPE} --ext webm
echo "Raw frames (RGB and tv-l1) Generated"
cd sthv2/
#! /usr/bin/bash env
cd ../
python build_rawframes.py ../../data/sthv2/videos/ ../../data/sthv2/rawframes/ --task rgb --level 1 --ext webm
echo "Genearte raw frames (RGB only)"
cd sthv2/
#! /usr/bin/bash env
cd ../../../
PYTHONPATH=. python tools/data/build_file_list.py sthv2 data/sthv2/rawframes/ --num_split 1 --level 1 --subset train --format rawframe --shuffle
PYTHONPATH=. python tools/data/build_file_list.py sthv2 data/sthv2/rawframes/ --num_split 1 --level 1 --subset val --format rawframe --shuffle
echo "Filelist for rawframes generated."
cd tools/data/sthv2/
#! /usr/bin/bash env
cd ../../../
PYTHONPATH=. python tools/data/build_file_list.py sthv2 data/sthv2/videos/ --num_split 1 --level 1 --subset train --format videos --shuffle
PYTHONPATH=. python tools/data/build_file_list.py sthv2 data/sthv2/videos/ --num_split 1 --level 1 --subset val --format videos --shuffle
echo "Filelist for videos generated."
cd tools/data/sthv2/
# Preparing Something-Something V2
For basic dataset information, you can refer to the dataset [website](https://20bn.com/datasets/something-something/v2).
Before we start, please make sure that the directory is located at `$MMACTION/tools/data/sthv2/`.
## Step 1. Prepare Annotations
First of all, you have to sign in and download annotations to `$MMACTION/data/sthv2/annotations` on the official [website](https://20bn.com/datasets/something-something/v2).
## Step 2. Prepare Videos
Then, you can download all data parts to `$MMACTION/data/sthv2/` and use the following command to extract.
```shell
cd $MMACTION/data/sthv2/
cat 20bn-something-something-v2-?? | tar zx
```
## Step 3. 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/install.md) for installing [dense_flow](https://github.com/innerlee/denseflow).
If you have plenty of SSD space, then we recommend extracting frames there for better I/O performance.
You can run the following script to soft link SSD.
```shell
# execute these two line (Assume the SSD is mounted at "/mnt/SSD/")
mkdir /mnt/SSD/sthv2_extracted/
ln -s /mnt/SSD/sthv2_extracted/ ../../../data/sthv2/rawframes
If you didn't install dense_flow in the installation or only want to play with RGB frames (since extracting optical flow can be time-comsuming), consider running the following script to extract **RGB-only** frames.
```shell
cd $MMACTION/tools/data/sthv2/
bash extract_rgb_frames.sh
```
If both are required, run the following script to extract frames.
```shell
cd $MMACTION/tools/data/sthv2/
bash extract_frames.sh tvl1
```
## Step 4. Generate File List
you can run the follow script to generate file list in the format of rawframes and videos.
```shell
cd $MMACTION/tools/data/sthv2/
bash generate_filelist.sh
```
## Step 5. Check Directory Structure
After the whole data process for Something-Something V2 preparation,
you will get the rawframes (RGB + Flow), videos and annotation files for Something-Something V2.
In the context of the whole project (for Something-Something V2 only), the folder structure will look like:
```
mmaction
├── mmaction
├── tools
├── configs
├── data
│ ├── sthv2
│ │ ├── sthv2_{train,val}_list_rawframes.txt
│ │ ├── sthv2_{train,val}_list_videos.txt
│ │ ├── annotations
│ | ├── videos
│ | | ├── 100000.mp4
│ | | ├── 100001.mp4
│ | | ├──...
│ | ├── rawframes
│ | | ├── 100000
│ | | | ├── img_00001.jpg
│ | | | ├── img_00002.jpg
│ | | | ├── ...
│ | | | ├── flow_x_00001.jpg
│ | | | ├── flow_x_00002.jpg
│ | | | ├── ...
│ | | | ├── flow_y_00001.jpg
│ | | | ├── flow_y_00002.jpg
│ | | | ├── ...
│ | | ├── 100001
│ | | ├── ...
```
For training and evaluating on Something-Something V2, please refer to [getting_started.md](/docs/getting_started.md).
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册