### Install LabelImg with Anaconda Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/data/DetAnnoTools_en.md Recommended installation using Anaconda. Install PyQt5 and lxml, generate resources, and then run LabelImg. ```bash conda install pyqt=5 conda install -c anaconda lxml pyrcc5 -o libs/resources.py resources.qrc python labelImg.py python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] ``` -------------------------------- ### Compile C++ Deployment Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/rockchip/rv1126/cpp/README.md Compiles the C++ deployment example using CMake. It requires specifying the toolchain file and FastDeploy installation directory. The `make install` command generates an 'install' folder with the demo and necessary libraries. ```bash cd PaddleDetection/deploy/fastdeploy/rockchip/rv1126/cpp mkdir build && cd build cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../fastdeploy-timvx/toolchain.cmake -DFASTDEPLOY_INSTALL_DIR=${PWD}/../fastdeploy-timvx -DTARGET_ABI=armhf .. make -j8 make install ``` -------------------------------- ### Compile PaddleDetection RKNPU2 C++ Deployment Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/rockchip/rknpu2/cpp/README.md Clone the repository, navigate to the C++ deployment directory, and compile the example using CMake. Ensure FastDeploy is installed or available. ```bash git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/rockchip/rknpu2/cpp # 注意:如果当前分支找不到下面的fastdeploy测试代码,请切换到develop分支 # git checkout develop # 编译部署示例 mkdir build && cd build cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-x.x.x make -j8 ``` -------------------------------- ### Install LabelMe on Ubuntu Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/data/KeyPointAnnoTools_en.md Use apt-get or pip for installation on Ubuntu. Standalone executables are also available. ```bash sudo apt-get install labelme # or sudo pip3 install labelme # or install standalone executable from: # https://github.com/wkentaro/labelme/releases ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt Initiates training using FPGM (Frequency-based Pruning Guided Magnitude) with a specified configuration and slim configuration template. ```bash tools/train.py -c configs/ppyoloe/ppyoloe_crn_s_300e_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco_train_infer_python.txt Starts training with PACT (Quantization-Aware Training) optimization. This requires a specific slim configuration template. ```bash tools/train.py -c configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.yml --slim_config _template_pact -o ``` -------------------------------- ### Start Quantization Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/picodet/README.md Initiate the quantization training process using the provided configuration files. This command starts training and evaluation. ```shell python tools/train.py -c configs/picodet/picodet_s_416_coco_lcnet.yml \ --slim_config configs/slim/quant/picodet_s_416_lcnet_quant.yml --eval ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/retinanet/retinanet_r50_fpn_1x_coco_train_infer_python.txt Starts training using FPGM pruning. Requires the `_template_fpgm` slim configuration. ```bash tools/train.py -c configs/retinanet/retinanet_r50_fpn_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt Starts training with PACT (Pruning Aware Compression Training) using a specific configuration and slim configuration template. ```bash tools/train.py -c configs/ppyoloe/ppyoloe_crn_s_300e_coco.yml --slim_config _template_pact -o ``` -------------------------------- ### Install LabelMe with Anaconda Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/data/KeyPointAnnoTools_en.md Recommended installation using Anaconda for Python environment management. ```bash conda create –name=labelme python=3 conda activate labelme pip install pyqt5 pip install labelme ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt Starts training with FPGM (Filter Pruning by Global Magnitude) optimization. Uses a dedicated slim configuration template. ```bash tools/train.py -c configs/deformable_detr/deformable_detr_r50_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/vitdet/ppyoloe_vit_base_csppan_cae_36e_coco_train_infer_python.txt Starts training with FPGM (Frequency-based Pruning for General Models) optimization. This method requires a corresponding slim configuration. ```bash tools/train.py -c configs/vitdet/ppyoloe_vit_base_csppan_cae_36e_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Install Python Requirements Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/third_engine/demo_avh/README.md Installs necessary Python libraries for the demo. Run this from the directory containing requirements.txt. ```bash pip install -r ./requirements.txt ``` -------------------------------- ### Start FPGM Quantization Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/faster_rcnn/faster_rcnn_swin_tiny_fpn_1x_coco_train_infer_python.txt Starts training using FPGM quantization. Similar to PACT, it uses a specific slim configuration and supports parameter overrides. ```bash tools/train.py -c configs/faster_rcnn/faster_rcnn_swin_tiny_fpn_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt Starts training with FPGM (Filter Pruning with Gradient Matching). This method requires a specific slim configuration and parameter overrides. ```bash tools/train.py -c configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Install LabelMe on macOS Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/data/KeyPointAnnoTools_en.md Install using Homebrew and pip, or use the command-line interface/app. Standalone executables are also available. ```bash brew install pyqt # maybe pyqt5 pip install labelme # or brew install wkentaro/labelme/labelme # command line interface # brew install --cask wkentaro/labelme/labelme # app # or install standalone executable/app from: # https://github.com/wkentaro/labelme/releases ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt Starts training with the FPGM (Filter Pruning based on Gradient Magnitude) method. This requires a specific slim configuration template. ```bash tools/train.py -c configs/picodet/picodet_s_320_coco_lcnet.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt Starts training using FPGM (Filter Pruning via Global Magnitude) for model compression. A specific slim configuration template is needed. ```bash tools/train.py -c configs/gfl/gfl_r50_fpn_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt Starts training with the FPGM (Filter Pruning by Global Magnitude) technique. This method requires a corresponding slim configuration. ```bash tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/keypoint/dark_hrnet_w32_256x192_train_infer_python.txt Starts training with PACT (Quantization-Aware Training) optimization. This is useful for models that require post-training quantization. ```bash tools/train.py -c configs/keypoint/hrnet/dark_hrnet_w32_256x192.yml --slim_config _template_pact -o ``` -------------------------------- ### Compile and Run Ascend C++ Deployment Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/ascend/cpp/README.md This bash script demonstrates downloading the deployment example code, compiling it with FastDeploy for Ascend, and then running inference with a pre-trained PPYOLOE model on an image. ```bash # Download deployment example code git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/cpu-gpu/cpp/ascend/cpp # Note: If the fastdeploy test code below is not found in the current branch, please switch to the develop branch # git checkout develop mkdir build cd build # Compile infer_demo using the compiled FastDeploy library cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-ascend make -j # Download model files and test image wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # Huawei Ascend inference ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg ``` -------------------------------- ### Clone PaddleClas Repository Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/advanced_tutorials/customization/pphuman_attribute_en.md Use this command to download the necessary training code from the PaddleClas GitHub repository. Refer to the installation guide for environmental setup. ```bash git clone https://github.com/PaddlePaddle/PaddleClas ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt Begins training with PACT (Post-training Quantization) optimization. Requires a slim configuration template for PACT. ```bash tools/train.py -c configs/dino/dino_r50_4scale_1x_coco.yml --slim_config _template_pact -o ``` -------------------------------- ### Install PaddlePaddle and PaddleDetection Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED_en.md Install PaddlePaddle with CUDA support or CPU version, clone the PaddleDetection repository, and install its dependencies. Ensure you have the correct PaddlePaddle version for your CUDA setup. ```bash # PaddlePaddle CUDA10.1 python -m pip install paddlepaddle-gpu==2.2.2.post101 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html # PaddlePaddle CPU python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple # Clone PaddleDetectionrepositories cd git clone https://github.com/PaddlePaddle/PaddleDetection.git # Installing dependencies cd PaddleDetection pip install -r requirements.txt ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/keypoint/tinypose_128x96_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt Starts training with the FPGM (Filter Pruning by Global Magnitude) technique. This method uses a dedicated slim configuration template. ```bash tools/train.py -c test_tipc/configs/keypoint/tinypose_128x96.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Install PaddleSlim via Pip Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/slim/README.md Install PaddleSlim using pip for quick setup. Ensure your environment meets the version requirements. ```shell pip install paddleslim -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt Starts training using FPGM (Frequency-based Pruning) for model compression. This method requires a specific slim configuration for FPGM. ```bash tools/train.py -c configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt Initiates training with PACT (Quantization-Aware Training) optimization. Requires a specific slim configuration template. ```bash tools/train.py -c configs/deformable_detr/deformable_detr_r50_1x_coco.yml --slim_config _template_pact -o ``` -------------------------------- ### Compile FastDeploy C++ Deployment Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/amlogic/a311d/cpp/README.md Compile the C++ deployment example for A311D using CMake, specifying the toolchain file and FastDeploy installation directory. ```bash cd PaddleDetection/deploy/fastdeploy/amlogic/a311d/cpp mkdir build && cd build cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../fastdeploy-timvx/toolchain.cmake -DFASTDEPLOY_INSTALL_DIR=${PWD}/../fastdeploy-timvx -DTARGET_ABI=arm64 .. make -j8 make install ``` -------------------------------- ### Compile and Run Object Detection Example (Linux) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/cpu-gpu/cpp/README.md This snippet covers downloading FastDeploy, cloning the PaddleDetection repository, compiling the C++ deployment example, downloading a PPYOLOE model and test image, and running inference on CPU, GPU, and GPU with TensorRT. ```bash # Download FastDeploy pre-compiled library, users can choose a suitable version from the `FastDeploy pre-compiled library` mentioned above wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-gpu-x.x.x.tgz tar xvf fastdeploy-linux-x64-gpu-x.x.x.tgz # Download deployment example code git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/cpu-gpu/cpp # Note: If the current branch does not find the fastdeploy test code below, please switch to the develop branch # git checkout develop # Compile deployment example mkdir build && cd build mv ../fastdeploy-linux-x64-gpu-x.x.x . cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-gpu-x.x.x make -j # Download PPYOLOE model file and test image wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # Run deployment example # CPU inference ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg 0 # GPU inference ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg 1 # Paddle-TensorRT inference on GPU (Note: The first run of TensorRT inference involves model serialization, which takes some time, please be patient) ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg 2 ``` -------------------------------- ### Install External Operators (Windows) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/rotate/README_en.md Steps to install external operators on Windows, requiring Visual Studio 2015 Update 3 or later. Set the DISTUTILS_USE_SDK environment variable and then run the setup script. ```bash set DISTUTILS_USE_SDK=1 python setup.py install ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt Begins training using the PACT (Quantization-Aware Training) method. This requires a specific slim configuration file for PACT. ```bash tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --slim_config _template_pact -o ``` -------------------------------- ### Send gRPC Request to the Inference Server Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/serving/README.md Install the Triton client library and use a Python script to send a gRPC request to the running inference server. This example assumes the client script is named `paddledet_grpc_client.py`. ```bash #下载测试图片 wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg #安装客户端依赖 python3 -m pip install tritonclient[all] # 发送请求 python3 paddledet_grpc_client.py ``` -------------------------------- ### Build PicoDet Demo (Windows) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/third_engine/demo_openvino/README.md Build the PicoDet demo application on Windows using CMake and MSBuild. Ensure OpenVINO environment variables are set. ```cmd \openvino_2021\bin\setupvars.bat mkdir -p build cd build cmake .. msbuild picodet_demo.vcxproj /p:configuration=release /p:platform=x64 ``` -------------------------------- ### Configure Demo Parameters in main.cpp Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/third_engine/demo_openvino_kpts/README.md Set the image size and initialize detector objects in `main.cpp`. Ensure the paths to the OpenVINO models are correct. ```cpp #define image_size 416 cv::Mat image(256, 192, CV_8UC3, cv::Scalar(1, 1, 1)); std::vector center = {128, 96}; std::vector scale = {256, 192}; auto detector = PicoDet("../weight/picodet_m_416.xml"); auto kpts_detector = new KeyPointDetector("../weight/tinypose256.xml", -1, 256, 192); ``` -------------------------------- ### Install PaddlePaddle GPU Version Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/INSTALL_cn.md Installs the GPU-enabled version of PaddlePaddle. Ensure CUDA 10.2 is installed. ```bash python -m pip install paddlepaddle-gpu==2.3.2 -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -------------------------------- ### Clone and Install PaddleDetection Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/pipeline/docs/tutorials/PPHuman_QUICK_STARTED_en.md Clones the PaddleDetection repository and installs its dependencies. Navigate to the cloned directory before installing. ```bash cd git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection pip install -r requirements.txt ``` -------------------------------- ### Compile and Run Keypoint Detection Example (Linux) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/cpu-gpu/cpp/README.md This snippet details the process for keypoint detection, including downloading FastDeploy, cloning the repository, compiling the C++ example, obtaining a PP-TinyPose model and test image, and executing inference on CPU, GPU, and GPU with TensorRT. ```bash # Download FastDeploy pre-compiled library, users can choose a suitable version from the `FastDeploy pre-compiled library` mentioned above wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-gpu-x.x.x.tgz tar xvf fastdeploy-linux-x64-gpu-x.x.x.tgz # Download deployment example code git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/cpu-gpu/cpp # Note: If the current branch does not find the fastdeploy test code below, please switch to the develop branch # git checkout develop # Compile deployment example mkdir build && cd build mv ../fastdeploy-linux-x64-gpu-x.x.x . cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-gpu-x.x.x make -j # Download PP-TinyPose model file and test image wget https://bj.bcebos.com/paddlehub/fastdeploy/PP_TinyPose_256x192_infer.tgz tar -xvf PP_TinyPose_256x192_infer.tgz wget https://bj.bcebos.com/paddlehub/fastdeploy/hrnet_demo.jpg # Run deployment example # CPU inference ./infer_tinypose_demo PP_TinyPose_256x192_infer hrnet_demo.jpg 0 # GPU inference ./infer_tinypose_demo PP_TinyPose_256x192_infer hrnet_demo.jpg 1 # Paddle-TensorRT inference on GPU (Note: The first run of TensorRT inference involves model serialization, which takes some time, please be patient) ./infer_tinypose_demo PP_TinyPose_256x192_infer hrnet_demo.jpg 2 ``` -------------------------------- ### Install MOT Dependencies Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/mot/README_en.md Installs necessary Python packages for MOT functionality. Ensure ffmpeg is installed separately. ```bash pip install lap motmetrics sklearn ``` ```bash pip install -r requirements.txt ``` -------------------------------- ### Start Model Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/advanced_tutorials/customization/action_recognotion/skeletonbased_rec_en.md Execute this command from the root of the PaddleVideo directory to begin model training. Ensure the configuration file path is correct. ```bash python main.py -c applications/PPHuman/configs/stgcn_pphuman.yaml ``` -------------------------------- ### Compile and Run Object Detection Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/kunlunxin/cpp/README.md This bash script demonstrates how to clone the repository, compile the C++ deployment example for object detection using FastDeploy on Kunlunxin XPU, download a PPYOLOE model and test image, and then run the inference. ```bash # Download deployment example code git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/kunlunxin/cpp # Note: If the current branch does not find the fastdeploy test code below, please switch to the develop branch # git checkout develop # Compile deployment example mkdir build cd build # Compile infer_demo using the compiled FastDeploy library cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-kunlunxin make -j # Download PPYOLOE model file and test image wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # Run deployment example ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_s_80e_coco_train_infer_python.txt Initiates training with FPGM quantization. This method requires a specific slim configuration. ```bash tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_s_80e_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Install PaddlePaddle and PaddleDetection Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED.md Installs PaddlePaddle (GPU or CPU) and clones the PaddleDetection repository. Also installs other necessary dependencies. ```bash # PaddlePaddle CUDA10.1 python -m pip install paddlepaddle-gpu==2.2.2.post101 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html # PaddlePaddle CPU python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple # 克隆PaddleDetection仓库 cd git clone https://github.com/PaddlePaddle/PaddleDetection.git # 安装其他依赖 cd PaddleDetection pip install -r requirements.txt ``` -------------------------------- ### Install ADB Tools Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/rockchip/rv1126/cpp/CMakeLists.txt Installs the ADB tools, specifically the 'run_with_adb.sh' script, to the root of the installation directory. This is used for running inference on Android devices. ```cmake file(GLOB ADB_TOOLS run_with_adb.sh) install(PROGRAMS ${ADB_TOOLS} DESTINATION ./) ``` -------------------------------- ### Start Normal Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt Use this command to initiate the standard training process. Ensure the configuration file path and any necessary overrides are correctly specified. ```bash tools/train.py -c configs/ppyolo/ppyolo_tiny_650e_coco.yml -o ``` -------------------------------- ### Installation Configuration for PaddleDetection Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/rockchip/rv1126/cpp/CMakeLists.txt Configures the installation directory and installs the inference executable, models, images, and shared libraries. This ensures all necessary components are deployed correctly. ```cmake set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/build/install) install(TARGETS infer_demo DESTINATION ./) install(DIRECTORY models DESTINATION ./) install(DIRECTORY images DESTINATION ./) file(GLOB_RECURSE FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/lib*.so*) file(GLOB_RECURSE ALL_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/lib*.so*) list(APPEND ALL_LIBS ${FASTDEPLOY_LIBS}) install(PROGRAMS ${ALL_LIBS} DESTINATION lib) ``` -------------------------------- ### Compile and Run Keypoint Detection Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/kunlunxin/cpp/README.md This bash script shows how to download FastDeploy pre-compiled libraries, clone the PaddleDetection repository, compile the C++ keypoint detection example for Kunlunxin XPU, download a PP-TinyPose model and test image, and then run the inference. ```bash # Download FastDeploy pre-compiled library, users can choose a suitable version from the 'FastDeploy pre-compiled library' mentioned above wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-gpu-x.x.x.tgz tar xvf fastdeploy-linux-x64-gpu-x.x.x.tgz # Download deployment example code git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/kunlunxin/cpp # Note: If the current branch does not find the fastdeploy test code below, please switch to the develop branch # git checkout develop # Compile deployment example mkdir build && cd build mv ../fastdeploy-linux-x64-gpu-x.x.x . cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-gpu-x.x.x make -j # Download PP-TinyPose model file and test image wget https://bj.bcebos.com/paddlehub/fastdeploy/PP_TinyPose_256x192_infer.tgz tar -xvf PP_TinyPose_256x192_infer.tgz wget https://bj.bcebos.com/paddlehub/fastdeploy/hrnet_demo.jpg # Run deployment example ./infer_tinypose_demo PP_TinyPose_256x192_infer hrnet_demo.jpg ``` -------------------------------- ### Compile and Install PaddleDetection Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/INSTALL_cn.md Builds and installs the PaddleDetection package. ```bash python setup.py install ``` -------------------------------- ### Install PaddleDetection Dependencies Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/docs/test_train_inference_python.md Install PaddlePaddle and PaddleDetection dependencies using pip. Ensure PaddlePaddle version is 2.2 or higher. For model compression features, install PaddleSlim. ```shell pip install -r ./requirements.txt pip install -r ./test_tipc/requirements.txt ``` ```shell pip install paddleslim ``` -------------------------------- ### Install PaddleSeg environment Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/advanced_tutorials/customization/ppvehicle_violation_en.md Install the required dependencies for the PaddleSeg environment. ```bash cd PaddleSeg pip install -r requirements.txt ``` -------------------------------- ### Start Web Service Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt Launch the PaddleDetection web service for inference. Configure the model directory and device options. ```bash deploy/serving/python/web_service.py --config=deploy/serving/python/config.yml --model_dir=./output_inference --opt=cpu:op.ppdet.local_service_conf.device_type=0|gpu:op.ppdet.local_service_conf.device_type=1 ``` -------------------------------- ### Install AutoLog for Standardized Log Output Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/docs/test_train_inference_python.md Clone the AutoLog repository, install its requirements, build the wheel, and then install the wheel package. This tool helps standardize log output. ```shell git clone https://github.com/LDOUBLEV/AutoLog cd AutoLog pip install -r ./requirements.txt python setup.py bdist_wheel pip install ./dist/auto_log-1.0.0-py3-none-any.whl ``` -------------------------------- ### Start Web Service Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_KL_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt Launches a web service for model inference. Requires a configuration file and specifies model directory and optimization options. ```bash deploy/serving/python/web_service.py --config=deploy/serving/python/config.yml --model_dir:null --opt:cpu:op.ppdet.local_service_conf.device_type=0|gpu:op.ppdet.local_service_conf.device_type=1 ``` -------------------------------- ### Install pycocotools for Windows Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/INSTALL_cn.md Installs a third-party version of pycocotools compatible with Windows. ```bash pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI ``` -------------------------------- ### Start Quantization Aware Training (QAT) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_FPGM_train_infer_python.txt Begins training with quantization awareness, typically used for optimizing models for deployment. Requires a specific slim configuration for QAT. ```bash tools/train.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml --slim_config configs/slim/quant/ppyolo_mbv3_large_qat.yml -o ``` -------------------------------- ### Start Single-card Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/advanced_tutorials/customization/pphuman_mtmct_en.md Begin training on a single GPU using the specified configuration file. ```bash #Single card training python3 tools/train.py \ -c ./ppcls/configs/reid/strong_baseline/softmax_triplet_with_center.yaml ``` -------------------------------- ### Verify PaddlePaddle Installation Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/INSTALL_cn.md Confirms that PaddlePaddle has been successfully installed and checks its version. ```python import paddle paddle.utils.run_check() ``` ```python python -c "import paddle; print(paddle.__version__)" ``` -------------------------------- ### Install PaddleDetection Dependencies Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/INSTALL_cn.md Installs the required Python packages listed in the requirements.txt file. ```bash cd PaddleDetection pip install -r requirements.txt ``` -------------------------------- ### Start PACT Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt Initiates training using the PACT quantization method. This requires a specific slim configuration file and overrides for the training parameters. ```bash tools/train.py -c configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml --slim_config _template_pact -o ``` -------------------------------- ### Install PaddlePaddle Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/advanced_tutorials/openvino_inference/README_cn.md Install PaddlePaddle using conda. Ensure you have the correct version specified. ```bash conda install paddlepaddle==2.2.2 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/ ``` -------------------------------- ### Install External Operators (Linux) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/rotate/README_en.md Compile and install external operators required for training and evaluation of rotated object detection models on Linux systems. Navigate to the 'ppdet/ext_op' directory before running the install command. ```bash cd ppdet/ext_op python setup.py install ``` -------------------------------- ### Download and Prepare PaddleDetection Deployment Files Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/serving/README.md Clone the repository, download model files and test images, and organize them into the required directory structure for service deployment. This includes moving configuration files and model weights to their respective locations. ```bash git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/serving #下载PPYOLOE模型文件和测试图片 wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # 将配置文件放入预处理目录 mv ppyoloe_crn_l_300e_coco/infer_cfg.yml models/preprocess/1/ # 将模型放入 models/runtime/1目录下, 并重命名为model.pdmodel和model.pdiparams mv ppyoloe_crn_l_300e_coco/model.pdmodel models/runtime/1/model.pdmodel mv ppyoloe_crn_l_300e_coco/model.pdiparams models/runtime/1/model.pdiparams # 将ppdet和runtime中的ppyoloe配置文件重命名成标准的config名字 # 其他模型比如faster_rcc就将faster_rcnn_config.pbtxt重命名为config.pbtxt cp models/ppdet/ppyoloe_config.pbtxt models/ppdet/config.pbtxt cp models/runtime/ppyoloe_runtime_config.pbtxt models/runtime/config.pbtxt # 注意: 由于mask_rcnn模型多一个输出,需要将后处理目录(models/postprocess)中的mask_config.pbtxt重命名为config.pbtxt ``` -------------------------------- ### Install VisualDL Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/logging_en.md Install the VisualDL library using pip. This is required for logging metrics to VisualDL. ```bash pip install visualdl ``` -------------------------------- ### Install PaddleLite Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/picodet/README_en.md Install the PaddleLite library using pip. Ensure you have version 2.10 or later. ```shell pip install paddlelite ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt Begin training using FPGM for pruning. Similar to PACT training, it uses a specific slim configuration and supports overrides. ```bash tools/train.py -c configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### Install PaddleDetection Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/picodet/FULL_QUANTIZATION.md Install PaddleDetection, a toolkit for object detection. Ensure version 2.4 or higher. ```shell pip install paddledet ``` -------------------------------- ### Install PaddlePaddle Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/picodet/FULL_QUANTIZATION.md Install PaddlePaddle for CPU or GPU. Ensure you have PaddlePaddle version 2.3 or higher. ```shell # CPU pip install paddlepaddle # GPU pip install paddlepaddle-gpu ``` -------------------------------- ### Install paddle2onnx Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/mask_rtdetr/README_cn.md Installs the paddle2onnx package, which is required for converting PaddlePaddle models to ONNX format. ```bash pip install paddle2onnx ``` -------------------------------- ### Run Ascend Python Deployment Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/ascend/python/README.md This command sequence downloads the PaddleDetection repository, navigates to the Ascend Python deployment directory, fetches necessary model and image files, and then executes the `infer.py` script for Huawei Ascend inference. ```bash git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/ascend/python # 注意:如果当前分支找不到下面的fastdeploy测试代码,请切换到develop分支 # git checkout develop wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # 华为昇腾推理 python infer.py --model_dir ppyoloe_crn_l_300e_coco --image_file 000000014439.jpg ``` -------------------------------- ### Run Keypoint Detection Deployment Example on Kunlunxin XPU Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/kunlunxin/python/README.md Executes the keypoint detection inference script using the downloaded PP-TinyPose model and test image on Kunlunxin hardware. ```bash python pptinypose_infer.py --model_dir PP_TinyPose_256x192_infer --image_file hrnet_demo.jpg ``` -------------------------------- ### Install ONNX Runtime Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/EXPORT_ONNX_MODEL.md Install the ONNX Runtime library, which is used for performing inference with ONNX models. ```bash pip install onnxruntime ``` -------------------------------- ### Install PaddleSlim Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/configs/picodet/FULL_QUANTIZATION.md Install PaddleSlim, a library for model compression and acceleration. Ensure version 2.3 or higher. ```shell pip install paddleslim ``` -------------------------------- ### Start Web Service Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/keypoint/tinypose_128x96_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt Launches the PaddleDetection web service for inference. Requires a configuration file for the service. ```bash deploy/serving/python/web_service.py --config=deploy/serving/python/config.yml --model_dir=null --opt=cpu:op.ppdet.local_service_conf.device_type=0|gpu:op.ppdet.local_service_conf.device_type=1 ``` -------------------------------- ### Start Normal Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/retinanet/retinanet_r50_fpn_1x_coco_train_infer_python.txt Use this command to start the normal training process for a specified model configuration. ```bash tools/train.py -c configs/retinanet/retinanet_r50_fpn_1x_coco.yml -o ``` -------------------------------- ### Start FPGM Training Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco_train_infer_python.txt Initiates training with FPGM (Filter Pruning by Global Magnitude) optimization. This method requires a specific slim configuration template. ```bash tools/train.py -c configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.yml --slim_config _template_fpgm -o ``` -------------------------------- ### HTTP Client Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt Example of using the HTTP client to send an image for inference to the PaddleDetection web service. ```bash deploy/serving/python/pipeline_http_client.py --image_file=./demo/000000014439.jpg ``` -------------------------------- ### Build PicoDet Demo (Linux) Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/third_engine/demo_openvino/README.md Build the PicoDet demo application on Linux using CMake and make. Ensure OpenVINO environment variables are sourced. ```shell source /opt/intel/openvino_2021/bin/setupvars.sh mkdir build cd build cmake .. make ``` -------------------------------- ### Model Switching Example Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/feature_models/PaddleYOLO_MODEL.md Example of how to switch between different models by modifying model name and job name variables. ```bash model_name=yolov7 job_name=yolov7_l_300e_coco ``` -------------------------------- ### Run Web Service Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_model_linux_gpu_normal_normal_serving_python_linux_gpu_cpu.txt Launch a web service for inference. This requires a configuration file and specifies device options for CPU or GPU. ```bash deploy/serving/python/web_service.py --config=deploy/serving/python/config.yml --opt:cpu:op.ppdet.local_service_conf.device_type=0|gpu:op.ppdet.local_service_conf.device_type=1 ``` -------------------------------- ### Install Cython for Older Python Versions Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/docs/tutorials/INSTALL_cn.md Installs Cython, which may be required for pycocotools on Python versions 3.6 or earlier. ```bash pip install cython ``` -------------------------------- ### CMake Project Setup and FastDeploy Integration Source: https://github.com/paddlepaddle/paddledetection/blob/release/2.9/deploy/fastdeploy/rockchip/rv1126/cpp/CMakeLists.txt This snippet sets up a CMake project, includes the FastDeploy SDK, and links it to the main executable. Ensure FASTDEPLOY_INSTALL_DIR is correctly set. ```cmake PROJECT(infer_demo C CXX) CMAKE_MINIMUM_REQUIRED (VERSION 3.10) option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.") include(${FASTDEPLOY_INSTALL_DIR}/FastDeploy.cmake) include_directories(${FASTDEPLOY_INCS}) include_directories(${FastDeploy_INCLUDE_DIRS}) add_executable(infer_demo ${PROJECT_SOURCE_DIR}/infer.cc) target_link_libraries(infer_demo ${FASTDEPLOY_LIBS}) ```