Skip to content

Latest commit

 

History

History
123 lines (82 loc) · 4.73 KB

PULC_quickstart_en.md

File metadata and controls

123 lines (82 loc) · 4.73 KB

PULC Quick Start


This document introduces the prediction using PULC series model based on PaddleClas wheel.

Catalogue

1. Installation

1.1 PaddlePaddle Installation

  • Run the following command to install if CUDA9 or CUDA10 is available.
python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
  • Run the following command to install if GPU device is unavailable.
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

Please refer to PaddlePaddle Installation for more information about installation, for examples other versions.

1.2 PaddleClas wheel Installation

pip3 install paddleclas

2. Quick Start

PaddleClas provides a series of test cases, which contain demos of different scenes about people, cars, OCR, etc. Click here to download the data.

2.1 Predicion with Command Line

cd /path/to/pulc_demo_imgs

The prediction command:

paddleclas --model_name=person_exists --infer_imgs=pulc_demo_imgs/person_exists/objects365_01780782.jpg

Result:

>>> result
class_ids: [0], scores: [0.9955421453341842], label_names: ['nobody'], filename: pulc_demo_imgs/person_exists/objects365_01780782.jpg
Predict complete!

Nobody means there is no one in the image, someone means there is someone in the image. Therefore, the prediction result indicates that there is no one in the figure.

Note: The "--infer_imgs" argument specify the image(s) to be predict, and you can also specify a directoy contains images. If use other model, you can specify the --model_name argument. Please refer to 2.3 Supported Model List for the supported model list.

2.2 Predicion with Python

You can also use in Python:

import paddleclas
model = paddleclas.PaddleClas(model_name="person_exists")
result = model.predict(input_data="pulc_demo_imgs/person_exists/objects365_01780782.jpg")
print(next(result))

The printed result information:

>>> result
[{'class_ids': [0], 'scores': [0.9955421453341842], 'label_names': ['nobody'], 'filename': 'pulc_demo_imgs/person_exists/objects365_01780782.jpg'}]

Note: model.predict() is a generator, so next() or for is needed to call it. This would to predict by batch that length is batch_size, default by 1. You can specify the argument batch_size and model_name when instantiating PaddleClas object, for example: model = paddleclas.PaddleClas(model_name="person_exists", batch_size=2). Please refer to 2.3 Supported Model List for the supported model list.

2.3 Supported Model List

The name of PULC series models are as follows:

Name Intro
person_exists Human Exists Classification
person_attribute Pedestrian Attribute Classification
safety_helmet Classification of Wheather Wearing Safety Helmet
traffic_sign Traffic Sign Classification
vehicle_attribute Vehicle Attribute Classification
car_exists Car Exists Classification
text_image_orientation Text Image Orientation Classification
textline_orientation Text-line Orientation Classification
language_classification Language Classification

3. Summary

The PULC series models have been verified to be effective in different scenarios about people, vehicles, OCR, etc. The ultra lightweight model can achieve the accuracy close to SwinTransformer model, and the speed is increased by 40+ times. And PULC also provides the whole process of dataset getting, model training, model compression and deployment. Please refer to Human Exists ClassificationPedestrian Attribute ClassificationClassification of Wheather Wearing Safety HelmetTraffic Sign ClassificationVehicle Attribute ClassificationCar Exists ClassificationText Image Orientation ClassificationText-line Orientation ClassificationLanguage Classification for more information about different scenarios.