git clone --recursive https://github.com/open-mmlab/mmaction.git
Note that the last two will be contained in this codebase as a submodule.
Decord is an efficient video loader with smart shuffling. This is required when you want to use videos as the input format for training and is more efficient than OpenCV, useds by mmcv. If you just want to have a quick experience with MMAction, you can simply skip this step. The installation steps follow decord's documentation.
(a) install the required packages by running:
# official PPA comes with ffmpeg 2.8, which lacks tons of features, we use ffmpeg 4.0 here
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt-get update
sudo apt-get install -y build-essential python3-dev python3-setuptools make cmake
libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev
# note: make sure you have cmake 3.8 or later, you can install from cmake official website if it's too old
sudo apt-get install ffmpeg
(b) Build the library from source
cd third_party/decord
mkdir build && cd build
cmake .. -DUSE_CUDA=0
make
(c) Install python binding
cd ../python
python setup.py install --user
cd ../../
Dense_flow is used to calculate the optical flow of videos. If you just want to have a quick experience with MMAction without taking pain of installing opencv, you can skip this step.
Note that Dense_flow now supports OpenCV 4.1.0, 3.1.0 and 2.4.13. The master branch is for 4.1.0. For those with 2.4.13, please refer to the lines with strikethrough.
cd third_party/
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils
wget -O OpenCV-2.4.13.zip https://github.com/Itseez/opencv/archive/2.4.13.zip
unzip OpenCV-2.4.13.zip
cd opencv-2.4.13
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_TBB=ON -D WITH_V4L=ON ..
make -j32
cd ../../../
(a) Install OpenCV=4.1.0
/usr/local/cuda-10.0/include/
for example).
Note that you may have to do as root.unzip Video_Codec_SDK_9.0.20.zip
cp Video_Codec_SDK_9.0.20/include/nvcuvid.h /usr/local/cuda-10.0/include/
cp Video_Codec_SDK_9.0.20/include/cuviddec.h /usr/local/cuda-10.0/include/
cp Video_Codec_SDK_9.0.20/Lib/linux/stubs/x86_64/libnvcuvid.so /usr/local/cuda-10.0/lib64/libnvcuvid.so.1
sudo apt-get install -y liblapack-dev libatlas-base-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt update
sudo apt install -y ffmpeg
cd third_party
wget -O OpenCV-4.1.0.zip wget https://github.com/opencv/opencv/archive/4.1.0.zip
unzip OpenCV-4.1.0.zip
wget -O OpenCV_contrib-4.1.0.zip https://github.com/opencv/opencv_contrib/archive/4.1.0.zip
unzip OpenCV_contrib-4.1.0.zip
cd opencv-4.1.0
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_CUDA=ON -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules/ -DWITH_TBB=ON -DBUILD_opencv_cnn_3dobj=OFF -DBUILD_opencv_dnn=OFF -DBUILD_opencv_dnn_modern=OFF -DBUILD_opencv_dnns_easily_fooled=OFF -DOPENCV_ENABLE_NONFREE=ON ..
make -j
Note that -DOPENCV_ENABLE_NONFREE=ON
is explicitly set to enable warped flow proposed in TSN.
You can skip this argument to speed up the compilation if you do not intend to use it.
(b) Build dense_flow
cd third_party/dense_flow
# dense_flow dependencies
sudo apt-get -qq install libzip-dev
mkdir build && cd build
# deprecated:
# OpenCV_DIR=../../opencv-2.4.13/build cmake ..
OpenCV_DIR=../../opencv-4.1.0/build cmake ..
make -j
(a) Install Cython
pip install cython
(b) Compile CUDA extensions
./compile.sh
(c) Install mmaction
python setup.py develop
Please refer to DATASET.md to get familar with the data preparation and to GETTING_STARTED.md to use MMAction.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。