PaddleClas Documentation

repository·release/2.6·Indexed 26 days ago

https://github.com/paddlepaddle/paddleclas

A visual recognition toolkit powered by PaddlePaddle providing tools for image classification. It includes features for benchmarking model performance, deploying models to mobile devices via the Paddle-Lite inference engine, and implementing C++ prediction demos. The library supports service deployment through PaddleHub Serving for both CPU and GPU prediction, as well as model optimization using paddle_lite_opt for mobile deployment.

Tokens
207.8K
Snippets
591
Records
1.1K
Agent score
89%

What's inside PaddleClas

  1. Overview of PaddleClas Code Structure

    release/2.6

    PaddleClas is organized into several key directories that define its functionality:

    • ppcls: The core framework containing training, evaluation, model architectures, and configuration files.
    • tools: Entry point scripts for training, evaluation, inference, and dynamic-to-static export.
    • dataset: Scripts and datasets for processing data into formats suitable for the Dataloader.
    • deploy: Deployment tools supporting Python/C++ inference, Hub Serving, Paddle Lite, and Slim offline quantification.
    • benchmark: Shell scripts for testing speed metrics (single-card and multi-card training).
    • test_tipc: TIPC tests to verify the end-to-end pipeline from training to prediction.
    • requirements.txt: Contains the necessary dependencies for installation via pip.
  2. Overview of PaddleClas

    release/2.6

    PaddleClas is an image classification and image recognition toolset designed for both industry and academia. It provides tools to train high-performance computer vision models and deploy them in real-world scenarios. Key offerings include:

    • PP-ShiTuV2: A practical, lightweight general image recognition system consisting of mainbody detection, feature extraction, and vector search modules. It supports adding new categories without retraining by simply updating the retrieval database.
    • PULC (Practical Ultra Light-weight image Classification solutions): High-speed classification models (inference < 3ms on CPU) using PP-LCNet backbones and knowledge distillation, suitable for edge devices.
    • Model Zoo: A wide variety of backbones (PP-HGNet, PP-LCNet, Swin-transformer, etc.) and pre-trained models for various tasks like pedestrian, vehicle, and OCR recognition.
  3. Overview of ImageNet1k Pre-trained Models

    release/2.6

    PaddleClas provides a comprehensive library of pre-trained models based on the ImageNet1k classification dataset. It supports 37 different network architectures and 217 individual pre-trained models. The library is categorized into:

    • SSLD Knowledge Distillation Models: Includes server-side, mobile, and Intel CPU optimized versions.
    • CNN-based Models:
      • Server-side: High-performance models like PP-HGNet, ResNet, ConvNeXt, etc.
      • Lightweight: Mobile-optimized models like PP-LCNet.
    • Transformer-based Models:
      • Server-side: Architectures such as ViT, SwinTransformer, and PVTV2.
      • Lightweight: Mobile-optimized architectures like MobileViT.

    Performance metrics (speed/latency) are benchmarked across various environments including Arm CPU (Snapdragon 855), Intel CPU (Xeon Gold 6148), and GPU (NVIDIA V100 with TensorRT).

  4. Overview of PaddleClas capabilities

    release/2.6

    PaddleClas is a toolkit for image classification tasks designed for both industry and academia. It provides a full pipeline for training, evaluating, predicting, and deploying visual models.

    Key features include:

    • Model Zoo: 36 series of classification network structures (e.g., ResNet, ResNet_vd, MobileNetV3, Res2Net, HRNet) and 175 pre-trained models.
    • Deployment Options: Supports TensorRT, Python inference, C++ inference, Paddle-Lite, PaddleServing, and PaddleHub.
    • Knowledge Distillation: Includes a simple SSLD (Semi-Supervised Knowledge Distillation) scheme that can improve recognition accuracy by over 3%.
    • Data Augmentation: Supports 8 algorithms including AutoAugment, Cutout, and Cutmix.
    • Environment Support: Works on Windows, Linux, and MacOS using both CPU and GPU.
  5. Overview of PP-HGNetV2 Series

    release/2.6

    PP-HGNetV2 (High Performance GPU Network V2) is a series of models optimized for the 'Accuracy-Latency Balance' on NVIDIA GPUs. It is suitable for single-label classification, multi-label classification, object detection, and semantic segmentation. The series includes models from B0 to B6 scales.

    Key features include:

    • Improved PPHGNet network stem with 2x2 convolutions for richer local features.
    • Replaced redundant standard convolutions in later stages with PW + DW5x5 combinations.
    • Added LearnableAffineBlock modules for accuracy gains with minimal parameter increase and zero inference latency penalty.
    • Provides SSLD pre-trained weights for better downstream task performance.
  6. Overview of Fresh Food Self-Service Checkout Solution

    release/2.6

    This solution provides a computer vision-based system for automated fresh food checkout in unmanned retail scenarios (like supermarkets). It uses cameras to capture images of products on a scale and automatically identifies them in under 1 second, eliminating the need for manual weighing or barcode scanning.

    This case study utilizes the PP-ShiTuV2 general image recognition system from the PaddleClas toolkit.

  7. Overview of PULC Ultra-Lightweight Image Classification

    release/2.6

    PULC (an ultra-lightweight image classification solution) integrates advanced algorithms such as backbone networks, data augmentation, and distillation to automatically train lightweight and high-precision image classification models.

    Key features:

    • Covers 9 common tasks across human, vehicle, and OCR scenarios.
    • High performance: CPU inference time is approximately 3ms.
    • High accuracy: Precision is comparable to SwinTransformer.
  8. Overview of ResNet series models in PaddleClas

    release/2.6

    PaddleClas provides 19 pre-trained ResNet series models, including ResNet50, ResNet50_vd, ResNet50_vd_ssld, ResNet200_vd, and SE_ResNet18_vd.

    Key model variations:

    • _vd suffix: Represents models with improved architectures (e.g., ResNet-vd).
    • _ssld suffix: Models that utilize SSLD (Self-Supervised Learning Distillation) to improve accuracy without changing the model structure.
    • Fix_ResNet50_vd_ssld: A specific version where all parameters except the FC layer are fixed, fine-tuned on ImageNet-1k with a 320x320 input resolution.

    Most models follow standard ImageNet training procedures, while improved versions use advanced strategies like cosine decay for learning rate, label smoothing, and mixup data augmentation over 200 epochs.

  9. Overview of Personnel Access Control solution

    release/2.6

    The Personnel Access Control solution provides a full-lifecycle workflow for detecting unauthorized entry of people, vehicles, or other objects in restricted areas (e.g., home security, server rooms, scenic areas). It addresses real-world challenges such as occlusion by buildings/machinery and varying weather conditions (day/night, fog, rain).

    The solution includes:

    • Data preparation
    • Technical implementation schemes
    • Model training and optimization
    • Model deployment

    It is designed to reduce data labeling and computing costs while maintaining high accuracy in complex outdoor environments.

  10. Overview of PaddleClas features

    release/2.6

    PaddleClas is an image recognition toolset designed for both industry and academia. It provides a complete pipeline for training and deploying computer vision models. Key capabilities include:

    • Integrated Recognition System: Combines detection, feature learning, and retrieval modules. Supported use cases include product, vehicle, logo, and animation character recognition.
    • Pre-trained Models: Access to 175 ImageNet pre-trained models across 36 series, including 7 series optimized for fast structural modification.
    • Metric Learning: Includes 12 integrated metric learning methods that can be toggled via configuration files.
    • SSLD Knowledge Distillation: High-accuracy pre-training models (e.g., ResNet50_vd and Res2Net200_vd) that improve classification accuracy.
    • Data Augmentation: Built-in support for 8 algorithms including AutoAugment, Cutout, and Cutmix within a unified experimental environment.
  11. Overview of Image Classification in PaddleClas

    release/2.6

    Image classification in PaddleClas involves distinguishing images based on semantic information. It serves as a foundation for higher-level vision tasks like detection, segmentation, and tracking. The workflow typically follows these steps:

    1. Data & Preprocessing: Preparing images and labels. To improve generalization, PaddleClas provides standard ImageNet-1k transformations and various data augmentation methods.
    2. Model Preparation: Selecting a backbone. PaddleClas offers 164 pre-trained models across 35 series.
    3. Model Training: Iteratively updating model weights using optimizers and loss functions (e.g., cross-entropy).
    4. Model Evaluation: Assessing performance on a validation set using metrics like Top1-Acc or Top5-Acc.
  12. Overview of TNT (Transformer-iN-Transformer) models

    release/2.6
    The TNT series, proposed by Huawei-Noah, is designed for image recognition by modeling both patch-level and pixel-level representations. Each TNT block consists of an outer transformer block for patch embeddings and an inner transformer block for extracting local features from pixel embeddings. The pixel-level features are projected and added to the patch embeddings. This architecture is designed for high efficiency and accuracy in image recognition tasks.