一、源码安装MMAction2
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab
conda install -c pytorch pytorch torchvision -y
pip install mmcv
git clone https://github.com/open-mmlab/mmaction2.git
cd mmaction2
pip install -r requirements/build.txt
python setup.py develop
mkdir data
ln -s $KINETICS400_ROOT data
二、denseflow安装
①相关依赖安装
CUDA (driver version > 400)
sudo chmod 777 ./cuda_11.2.0_460.27.04_linux.run
安装时不选择安装驱动 改环境变量并生效:
sudo vim /etc/profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
保存后更新环境变量
soucre ~/.bashrc
OpenCV (with CUDA support): opencv3 | opencv4
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.x.zip
unzip opencv.zip
unzip opencv_contrib.zip
cd opencv-4.x/
mkdir -p build && cd build
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.x/modules .. -DWITH_CUDA=ON -DCMAKE_BUILD_TYPE=Debug -DWITH_FFMPEG=ON ..
make -j8
Boost
setup仓库的最大好处就是——Setup a New Machine without sudo! 不过里面的opencv安装方式有bug,所以采用前面的安装方式
git clone https://github.com/innerlee/setup.git
cd setup
export ZZROOT=$HOME/app
export PATH=$ZZROOT/bin:$PATH
export LD_LIBRARY_PATH=$ZZROOT/lib:$ZZROOT/lib64:$LD_LIBRARY_PATH
sh zzgit.sh
./zzboost.sh
export BOOST_ROOT=$ZZROOT
更新环境变量:
sudo vim /etc/profile
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=/home/lyh/opencv-4.x/build/lib: /home/lyh/app/lib
保存后更新环境变量
soucre ~/.bashrc
②从官网安装denseflow
git clone https://github.com/open-mmlab/denseflow.git
注意在CMakeLists.txt设置好opencv路径
cd denseflow && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME/app -DUSE_HDF5=no -DUSE_NVFLOW=no ..
make -j8
make install
三、可以使用MMaction2愉快地玩耍了
|