Skip to content

Commit

Permalink
Add explanation for using denseflow to extract both rgb and flow (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamerlin authored Jul 13, 2020
1 parent 0bd0372 commit 25746b3
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 14 deletions.
8 changes: 5 additions & 3 deletions docs/data_preparation.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ Note that the videos should be arranged in either

### Extract frames

To extract frames and optical flow, [dense_flow](https://github.com/open-mmlab/denseflow) is needed.
You can use the following command to extract frames.
To extract both frames and optical flow, you can use the tool [denseflow](https://github.com/open-mmlab/denseflow) we wrote.
Since different frame extraction tools produce different number of frames,
it is beneficial to use the same tool to do both frame extraction and the flow computation, to avoid mismatching of frame counts.

```shell
python build_rawframes.py ${SRC_FOLDER} ${OUT_FOLDER} [--task ${TASK}] [--level ${LEVEL}] \
[--num-worker ${NUM_WORKER}] [--flow-type ${FLOW_TYPE}] [--out-format ${OUT_FORMAT}] \
[--ext ${EXT}] [--new-width ${NEW_WIDTH}] [--new-height ${NEW_HEIGHT}] [--new-short ${NEW_SHORT}]
[--resume]
[--resume] [--use-opencv]
```

- `SRC_FOLDER`: Folder of the original video.
Expand All @@ -63,6 +64,7 @@ python build_rawframes.py ${SRC_FOLDER} ${OUT_FOLDER} [--task ${TASK}] [--level
- `NEW_HEIGHT`: Resized image height of output.
- `NEW_SHORT`: Resized image short side length keeping ratio.
- `--resume`: Whether to resume optical flow extraction instead of overwriting.
- `--use-opencv`: Whether to use OpenCV to extract rgb frames.

The recommended practice is

Expand Down
8 changes: 4 additions & 4 deletions tools/data/build_rawframes.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ def parse_args():
default='avi',
choices=['avi', 'mp4', 'webm'],
help='video file extensions')
parser.add_argument(
'--use-opencv',
action='store_true',
help='Whether to use opencv to extract rgb frames')
parser.add_argument(
'--new-width', type=int, default=0, help='resize image width')
parser.add_argument(
Expand All @@ -158,6 +154,10 @@ def parse_args():
action='store_true',
default=False,
help='resume optical flow extraction instead of overwriting')
parser.add_argument(
'--use-opencv',
action='store_true',
help='Whether to use opencv to extract rgb frames')
args = parser.parse_args()

return args
Expand Down
2 changes: 1 addition & 1 deletion tools/data/kinetics400/preparing_kinetics400.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bash rename_classnames.sh

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.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.

Expand Down
2 changes: 1 addition & 1 deletion tools/data/mit/preparing_mit.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bash download_data.sh

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.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.

Expand Down
2 changes: 1 addition & 1 deletion tools/data/mmit/preparing_mmit.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bash download_data.sh

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.md) for installing [denseflow](https://github.com/open-mmlab/denseflow).

First, you can run the following script to soft link SSD.

Expand Down
2 changes: 1 addition & 1 deletion tools/data/sthv1/preparing_sthv1.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cd $MMACTION2/tools/data/sthv1/

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.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.

Expand Down
2 changes: 1 addition & 1 deletion tools/data/sthv2/preparing_sthv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cat 20bn-something-something-v2-?? | tar zx

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.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.

Expand Down
2 changes: 1 addition & 1 deletion tools/data/thumos14/preparing_thumos14.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bash download_videos.sh

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.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.

Expand Down
2 changes: 1 addition & 1 deletion tools/data/ucf101/preparing_ucf101.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bash download_videos.sh

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/open-mmlab/denseflow).
Before extracting, please refer to [install.md](/docs/install.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. The extracted frames (RGB + Flow) will take up about 100GB.

Expand Down

0 comments on commit 25746b3

Please sign in to comment.