### Building and Installing PaddleVideo Locally Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md Builds the PaddleVideo wheel package locally and then installs it using pip. This method is used when installing from source or a specific local build, creating a distributable wheel file and then installing it. ```bash python3.7 setup.py bdist_wheel python3.7 -m pip install dist/ppvideo-2.3.0-py3-none-any.whl ``` -------------------------------- ### Installing PaddleVideo via PyPI Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md Installs the PaddleVideo package (version 2.3.0) directly from PyPI using pip. This is the recommended method for installing the library and its dependencies. ```bash pip3.7 install ppvideo==2.3.0 ``` -------------------------------- ### Running PaddleVideo Inference Script Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Demonstrates how to use the `ppvideo` command-line tool to run inference with a specified model (`ppTSM_v2`) on a video file, with GPU usage explicitly disabled. This showcases a basic example of using the installed PaddleVideo package. ```bash ppvideo --model_name='ppTSM_v2' --use_gpu=False --video_file='data/example.avi' ``` -------------------------------- ### Installing AutoLog and Cloning PaddleVideo Repository Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md This snippet outlines the steps to clone the AutoLog repository, install its dependencies, build and install its Python wheel, and then clone the PaddleVideo repository. These are prerequisites for setting up the PaddleVideo project. ```bash # 安装AutoLog git clone https://github.com/LDOUBLEV/AutoLog cd AutoLog python3.7 -m pip install -r requirements.txt python3.7 setup.py bdist_wheel python3.7 -m pip install ./dist/auto_log-1.0.0-py3-none-any.whl # 克隆PaddleVideo代码 cd ../ git clone https://github.com/PaddlePaddle/PaddleVideo.git ``` -------------------------------- ### Installing OpenCV-Python via Pip (Python) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md This command installs a specific version of `opencv-python` (4.2.0.32) using `pip` for Python 3.7. It utilizes a specified PyPI mirror (`https://pypi.doubanio.com/simple`) to potentially speed up the installation process, addressing common issues with slow default installations. ```python python3.7 -m pip install opencv-python==4.2.0.32 -i https://pypi.doubanio.com/simple ``` -------------------------------- ### Installing PaddleVideo Dependencies Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Upgrades pip and installs all necessary Python packages listed in the `requirements.txt` file for PaddleVideo. These dependencies are crucial for the project's functionality and must be installed before running PaddleVideo. ```bash python3.7 -m pip install --upgrade pip pip3.7 install --upgrade -r requirements.txt ``` -------------------------------- ### Installing PaddleVideo Project Dependencies Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md This snippet provides the commands to navigate into the cloned PaddleVideo directory and install all required Python dependencies listed in its `requirements.txt` file using pip. ```bash cd PaddleVideo python3.7 -m pip install -r requirements.txt ``` -------------------------------- ### Installing cuDNN from DEB Packages and Verification Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md This section details the process of installing cuDNN from downloaded .deb files and verifying the installation using the `mnistCUDNN` sample. It includes commands for installing runtime, developer, and documentation libraries, followed by compiling and running the sample. ```bash # x.x.x表示下载的版本号 # $HOME为工作目录 sudo dpkg -i libcudnn7_x.x.x-1+cudax.x_arm64.deb sudo dpkg -i libcudnn7-dev_7.x.x.x-1+cudax.x_arm64.deb sudo dpkg -i libcudnn7-doc_7.x.x.x-1+cudax.x_arm64.deb # 验证是否正确安装 cp -r /usr/src/cudnn_samples_v7/ $HOME cd $HOME/cudnn_samples_v7/mnistCUDNN # 编译 make clean && make ./mnistCUDNN ``` -------------------------------- ### Verifying PaddlePaddle Installation Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Runs a utility check to confirm that PaddlePaddle has been installed correctly and is functional. This snippet helps ensure the environment is properly set up and ready for use with PaddleVideo. ```python import paddle paddle.utils.run_check() ``` -------------------------------- ### Installing PaddlePaddle CPU Version with pip Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md Installs the CPU-only version of PaddlePaddle using pip for systems without an available GPU. This command specifies Python 3.7 and uses a Baidu mirror for faster downloads. It is a prerequisite for running PaddleVideo on CPU. ```bash python3.7 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` -------------------------------- ### Cloning PaddleVideo Repository Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Navigates to a specified directory and clones the PaddleVideo repository from GitHub. This step retrieves the entire source code for the PaddleVideo project, which is necessary for local development and usage. ```bash cd path_to_clone_PaddleVideo git clone https://github.com/PaddlePaddle/PaddleVideo.git ``` -------------------------------- ### Installing PaddlePaddle GPU Version with pip Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md Installs the GPU-enabled version of PaddlePaddle using pip for systems with CUDA 9 or 10. This command specifies Python 3.7 and uses a Baidu mirror for faster downloads. It is a prerequisite for leveraging GPU acceleration with PaddleVideo. ```bash python3.7 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple ``` -------------------------------- ### Installing PaddleVideo Python Package Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Installs the `ppvideo` Python package at a specific version (2.3.0) using pip. This makes the PaddleVideo functionalities available as a Python library for use in scripts and applications. ```bash pip3.7 install ppvideo==2.3.0 ``` -------------------------------- ### Running ppvideo with ppTSM Model (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md This command demonstrates using the `ppvideo` tool with the `ppTSM` model for video classification. It sets the number of segments to 8, processes videos from 'data/mp4' in batches of 2, and retrieves the top 5 classification results, similar to the `ppTSM_v2` example but optimized for the `ppTSM` model. ```bash ppvideo --model_name='ppTSM' --num_seg=8 --video_file="data/mp4" --batch_size=2 --top_k=5 ``` -------------------------------- ### Installing PaddlePaddle with TensorRT via Docker Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md This snippet provides commands to create and enter a Docker container, then install a specific version of PaddlePaddle GPU with TensorRT support inside the container. It maps the current host directory to `/paddle` within the container for easy access. ```bash nvidia-docker run --name paddle -it -v $PWD:/paddle paddlepaddle/paddle:2.0.0rc0-gpu-cuda10.2-cudnn7 /bin/bash cd /paddle # 安装带TRT的paddle python3.7 -m pip install https://paddle-wheel.bj.bcebos.com/with-trt/2.1.1-gpu-cuda10.1-cudnn7-mkl-gcc8.2/paddlepaddle_gpu-2.1.1.post101-cp37-cp37m-linux_x86_64.whl ``` -------------------------------- ### Installing PaddlePaddle GPU Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Installs or upgrades the GPU-enabled version of PaddlePaddle using pip. This is a crucial prerequisite for running PaddleVideo, which currently only supports GPU devices for training. ```bash pip3 install paddlepaddle-gpu --upgrade ``` -------------------------------- ### Installing PaddleSlim from Source Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/slim/readme_en.md These commands clone the PaddleSlim repository from GitHub, navigate into its directory, and install the library from the source code. This method is used to get the latest features or for development purposes. ```Bash git clone https://github.com/PaddlePaddle/PaddleSlim.git cd Paddleslim python3.7 setup.py install ``` -------------------------------- ### Checking PaddlePaddle Version Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/install.md Displays the installed version of PaddlePaddle. It is important to verify that the version is 2.0 or later, as PaddleVideo requires this for compatibility and optimal performance. ```bash python3 -c "import paddle; print(paddle.__version__)" ``` -------------------------------- ### PaddleServing C++ Deployment Directory Contents (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme_en.md This snippet lists the key files within the `deploy/cpp_serving` directory, which are essential for starting the pipeline service, running the C++ serving server, sending prediction requests, installing the environment, and handling preprocessing functions for the deployed model. ```bash run_cpp_serving.sh # Start the script on the C++ serving server side pipeline_http_client.py # The script on the client side to send data and get the prediction results paddle_env_install.sh # Install C++ serving environment script preprocess_ops.py # file to store preprocessing functions ``` -------------------------------- ### Installing TensorRT Python Libraries Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md This snippet guides on setting the `LD_LIBRARY_PATH` environment variable and installing the TensorRT and GraphSurgeon Python packages from the extracted TensorRT archive. It assumes a specific TensorRT version and Python 3.7. ```bash # 以下安装命令中 '${version}' 为下载的TensorRT版本,如7.0.0.11 # 设置环境变量, 为解压后的TensorRT的lib目录 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: # 安装TensorRT cd TensorRT-${version}/python python3.7 -m pip install tensorrt-*-cp37-none-linux_x86_64.whl # 安装graphsurgeon cd TensorRT-${version}/graphsurgeon python3.7 -m pip install graphsurgeon-0.4.1-py2.py3-none-any.whl ``` -------------------------------- ### Installing PaddleDet Dependency Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_infer/readme_en.md This command installs the PaddleDet dependency using pip, which is required before proceeding with the C++ prediction environment setup. It uses a direct Git URL for installation. ```Bash python -m pip install [paddledet](git+https://github.com/LDOUBLEV/AutoLog) ``` -------------------------------- ### Installing PaddlePaddle GPU with TensorRT Support Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md This snippet provides commands to download a specific PaddlePaddle GPU wheel file that includes TensorRT support and then install it using pip. It specifies a version compatible with CUDA 10.1 and cuDNN 7. ```bash # 从下载链接中可以看到是paddle2.1.1-cuda10.2-cudnn8.1版本 wget https://paddle-wheel.bj.bcebos.com/with-trt/2.1.1-gpu-cuda10.1-cudnn7-mkl-gcc8.2/paddlepaddle_gpu-2.1.1.post101-cp37-cp37m-linux_x86_64.whl python3.7 -m pip install -U paddlepaddle_gpu-2.1.1.post101-cp37-cp37m-linux_x86_64.whl ``` -------------------------------- ### Installing PaddleServing App Component Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_serving_infer_python.md This command sequence downloads and installs the `paddle_serving_app` package (version 0.7.0) using `wget` and `pip`. This component provides application-level utilities for PaddleServing. ```bash wget https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_app-0.7.0-py3-none-any.whl python3.7 -m pip install paddle_serving_app-0.7.0-py3-none-any.whl ``` -------------------------------- ### Installing PaddleServing Client Component Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_serving_infer_python.md This command sequence downloads and installs the `paddle_serving_client` package (version 0.7.0) using `wget` and `pip`. This component is used to send inference requests to the running PaddleServing service. ```bash wget https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_client-0.7.0-cp37-none-any.whl python3.7 -m pip install paddle_serving_client-0.7.0-cp37-none-any.whl ``` -------------------------------- ### Inferring Video with PaddleVideo CLI (CPU) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md Executes a video inference task using the PaddleVideo command-line interface. It utilizes the `ppTSM_v2` model to process `data/example.avi` on the CPU, demonstrating a basic inference workflow without GPU acceleration. ```bash ppvideo --model_name='ppTSM_v2' --use_gpu=False --video_file='data/example.avi' ``` -------------------------------- ### Installing PaddleVideo Dependencies Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_train_inference_python.md This command installs the necessary Python dependencies for PaddleVideo from the `requirements.txt` file. It should be executed from within the PaddleVideo directory. ```shell python3.7 -m pip install -r requirements.txt ``` -------------------------------- ### Starting PP-TSM Recognition Web Service (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/python_serving/readme.md These Bash commands demonstrate how to launch the PaddlePaddle PP-TSM recognition web service. The first command starts the service in the foreground, while the second command starts it in the background, redirecting all output logs to `log.txt`. ```Bash python3.7 recognition_web_service.py -n PPTSM -c configs/PP-TSM.yaml python3.7 recognition_web_service.py -n PPTSM -c configs/PP-TSM.yaml &>log.txt & ``` -------------------------------- ### Installing AutoLog from Wheel Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_train_inference_python.md This command installs the AutoLog package from the locally built wheel file. It completes the manual installation of AutoLog. ```shell python3.7 -m pip install ./dist/auto_log-1.0.0-py3-none-any.whl ``` -------------------------------- ### Compiling and Installing OpenCV from Source Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_infer/readme_en.md This sequence of commands configures, compiles, and installs OpenCV from its source code. It sets up build paths, creates a build directory, and uses CMake to configure the build with specific options, including disabling shared libraries and enabling support for various image formats and FFmpeg, followed by `make` and `make install`. ```Bash cd opencv-3.4.7 root_path=$PWD # That is the absolute path of opencv-3.4.7 install_path=${root_path}/opencv3 rm -rf build mkdir build cd build cmake .. \ -DCMAKE_INSTALL_PREFIX=${install_path} \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DWITH_IPP=OFF \ -DBUILD_IPP_IW=OFF \ -DWITH_LAPACK=OFF \ -DWITH_EIGEN=OFF \ -DCMAKE_INSTALL_LIBDIR=lib64 \ -DWITH_ZLIB=ON \ -DBUILD_ZLIB=ON \ -DWITH_JPEG=ON \ -DBUILD_JPEG=ON \ -DWITH_PNG=ON \ -DBUILD_PNG=ON \ -DWITH_TIFF=ON \ -DBUILD_TIFF=ON \ -DWITH_FFMPEG=ON make -j make install ``` -------------------------------- ### Starting PaddleServing Python Web Service (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/python_serving/readme_en.md This command initiates the PaddleServing pipeline web service using the `recognition_web_service.py` script. It specifies the model name (`PPTSM`) and the configuration file (`configs/PP-TSM.yaml`) required to start the service. ```bash # Start in the current command line window and stay in front python3.7 recognition_web_service.py -n PPTSM -c configs/PP-TSM.yaml ``` -------------------------------- ### Resolving cuDNN FreeImage Library Errors Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/install.md If the `mnistCUDNN` verification fails with FreeImage-related errors, this snippet provides commands to install the necessary `libfreeimage-dev` and `libfreeimage` libraries to resolve the issue. ```bash sudo apt-get install libfreeimage-dev sudo apt-get install libfreeimage ``` -------------------------------- ### Starting C++ Serving Service (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme_en.md This command executes the `run_cpp_serving.sh` script to start the C++ serving service. The service runs in the background, and its logs are redirected and saved to `nohup.txt`. ```bash bash run_cpp_serving.sh ``` -------------------------------- ### Inferring Video with PaddleVideo Python API (CPU) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md Demonstrates video inference using the PaddleVideo Python API. It initializes `PaddleVideo` with the `ppTSM_v2` model and performs prediction on `data/example.avi` using the CPU, showcasing programmatic control over the inference process. ```python from ppvideo import PaddleVideo clas = PaddleVideo(model_name='ppTSM_v2', use_gpu=False) video_file='data/example.avi' clas.predict(video_file) ``` -------------------------------- ### Installing PaddleSlim via pip Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/slim/readme_en.md This command installs the PaddleSlim library using pip, specifying Python 3.7 and a Tsinghua University mirror for faster download. It's the recommended way for stable installations. ```Bash python3.7 -m pip install paddleslim -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -------------------------------- ### Installing Paddle Environment Dependencies (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme_en.md This command executes the `paddle_env_install.sh` script to install necessary environment dependencies. This is particularly useful if errors related to `libnvinfer.so.6` not being found occur during the serving process. ```bash bash paddle_env_install.sh ``` -------------------------------- ### Start PaddleVideo C++ Serving (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme.md This script initiates the C++ serving process in the background. All output logs generated during the process are redirected and saved to `nohup.txt` for later review and monitoring. ```bash bash run_cpp_serving.sh ``` -------------------------------- ### Installing Python Dependencies from requirements.txt Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_serving_infer_python.md This command installs all Python packages listed in the `requirements.txt` file using pip. This ensures all necessary project dependencies are met for running the serving tests. ```bash python3.7 -m pip install -r requirements.txt ``` -------------------------------- ### Installing PaddleNLP Dependency - Python Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/applications/T2VLAD/README_en.md This command installs the PaddleNLP library, which is a required dependency for running the T2VLAD model. It uses pip, the Python package installer, to fetch and install the package from PyPI. ```bash python -m pip install paddlenlp ``` -------------------------------- ### Installing AutoLog Dependencies Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_train_inference_python.md This command installs the Python dependencies required for AutoLog from its `requirements.txt` file. It must be run from within the `AutoLog` directory. ```shell python3.7 -m pip install -r requirements.txt ``` -------------------------------- ### Installing ONNXRuntime Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/paddle2onnx/readme.md This command installs the ONNX Runtime library using pip, which is necessary for performing inference with ONNX models. It recommends installing version 1.9.0 for compatibility. ```bash python3.7 -m pip install onnxruntime==1.9.0 ``` -------------------------------- ### Starting PP-TSM Recognition Web Service in Background (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/python_serving/readme_en.md This command starts the PaddleVideo PP-TSM recognition web service in the background. It uses Python 3.7 to run `recognition_web_service.py`, specifying the model name 'PPTSM' and its configuration file. All process logs are redirected to `log.txt`. ```bash python3.7 recognition_web_service.py -n PPTSM -c configs/PP-TSM.yaml &>log.txt & ``` -------------------------------- ### Installing PaddleSlim (Optional) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_train_inference_python.md This command optionally installs PaddleSlim, which is required if you intend to test functionalities like quantization or pruning. It's not mandatory for basic training and inference. ```shell python3.7 -m pip install paddleslim ``` -------------------------------- ### Building a Registered Module - Python Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/tutorials/config.md This snippet illustrates how to retrieve and instantiate a registered module using the `Registry`'s `get` method. By calling `BACKBONES.get(backbone_name)()`, the system dynamically creates an instance of the `ResNet` class, demonstrating the 'Builder' aspect of the DI system. ```Python backbone_name = "ResNet" b = BACKBONES.get(backbone_name)() ``` -------------------------------- ### Executing Paddle Serving C++ Client (Shell) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/configs/PP-TSM/model_linux_gpu_normal_normal_serving_cpp_linux_gpu_cpu.txt This command executes the C++ serving client script, 'serving_client.py', providing an example video file ('example.avi') as input. This client interacts with the deployed Paddle Serving model to perform inference. ```Shell python serving_client.py --input_file ../../data/example.avi ``` -------------------------------- ### Installing PaddleServing Server GPU Component Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_serving_infer_python.md This command sequence downloads and installs the `paddle_serving_server_gpu` package (version 0.7.0.post102) using `wget` and `pip`. This component is essential for launching the PaddleServing model inference service on GPU. An alternative wheel is provided for CUDA 10.1 environments. ```bash wget https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_server_gpu-0.7.0.post102-py3-none-any.whl python3.7 -m pip install paddle_serving_server_gpu-0.7.0.post102-py3-none-any.whl ``` -------------------------------- ### Install Paddle Environment Dependencies (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme.md This script is used to install necessary environment dependencies for PaddlePaddle, particularly useful if errors like 'libnvinfer.so.6 not found' occur, indicating missing NVIDIA TensorRT libraries. ```bash bash paddle_env_install.sh ``` -------------------------------- ### Installing Additional Python Dependencies Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/detection/SlowFast_FasterRCNN_en.md This snippet installs essential Python packages required for the project, including 'moviepy' for video processing, 'et_xmlfile' for XML file handling, and 'paddledet' for object detection functionalities, which are prerequisites for running the SlowFast_FasterRCNN model. ```bash python -m pip install moviepy python -m pip install et_xmlfile python -m pip install paddledet ``` -------------------------------- ### Starting Video-Swin-Transformer Training on Kinetics-400 - Bash Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/recognition/videoswin.md This command initiates distributed training of the Video-Swin-Transformer model on the Kinetics-400 dataset using 8 GPUs. It launches the `main.py` script with validation enabled and specifies the configuration file for `videoswin_base_k400_videos.yaml`. ```bash # videos data format python3.7 -u -B -m paddle.distributed.launch --gpus="0,1,2,3,4,5,6,7" --log_dir=log_videoswin_base main.py --validate -c configs/recognition/video_swin_transformer/videoswin_base_k400_videos.yaml ``` -------------------------------- ### Installing PaddleNLP Dependency - Bash Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/applications/T2VLAD/README.md This command installs the `paddlenlp` package using pip, which is a required dependency for running the T2VLAD model. Ensure your PaddlePaddle version is 2.2.2 for compatibility. ```bash python -m pip install paddlenlp ``` -------------------------------- ### Starting Ma-Net Stage One Training (Single GPU) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/applications/EIVideo/EIVideo/docs/en/manet.md This command initiates the first stage of Ma-Net training using a single GPU. It executes the `main.py` script and loads the training parameters and model configuration from `configs/segmentation/manet.yaml`. ```bash python main.py -c configs/segmentation/manet.yaml ``` -------------------------------- ### Training PaddleVideo Model with Multi-GPU (Python) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/usage.md This command initiates multi-GPU training for a PaddleVideo model using `paddle.distributed.launch`. It specifies the GPUs to use via `CUDA_VISIBLE_DEVICES` and `--gpus`, enables validation during training with `--validate`, and loads the configuration from `configs/example.yaml`. ```python export CUDA_VISIBLE_DEVICES=0,1,2,3 python3 -m paddle.distributed.launch \ --gpus="0,1,2,3" \ main.py \ --validate \ -c ./configs/example.yaml ``` -------------------------------- ### Running PaddleVideo Scripts with run.sh (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/usage.md This snippet demonstrates how to execute PaddleVideo operations using the `run.sh` script. The script contains pre-configured commands, and users are expected to uncomment the specific command they wish to run for training or testing. ```bash sh run.sh ``` -------------------------------- ### Launching Single-GPU Training (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/zh-CN/contribute/add_new_algorithm.md This Bash command demonstrates how to initiate single-GPU training in PaddleVideo. It sets the CUDA_VISIBLE_DEVICES environment variable to specify the GPU ID, then executes main.py with --validate to enable validation during training and -c to point to the configuration file. This is the standard way to start training on a single device. ```Bash export CUDA_VISIBLE_DEVICES=0 #指定使用的GPU显卡id python3.7 main.py --validate -c configs_path/your_config.yaml ``` -------------------------------- ### Installing PaddleDetection for Human Proposal Generation Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/detection/SlowFast_FasterRCNN_en.md This snippet provides instructions to install the PaddleDetection library, which is a prerequisite for the first stage of the inference process. PaddleDetection is used to generate human bounding box proposals before they are fed into the SlowFast+FasterRCNN model for action recognition. ```bash cd PaddleDetection/ pip install -r requirements.txt !python setup.py install ``` -------------------------------- ### Training PoseC3D Model on UCF101 (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/recognition/posec3d.md This command initiates the training process for the PoseC3D model on the UCF101 dataset. It uses the specified configuration file and pre-trained weights to start training, with validation enabled during the process. ```Bash python3.7 main.py --validate -c configs/recognition/posec3d/posec3d.yaml --weights res3d_k400.pdparams ``` -------------------------------- ### Starting Video-Swin-Transformer Mixed-Precision Training - Bash Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/recognition/videoswin.md This command starts distributed training with Automatic Mixed Precision (AMP) enabled for the Video-Swin-Transformer model on Kinetics-400. It sets environment variables to optimize CUDA operations and uses the `--amp` flag to accelerate the training process on 8 GPUs. ```bash export FLAGS_conv_workspace_size_limit=800 # MB export FLAGS_cudnn_exhaustive_search=1 export FLAGS_cudnn_batchnorm_spatial_persistent=1 # videos data format python3.7 -u -B -m paddle.distributed.launch --gpus="0,1,2,3,4,5,6,7" --log_dir=log_videoswin_base main.py --amp --validate -c configs/recognition/videoswin/videoswin_base_k400_videos.yaml ``` -------------------------------- ### Navigating to C++ Serving Directory (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme_en.md This command changes the current working directory to the `deploy/cpp_serving` directory, which is the required location for starting the C++ serving service. ```bash cd deploy/cpp_serving ``` -------------------------------- ### Navigating to Python Serving Directory (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/python_serving/readme_en.md This command changes the current working directory to `deploy/python_serving`. This directory contains the necessary scripts and configuration files for starting the PaddleServing pipeline service. ```bash cd deploy/python_serving ``` -------------------------------- ### Starting Distributed Training with DALI Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/recognition/tsn_dali.md This command initiates distributed training of the TSN model using PaddlePaddle's `paddle.distributed.launch` utility. It specifies the GPUs to use, a log directory, enables DALI training, and points to the main configuration file for TSN DALI. ```bash python3.7 -B -m paddle.distributed.launch --gpus="0,1,2,3" --log_dir=log_tsn main.py --train_dali -c configs/recognition/tsn/tsn_dali.yaml -o log_level="INFO" ``` -------------------------------- ### Including Third-Party Libraries Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_infer/CMakeLists.txt This snippet adds include directories for various third-party libraries that are part of the PaddlePaddle installation, such as Protobuf, Glog, Gflags, XXHash, Zlib, Boost, and Eigen3, ensuring their headers are accessible during compilation. ```CMake include_directories("${PADDLE_LIB}/third_party/install/protobuf/include") include_directories("${PADDLE_LIB}/third_party/install/glog/include") include_directories("${PADDLE_LIB}/third_party/install/gflags/include") include_directories("${PADDLE_LIB}/third_party/install/xxhash/include") include_directories("${PADDLE_LIB}/third_party/install/zlib/include") include_directories("${PADDLE_LIB}/third_party/boost") include_directories("${PADDLE_LIB}/third_party/eigen3") ``` -------------------------------- ### Starting YOWO Training on UCF101-24 (Python) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/localization/yowo.md This command initiates the training process for the YOWO model on the UCF101-24 dataset using a single GPU. It utilizes the configuration defined in `configs/localization/yowo.yaml`, enables validation during training, and sets a random seed for reproducibility. ```python python3 main.py -c configs/localization/yowo.yaml --validate --seed=1 ``` -------------------------------- ### Executing PaddleVideo Data Download and Benchmark Script (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/benchmark/TimeSformer/README.md This command initiates the `run_all.sh` script with the `down_data` argument. This script automates the process of navigating directories, switching branches, installing dependencies, downloading and extracting the UCF101 dataset, downloading pre-trained weights, and finally executing benchmark scripts with various parameters. ```Bash bash ./run_all.sh down_data ``` -------------------------------- ### Running ppvideo with ppTSM_v2 Model (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/quick_start.md This command executes the `ppvideo` tool for video classification using the `ppTSM_v2` model. It specifies 16 segments for frame extraction, processes videos from the 'data/mp4' directory in batches of 2, and outputs the top 5 predicted classes and their scores. ```bash ppvideo --model_name='ppTSM_v2' --num_seg=16 --video_file="data/mp4" --batch_size=2 --top_k=5 ``` -------------------------------- ### Starting PaddleServing Docker Containers Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme_en.md These commands pull and run PaddleServing Docker images for both GPU (CUDA 10.2) and CPU environments. They expose port 9292 and provide interactive shell access to the containers for further setup, enabling a consistent deployment environment. ```bash # start GPU docker docker pull paddlepaddle/serving:0.7.0-cuda10.2-cudnn7-devel nvidia-docker run -p 9292:9292 --name test -dit paddlepaddle/serving:0.7.0-cuda10.2-cudnn7-devel bash nvidia-docker exec -it test bash # start CPU docker docker pull paddlepaddle/serving:0.7.0-devel docker run -p 9292:9292 --name test -dit paddlepaddle/serving:0.7.0-devel bash docker exec -it test bash ``` -------------------------------- ### Downloading Test Video with wget (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/localization/yowo.md This command downloads the `HorseRiding.avi` test video from a specified URL. The `-nc` flag ensures that the file is not re-downloaded if it already exists. The downloaded video is a prerequisite for running the inference examples and should be placed in the `data/ucf24` directory. ```bash wget -nc https://videotag.bj.bcebos.com/Data/HorseRiding.avi ``` -------------------------------- ### Building a Registered Module in Python Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/zh-CN/contribute/config.md This snippet illustrates how to retrieve and instantiate a registered module using the `Builder` concept. It fetches the `ResNet` class from the `BACKBONES` registry using its string name and then immediately calls it to create an instance. This demonstrates the core of the dependency injection mechanism, allowing modules to be created dynamically based on configuration. ```Python backbone_name = "ResNet" b = BACKBONES.get(backbone_name)() ``` -------------------------------- ### Basic Class Instantiation - Python Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/tutorials/config.md This snippet demonstrates a traditional way of instantiating a class directly. It highlights how direct instantiation can lead to tight coupling as the number of classes grows, motivating the need for a more flexible design. ```Python class TSM(): pass model = TSM(init_attributes) ``` -------------------------------- ### Processing CTR-GCN Skeleton Data (Python Scripts) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/dataset/ntu-rgbd.md This sequence of commands navigates to the dataset directory and executes Python scripts to prepare the raw NTU-RGB+D skeleton data for CTR-GCN. It involves getting raw skeleton data, removing bad skeletons (denoising), and transforming the skeleton data to a consistent format. ```bash cd ./data/ntu-rgb-d python get_raw_skes_data.py python get_raw_denoised_data.py python seq_transformation.py ``` -------------------------------- ### Starting ADDS-DepthNet Training (Python/Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/estimation/adds.md This command initiates the training process for the ADDS-DepthNet model on the Oxford RobotCar dataset using a single GPU. It runs `main.py` with validation enabled, specifies the configuration file `adds.yaml`, and sets a random seed for reproducibility. ```bash python3.7 main.py --validate -c configs/estimation/adds/adds.yaml --seed 20 ``` -------------------------------- ### Starting Ma-Net Model Testing Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/applications/EIVideo/EIVideo/docs/en/manet.md This command executes the testing phase for the Ma-Net model. It uses `main.py` with the `--test` flag, specifies the configuration file `configs/localization/bmn.yaml`, loads model weights from `output/BMN/BMN_epoch_00009.pdparams` using `-w`, and overrides the test batch size to 1. ```bash python main.py --test -c configs/localization/bmn.yaml -w output/BMN/BMN_epoch_00009.pdparams -o DATASET.test_batch_size=1 ``` -------------------------------- ### Installing TransNetV2 Dependencies - Bash Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/partition/transnetv2.md This command installs the `ffmpeg-python` library, a required dependency for running TransNetV2. It ensures the correct version `0.2.0` is installed using pip. ```bash python -m pip install ffmpeg-python==0.2.0 ``` -------------------------------- ### Example Inference Output from C++ Serving (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme.md This snippet displays the typical output observed in the command line after a successful model inference request. It includes service logs, performance metrics (client and server costs), and the final prediction results from the model. ```bash I0510 04:33:00.110025 37097 naming_service_thread.cpp:202] brpc::policy::ListNamingService("127.0.0.1:9993"): added 1 I0510 04:33:01.904764 37097 general_model.cpp:490] [client]logid=0,client_cost=1640.96ms,server_cost=1623.21ms. {'class_id': '[5]', 'prob': '[0.9907387495040894]'} ``` -------------------------------- ### Example Video Segment Score and Timing Data - Python Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/results/BMN/python_ppvideo_BMN_results_fp16.txt These snippets show individual Python dictionaries, each representing a detected event or segment in a video. The 'score' key indicates the confidence level of the detection, while the 'segment' key provides a list containing the start and end times (in seconds) of the detected segment. This format is common for storing results from video analysis algorithms. ```Python {'score': 0.7967117428779602, 'segment': [0.0, 122.9877]} ``` ```Python {'score': 0.49079903960227966, 'segment': [12.423000000000002, 124.23]} ``` ```Python {'score': 0.21400144696235657, 'segment': [39.7536, 122.9877]} ``` ```Python {'score': 0.210616335272789, 'segment': [0.0, 109.3224]} ``` ```Python {'score': 0.06873712688684464, 'segment': [23.6037, 114.2916]} ``` -------------------------------- ### Installing PaddlePaddle CPU Version Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_serving_infer_python.md This command installs the CPU-only version of PaddlePaddle (version 2.2.0) using pip. This is a prerequisite for running CPU-based model serving tests. Users who already have PaddlePaddle 2.2 or newer installed can skip this step. ```bash python3.7 -m pip install paddlepaddle==2.2.0 ``` -------------------------------- ### Installing PaddlePaddle GPU Version Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/test_tipc/docs/test_serving_infer_python.md This command installs the GPU-enabled version of PaddlePaddle (version 2.2.0) using pip. This is a prerequisite for running GPU-accelerated model serving tests. Users who already have PaddlePaddle 2.2 or newer installed can skip this step. ```bash python3.7 -m pip install paddlepaddle-gpu==2.2.0 ``` -------------------------------- ### Launching Distributed Training of ActBERT on HowTo100M Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/multimodal/actbert.md This command initiates the distributed training of the ActBERT model on the HowTo100M dataset using PaddlePaddle. It utilizes 8 GPUs (0-7), logs output to `log_actbert`, enables validation, and uses the configuration file `configs/multimodal/actbert/actbert.yaml`. ```bash python3.7 -B -m paddle.distributed.launch --gpus="0,1,2,3,4,5,6,7" --log_dir=log_actbert main.py --validate -c configs/multimodal/actbert/actbert.yaml ``` -------------------------------- ### Installing PaddleServing Python Packages Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/python_serving/readme_en.md These commands install necessary Python packages for PaddleServing within the Docker environment, including client, app, faiss-cpu, and specific server/paddlepaddle versions for CPU or various GPU configurations (CUDA 10.1, 10.2, 11.2). The installation speed can be improved by changing the pip source. ```bash python3.7 -m pip install paddle-serving-client==0.7.0 python3.7 -m pip install paddle-serving-app==0.7.0 python3.7 -m pip install faiss-cpu==1.7.1post2 #If it is a CPU deployment environment: python3.7 -m pip install paddle-serving-server==0.7.0 #CPU python3.7 -m pip install paddlepaddle==2.2.0 # CPU #If it is a GPU deployment environment python3.7 -m pip install paddle-serving-server-gpu==0.7.0.post102 # GPU with CUDA10.2 + TensorRT6 python3.7 -m pip install paddlepaddle-gpu==2.2.0 # GPU with CUDA10.2 #Other GPU environments need to confirm the environment and then choose which one to execute python3.7 -m pip install paddle-serving-server-gpu==0.7.0.post101 # GPU with CUDA10.1 + TensorRT6 python3.7 -m pip install paddle-serving-server-gpu==0.7.0.post112 # GPU with CUDA11.2 + TensorRT8 ``` -------------------------------- ### Installing Required Python Dependencies for ActBERT Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/multimodal/actbert.md This snippet installs the necessary Python packages, `paddlenlp` and `lmdb`, which are prerequisites for running the ActBERT model and related scripts. ```bash python -m pip install paddlenlp python -m pip install lmdb ``` -------------------------------- ### Downloading Calibration Data for Offline Quantization Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/slim/readme_en.md These commands download a small dataset (`k400_rawframes_small.tar`) for model calibration, which is essential for offline quantization. The data is extracted into the `./data/k400` directory, preparing the environment for the quantization process. ```Bash pushd ./data/k400 wget -nc https://videotag.bj.bcebos.com/Data/k400_rawframes_small.tar tar -xf k400_rawframes_small.tar popd ``` -------------------------------- ### Implementing a Custom Learning Rate Scheduler (Python) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/zh-CN/contribute/add_new_algorithm.md This Python code provides a template for creating a custom learning rate scheduler by inheriting from LRScheduler. It includes an __init__ method for initialization and a step method to define the learning rate adjustment logic per epoch. This allows users to implement bespoke learning rate decay strategies not natively included in PaddleVideo. ```Python class MyLR(LRScheduler): def __init__(self, *args, **kwargs): self.learning_rate = learning_rate def step(self, epoch): # learning rate step scheduler self.last_lr = xxx ``` -------------------------------- ### Training BMN Model (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/applications/FootballAction/README.md Launches the BMN model training process using `paddle.distributed.launch` for multi-GPU training. It specifies the GPUs to use, log directory, enables validation, and points to the BMN configuration file and output directory for saving model checkpoints. ```Bash python -B -m paddle.distributed.launch \ --gpus="0,1" \ --log_dir=./football/logs_bmn \ main.py \ --validate \ -c applications/FootballAction/train_proposal/configs/bmn_football_v2.0.yaml \ -o output_dir=./football/bmn ``` -------------------------------- ### Installing Scikit-image Dependency Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/applications/EIVideo/EIVideo/docs/en/manet.md This command installs the `scikit-image` Python library using `pip`. It is a required additional dependency for running the Ma-Net project, ensuring all necessary image processing functionalities are available. ```bash python -m pip install scikit-image ``` -------------------------------- ### Launching Model Evaluation (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/zh-CN/contribute/add_new_algorithm.md This Bash command is used to run the model in evaluation (test) mode within PaddleVideo. It invokes main.py with the --test flag, specifies the configuration file using -c, and provides the path to the trained model weights using -w. This command is essential for assessing the performance of a trained model. ```Bash python3.7 main.py --test -c config_path/your_config.yaml -w weight_path/your_weight.pdparams ``` -------------------------------- ### Example Inference Output Logs (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/segmentation/mstcn.md This snippet shows an example of the output logs generated during the inference process, indicating where the prediction results for each input file are written. ```bash result write in : ./inference/infer_results/S1_Cheese_C1.txt result write in : ./inference/infer_results/S1_CofHoney_C1.txt result write in : ./inference/infer_results/S1_Coffee_C1.txt result write in : ./inference/infer_results/S1_Hotdog_C1.txt result write in : ./inference/infer_results/S1_Pealate_C1.txt result write in : ./inference/infer_results/S1_Peanut_C1.txt result write in : ./inference/infer_results/S1_Tea_C1.txt ``` -------------------------------- ### Download Original Raw ADDS Day Training Data - Shell Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/dataset/Oxford_RobotCar.md This snippet lists the download links for the original raw ADDS dataset's day training data, split into multiple 7z archive parts. These files contain the raw images that require further preprocessing steps like de-distortion and dynamic frame filtering. ```Shell # data in day https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.001 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.002 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.003 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.004 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.005 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.006 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.007 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.008 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.009 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.010 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.011 https://videotag.bj.bcebos.com/Data/original-ADDS/day_train_all.7z.012 ``` -------------------------------- ### PaddleServing Model Directory Structure (Bash) Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/cpp_serving/readme_en.md This snippet illustrates the expected directory structure after a successful model conversion using `paddle_serving_client.convert`. It shows the generated `ppTSM_serving_client` and `ppTSM_serving_server` folders, containing the necessary configuration files and the converted model files for deployment. ```bash PaddleVideo/deploy/cpp_serving ├── ppTSM_serving_client │ ├── serving_client_conf.prototxt │ └── serving_client_conf.stream.prototxt └── ppTSM_serving_server ├── ppTSM.pdiparams ├── ppTSM.pdmodel ├── serving_server_conf.prototxt └── serving_server_conf.stream.prototxt ``` -------------------------------- ### Example of MoViNet Test Accuracy Log Output Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/docs/en/model_zoo/recognition/movinet.md This snippet shows an example of the output found in training logs, indicating the highest Top-1 accuracy achieved by the model during training, typically marked by the keyword 'best'. ```text Already save the best model (top1 acc)0.6489 ``` -------------------------------- ### Installing Paddle2ONNX Source: https://github.com/paddlepaddle/paddlevideo/blob/develop/deploy/paddle2onnx/readme.md This command installs the Paddle2ONNX library using pip, which is required for converting PaddlePaddle models to ONNX format. It specifies Python 3.7 and recommends using a specific Python version. ```bash python3.7 -m pip install paddle2onnx ```