Processing Block API
The Processing Block API is an alternative, scalable interface that replaces existing APIs for easier integration of SDK capabilities into your application.
Key features of Processing Block API:
- Combining many components into a single integration
- Simplicity and ease of learning
- Rapid implementation
- Long term support and updates
The Processing Block API is a part of the upcoming 3DiVi solutions. For more details, contact your 3DiVi Sales representative.
#
Set of Processing Blocksnote
An example of using Processing Block API is Processing Block Demo Sample.
#
Face DetectorFace Detector is a component used to detect human faces on an image. The detection result is a bounding rectangle (a frame) around the detected face.
Timing characteristics of Face Detector:
- CPU (Intel Core i5-9400 @ 4.10GHz Turbo, 1 core) ~115ms
- GPU (GeForce GTX 1080 Ti) ~16ms
You can find the information about using Face Detector on the page Face Detection.
#
Human Body DetectorHuman Body Detector is a component used to detect human bodies on an image. The detection result is a bounding rectangle (a frame) around the detected body.
Timing characteristics of Human Body Detector:
- CPU (Intel Core i5-9400 @ 4.10GHz Turbo, 1 core) ~170ms
- GPU (GeForce GTX 1080 Ti) ~16ms
You can find the information about using Human Body Detector on the page Body Detection.
#
Object DetectorObject Detector is a component used to detect multiple objects on an image.
The detection result is a bounding rectangle (a frame) around the detected object with classification name.
Object Detector is used to detect the following classes of objects on an image: "body"
, "bicycle"
, "car"
, "motorcycle"
, "bus"
, "train"
, "truck"
, "traffic_light"
, "fire_hydrant"
, "stop_sign"
, "bird"
,
"cat"
, "dog"
, "horse"
, "sheep"
, "cow"
, "bear"
, "backpack"
, "umbrella"
, "handbag"
, "suitcase"
, "sports_ball"
, "baseball_bat"
,
"skateboard"
, "tennis_racket"
, "bottle"
, "wine_glass"
, "cup"
, "fork"
, "knife"
, "laptop"
, "phone"
, "book"
, "scissors"
.
Timing characteristics of Object Detector:
- CPU (Intel Core i5-11400H @ 2.70GHz, 1 core) ~1440ms
- GPU (GeForce GTX 1080 Ti) ~35,6ms
You can find the information about using Object Detector, and a list of objects for detection on the page Object Detection.
#
Human Pose EstimatorHuman Pose Estimator is a component used to estimate human body skeleton keypoints on an image.
The detection result is a list of keypoints with their coordinates and confidence score of the detected human body.
Human Pose Estimator is used to detect the following keypoints on an image:
"nose"
, "left_eye"
, "right_eye"
, "left_ear"
, "right_ear"
, "left_shoulder"
, "right_shoulder"
, "left_elbow"
,
"right_elbow"
, "left_wrist"
, "right_wrist"
, "left_hip"
, "right_hip"
, "left_knee"
, "right_knee"
,
"left_ankle"
, "right_ankle"
Timing characteristics of Human Pose Estimator:
- CPU (Intel Core i5-11400H @ 2.70GHz, 1 core) ~55ms
- GPU (GeForce GTX 1080 Ti) ~15ms
You can find the information about using Human Pose Estimator on the page Human Pose Estimator.
#
Emotion EstimatorEmotion Estimator is a component used to estimate human emotions from the cropped face image. The estimator result is a confidence for every emotion estimated.
Timing characteristics of Emotion Estimator:
- CPU (Intel Core i5-9400 @ 4.10GHz Turbo, 1 core) ~18ms
- GPU (GeForce GTX 1080 Ti) ~8ms
You can find the information about using Emotion Estimator on the page Emotion Estimation.
#
Age EstimatorAge Estimator is a component used to estimate a human age from the cropped image with a face. The estimator result is a human age.
Timing characteristics of Age Estimator:
- CPU (Intel Core i5-9400 @ 4.10GHz Turbo, 1 core) ~5ms
- GPU (GeForce GTX 1080 Ti) ~1ms
You can find the information about using Age Estimator on the page Age Estimation.
#
Gender EstimatorGender Estimator is a component used to estimate a human gender from the cropped image with a face. The estimator result is a verdict about gender identity.
Timing characteristics of Gender Estimator:
- CPU (Intel Core i5-9400 @ 4.10GHz Turbo, 1 core) ~5ms
- GPU (GeForce GTX 1080 Ti) ~1ms
You can find the information about using Gender Estimator on the page Gender Estimation.
#
2D RGB Liveness Estimator2D RGB Liveness Estimator is a component used to detect human liveness on a single colored image. The detection result is a bounding rectangle (a frame) around the detected human face with liveness verdict and score. You can find the information about using Gender Estimator on the page Liveness Estimation.
#
Quality Assessment EstimatorQuality Assessment Estimator is a component used to assess the quality of a face in an image for identification tasks on a single colored image. The detection result is a list of the detected human faces with a verbose quality score. You can find the information about using Quality Assessment Estimator on the page Quality Assessment Estimation.
#
ContextProcessing Block API is based on the use of Context.
Context is a heterogeneous container that consists of a set of hierarchically organized data presented in the form of key–value pairs. The closest analogue of Context is a JSON object. Each Context object can contain a scalar object (integer, real, boolean, string), a memory area or pointer, a sequential array of Context objects, or an associative container of string-Context pairs, with unlimited nesting.
#
How to create and use a Context objectThen create a Context container:
- Common set of operations with a Context container:
- creating an associative container by calling
["key"]
on empty Context:
- getters:
- creating a sequence array by calling
push_back
on empty Context:
- iterating over array:
- operations with a nested associative container:
- other Context's convenient methods:
#
Binary Image FormatMost of the processing blocks operates on Context with an image in binary format:
The "blob"
key contains a smart pointer to data. The pointer is set by the function void Context::setDataPtr(void* ptr, int copy_sz)
,
where copy_sz
is the size of memory in Bytes, that will be copied, and
then automatically released when Context object's lifetime ends. Copying will not perform if 0
is passed as argument copy_sz
.
In this case the Context object does not control the lifetime of the object it points to.
You can also allocate a raw memory, f.e. to copy data later, passing nullptr and size as arguments of setDataPtr
.
The "dtype"
can contain one of these values: "uint8_t"
, "int8_t"
, "uint16_t"
, "int16_t"
, "int32_t"
, "float"
, "double"
.
This is according to OpenCV types: CV_8U
, CV_8S
, CV_16U
, CV_16S
, CV_32S
, CV_32F
, CV_64F
.
#
Creating a Context container with RGB-imageCreate a Context container for image using the
createContext()
method:
- Read an RGB-image from file:
- a. Put an image into container OR
- b. OR copy an image from
pbio::RawImage
,pbio::CVRawImage
,pbio::InternalImageBuffer
to binary format and put it to Context container:
#
Creating a Processing BlockThis template can be used to create any processing block. Keys unit_type
and model_path
must be specified according
to block you want to use (see description of specific processing block).
Create a Context container:
- Define fields in the created context container for creating a Processing Block:
- Create a Processing Block:
#
GPU AccelerationProcessing Blocks can be used with GPU acceleration (CUDA). To activate acceleration you need to define the
["use_cuda"]
key with the true
value for Processing Block configuration container
(see Creating a Processing Block).
#
Requirements- Software requirements:
- Nvidia GPU Driver >= 410.48
- CUDA Toolkit 10.1
- cuDNN 7
- (For Windows) Microsoft Visual C++ Redistributable for Visual Studio 2019
- Hardware requirements:
- CUDA compatible GPU (NVIDIA GTX 1050 Ti or better)