• Stars
    star
    286
  • Rank 139,792 (Top 3 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 4 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Extracting optical flow and frames

Denseflow

Extracting dense flow field given a video.

Features

  • support multiple optical flow algorithms, including Nvidia hardware optical flow
  • support single video (or a frame folder) / a list of videos (or a list of frame folders) as input
  • support multiple output types (image, hdf5)
  • faster, 40% faster (by parallelize IO & computation)
  • record the progress when extract a list of videos, and resume by simply running the same command again (idempotent)

Install

Dependencies:

  • CUDA (driver version > 400)
  • OpenCV (with CUDA support): opencv3 | opencv4
  • Boost
  • HDF5 (Optional)
git clone https://github.com/open-mmlab/denseflow.git
cd denseflow && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME/app -DUSE_HDF5=no -DUSE_NVFLOW=no ..
make -j
make install

If you have trouble setting up building environments, scripts in INSTALL might be helpful.

Usage

Extract optical flow of a single video

denseflow test.avi -b=20 -a=tvl1 -s=1 -v
  • test.avi: input video
  • -b=20 bound set to 20
  • -a=tvl1 algorithm is tvl1
  • -s=1 step is 1, ie flow of adjacent frames
  • -v: verbose

Extract optical flow of a list of videos

denseflow videolist.txt -b=20 -a=tvl1 -s=1 -v
  • videolist.txt: a list of video paths
  • -b=20 bound set to 20
  • -a=tvl1 algorithm is tvl1
  • -s=1 step is 1, ie flow of adjacent frames
  • -v: verbose

Extract optical flow of a list of videos, each video is under a class folder

denseflow videolist.txt -b=20 -a=tvl1 -s=1 -cf -v
  • videolist.txt: a list of video paths
  • -b=20 bound set to 20
  • -a=tvl1 algorithm is tvl1
  • -s=1 step is 1, ie flow of adjacent frames
  • -cf this switch means that parent folder of the video is a class name
  • -v: verbose

Extract optical flow of a folder of frame images

denseflow test -b=20 -a=tvl1 -s=1 -if -v
  • test: folder of the frame images
  • -b=20 bound set to 20
  • -a=tvl1 algorithm is tvl1
  • -s=1 step is 1, ie flow of adjacent frames
  • -if indicates that inputs are frames
  • -v: verbose

Extract frames of a single video

denseflow test.avi -s=0 -v
  • test.avi: input video
  • -s=0 step 0 is reserved for extracting frames
  • -v: verbose

Extract frames of a list of videos

denseflow videolist.txt -s=0 -v
  • videolist.txt: a list of video paths
  • -s=1 step is 1, ie flow of adjacent frames
  • -s=0 step 0 is reserved for extracting frames
  • -v: verbose

Documentation

$ denseflow -h
GPU optical flow extraction.
Usage: denseflow [params] input

        -a, --algorithm (value:tvl1)
                optical flow algorithm (nv/tvl1/farn/brox)
        -b, --bound (value:32)
                maximum of optical flow
        --cf, --classFolder
                outputDir/class/video/flow.jpg
        -f, --force
                regardless of the marked .done file
        -h, --help (value:true)
                print help message
        --if, --inputFrames
                inputs are frames
        --newHeight, --nh (value:0)
                new height
        --newShort, --ns (value:0)
                short side length
        --newWidth, --nw (value:0)
                new width
        -o, --outputDir (value:.)
                root dir of output
        -s, --step (value:0)
                right - left (0 for img, non-0 for flow)
        --saveType, --st (value:jpg)
                save format type (png/h5/jpg)
        -v, --verbose
                verbose

        input
                filename of video or folder of frames or a list.txt of those

Citation

If you use this tool in your research, please cite this project.

@misc{denseflow,
  author =       {Wang, Shiguang* and Li, Zhizhong* and Zhao, Yue and Xiong, Yuanjun and Wang, Limin and Lin, Dahua},
  title =        {{denseflow}},
  howpublished = {\url{https://github.com/open-mmlab/denseflow}},
  year =         {2020}
}

Acknowledgement

Rewritten based on yuanjun's fork of dense_flow.

More Repositories

1

mmdetection

OpenMMLab Detection Toolbox and Benchmark
Python
27,899
star
2

mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
Python
7,372
star
3

mmagic

OpenMMLab Multimodal Advanced, Generative, and Intelligent Creation Toolbox. Unlock the magic πŸͺ„: Generative-AI (AIGC), easy-to-use APIs, awsome model zoo, diffusion models, for text-to-image generation, image/video restoration/enhancement, etc.
Jupyter Notebook
6,575
star
4

mmcv

OpenMMLab Computer Vision Foundation
Python
5,626
star
5

mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
Python
4,969
star
6

mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
Python
4,781
star
7

OpenPCDet

OpenPCDet Toolbox for LiDAR-based 3D Object Detection.
Python
4,342
star
8

mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
Python
4,099
star
9

Amphion

Amphion (/Γ¦mˈfaΙͺΙ™n/) is a toolkit for Audio, Music, and Speech Generation. Its purpose is to support reproducible research and help junior researchers and engineers get started in the field of audio, music, and speech generation research and development.
Python
3,947
star
10

mmaction2

OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark
Python
3,903
star
11

mmtracking

OpenMMLab Video Perception Toolbox. It supports Video Object Detection (VID), Multiple Object Tracking (MOT), Single Object Tracking (SOT), Video Instance Segmentation (VIS) with a unified framework.
Python
3,384
star
12

mmpretrain

OpenMMLab Pre-training Toolbox and Benchmark
Python
3,138
star
13

mmselfsup

OpenMMLab Self-Supervised Learning Toolbox and Benchmark
Python
3,084
star
14

mmskeleton

A OpenMMLAB toolbox for human pose estimation, skeleton-based action recognition, and action synthesis.
Python
2,855
star
15

mmyolo

OpenMMLab YOLO series toolbox and benchmark. Implemented RTMDet, RTMDet-Rotated,YOLOv5, YOLOv6, YOLOv7, YOLOv8,YOLOX, PPYOLOE, etc.
Python
2,719
star
16

mmdeploy

OpenMMLab Model Deployment Framework
Python
2,520
star
17

mmaction

An open-source toolbox for action understanding based on PyTorch
Python
1,847
star
18

mmgeneration

MMGeneration is a powerful toolkit for generative models, based on PyTorch and MMCV.
Python
1,796
star
19

mmrotate

OpenMMLab Rotated Object Detection Toolbox and Benchmark
Python
1,724
star
20

Multimodal-GPT

Multimodal-GPT
Python
1,397
star
21

mmrazor

OpenMMLab Model Compression Toolbox and Benchmark.
Python
1,366
star
22

mmfashion

Open-source toolbox for visual fashion analysis based on PyTorch
Python
1,204
star
23

mmhuman3d

OpenMMLab 3D Human Parametric Model Toolbox and Benchmark
Python
1,129
star
24

mmengine

OpenMMLab Foundational Library for Training Deep Learning Models
Python
1,029
star
25

playground

A central hub for gathering and showcasing amazing projects that extend OpenMMLab with SAM and other exciting features.
Python
1,017
star
26

OpenMMLabCourse

OpenMMLab course index and stuff
Jupyter Notebook
919
star
27

mmflow

OpenMMLab optical flow toolbox and benchmark
Python
889
star
28

PIA

[CVPR 2024] PIA, your Personalized Image Animator. Animate your images by text prompt, combing with Dreambooth, achieving stunning videos. PIAοΌŒδ½ ηš„δΈͺζ€§εŒ–ε›ΎεƒεŠ¨η”»η”Ÿζˆε™¨οΌŒεˆ©η”¨ζ–‡ζœ¬ζη€Ίε°†ε›Ύεƒε˜δΈΊε₯‡ε¦™ηš„εŠ¨η”»
Python
716
star
29

mmfewshot

OpenMMLab FewShot Learning Toolbox and Benchmark
Python
662
star
30

awesome-vit

396
star
31

OpenUnReID

PyTorch open-source toolbox for unsupervised or domain adaptive object re-ID.
Python
389
star
32

labelbee-client

Out-of-the-box Annotation Toolbox
JavaScript
374
star
33

mim

MIM Installs OpenMMLab Packages
Python
329
star
34

MMGEN-FaceStylor

Python
245
star
35

mmeval

A unified evaluation library for multiple machine learning libraries
Python
243
star
36

labelbee

LabelBee is an annotation Library
TypeScript
223
star
37

OpenMMLabCamp

Jupyter Notebook
92
star
38

polynet

The Github Repo for PolyNet
77
star
39

CLUE

C++ Lightweight Utility Extensions
C++
70
star
40

mim-example

Python
57
star
41

mmengine-template

Python
47
star
42

ecosystem

36
star
43

mmstyles

Latex style file to facilitate writing of technical papers
TeX
36
star
44

mmpose-webcam-demo

Python
23
star
45

pre-commit-hooks

Python
17
star
46

mdformat-openmmlab

Python
8
star
47

.github

3
star