Detection and Tracking Algorithm Description


REVISION HISTORY

Revision No.
Description
Date
1.0 First version 05/15/2024
2.0 Second version 07/09/2024

1. Overview

1.1. Algorithm Description

This algorithm library can implement the following basic functions: human detection, face detection, vehicle detection, non-motorized vehicle detection, pet detection, and tracking of detected targets (human, face, vehicle, non-motorized vehicle, pets, etc.).

For example, if you need to detect human shapes, vehicles, and pets simultaneously, configure SD in the initialized model, and the detection interface will perform detection for these categories at the same time.

It can also achieve application features: area people counting / area intrusion (illegal parking) / tripwire intrusion / loitering detection / fast movement.

Supported detection models include: pedestrian detection (SYPD), human-non-vehicle detection (SYPCN), human-pet detection (SYPCD), license plate detection (SYLPD), face detection (SYFD), flame and smoke detection(SYFSD), Human+Head+Face detection (SPD), human-non-vehicle-pet detection (SD), The specific category descriptions are as follows:

  • Pedestrian detection (SYPD) outputs 1 category, which is pedestrian (class_id=0).

  • Human-non-vehicle detection (SYPCN) outputs 6 categories, which are pedestrian (class_id=0), bicycle (class_id=1), car (class_id=2), motorcycle (class_id=3), bus (class_id=4), truck (class_id=5).

  • Human-pet detection (SYPCD) outputs 3 categories, which are pedestrian (class_id=0), cat (class_id=1), dog (class_id=2).

  • License plate detection (SYLPD) outputs 1 category, which is license plate (class_id=0).

  • Face detection (SYFD) outputs 1 category, which is face (class_id=0).

  • Flame and smoke (SYFSD) outputs 2 categories, which are flame (class_id=0) and smoke (class_id=1).

  • Human+Head+Face detection (SPD) outputs 3 categories, which are pedestrian (class_id=0), head (class_id=1), face (class_id=2).

  • Human-non-vehicle-pet detection (SD) outputs 10 categories, which are pedestrian (class_id=0), bicycle (class_id=1), car (class_id=2), motorcycle (class_id=3), bus (class_id=4), truck (class_id=5), cat (class_id=6), dog (class_id=7), head(class_id=8), face(class_id=9).

1.2. Algorithm Specifications

  • Pedestrian detection (SYPD)

    • board-end resources (measured on 377 platform (IPU clock@800MHz))

      Model Name Model Version Resolution Input Format Rom Ram Inference Time PostProcess Time
      SYPD36 310 640x352 yuv_nv12 772KB 1780KB 6.5ms ≈1.0ms
      SYPD48 310 800x480 yuv_nv12 828KB 2540KB 10.9ms ≈1.2ms
      SYPD58 310 896x512 yuv_nv12 848KB 3048KB 13.0ms ≈1.5ms
  • Human-non-vehicle detection (SYPCN)

    • board-end resources (measured on 377 platform)

      Model Name Model Version Resolution Input Format Rom Ram Inference Time PostProcess Time
      SYPCN36s 310 640x352 yuv_nv12 880KB 1928KB 6.6ms ≈1.2ms
      SYPCN48s 310 800x480 yuv_nv12 936KB 2720KB 11.1ms ≈1.6ms
      SYPCN58s 310 896x512 yuv_nv12 960KB 3256KB 13.3ms ≈2.0ms
      SYPCN36l 310 800x480 yuv_nv12 3216KB 5176KB 15.7ms ≈1.2ms
      SYPCN48l 310 896x512 yuv_nv12 3340KB 6660KB 26.4ms ≈1.6ms
  • Human-pet detection (SYPCD)

    • board-end resources (measured on 377 platform)

      Model Name Model Version Resolution Input Format Rom Ram Inference Time PostProcess Time
      SYPCD36s 310 640x352 yuv_nv12 772KB 1796KB 6.5ms ≈1.1ms
      SYPCD48s 310 800x480 yuv_nv12 828KB 2572KB 11.0ms ≈1.5ms
      SYPCD58s 310 896x512 yuv_nv12 852KB 3092KB 13.1ms ≈1.8ms
  • Flame and smoke detection (SYFSD)

    • board-end resources (measured on 377 platform)

      Model Name Model Version Resolution Input Format Rom Ram Inference Time PostProcess Time
      SYFSDY36l 310 640x352 yuv_nv12 2579KB 4489KB 14.76ms ≈1.1ms
      SYFSDY48l 310 800x480 yuv_nv12 2689KB 5940KB 24.67ms ≈1.5ms

2. API Reference

This functional module provides the following APIs:

API Names Functions
ALGO_DT_CreateHandle Create algo handle
ALGO_DT_InitHandle Initialize algo handle
ALGO_DT_GetInputAttr Get model attribute information
ALGO_DT_SetParams Set algorithm parameters
ALGO_DT_Detect Run detection algorithm
ALGO_DT_Track Track detected targets
ALGO_DT_Count Count area flow
ALGO_DT_RoiAlarmDetect Area intrusion detection
ALGO_DT_RoiWanderDetect Area loitering detection
ALGO_DT_RoiFastMovingDetect Fast moving detection
ALGO_DT_LineAlarmDetect Tripwire intrusion detection
ALGO_DT_DeinitHandle Deinit algo handle
ALGO_DT_ReleaseHandle Release algo handle

2.1. ALGO_DT_CreateHandle

  • Function

    Create algo handle

  • Syntax

    MI_S32 ALGO_DT_CreateHandle(void **handle);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.2. ALGO_DT_InitHandle

  • Function

    Initialize algo handle

  • Syntax

    MI_S32 ALGO_DT_InitHandle(void *handle, DtInit_t *init_info);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    init_info Algorithm initialization configuration, see DtInit_t for details Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Related Structures

    DtInit_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.3. ALGO_DT_GetInputAttr

  • Function

    Get the attribute information of the model, including model input resolution and input data type (usually two formats: 1->NV12,7->ARGB888)

  • Syntax

    MI_S32 ALGO_DT_GetInputAttr(void *handle, DtInputAttr_t *input_attr);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    input_attr pointer to DtInputAttr_t structure,see DtInputAttr_t for details Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Related Structures

    DtInputAttr_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.4. ALGO_DT_SetParams

  • Function

    Set the parameters of the algorithm

  • Syntax

    MI_S32 ALGO_DT_SetParams(void *handle, const DtParams_t *params);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    params algo configurable parameters,see DtParams_t for details Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Related Structures

    DtParams_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.5. ALGO_DT_Detect

  • Function

    Run model inference to detect targets such as human shapes, and obtain detection results

  • Syntax

    MI_S32 ALGO_DT_Detect(void *handle, const DtInput_t *algo_input, DtBox_t bboxes[MAX_DT_OBJECT], MI_S32 *num_bboxes);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    algo_input algo input image data information Input
    bboxes algo output structure Output
    num_bboxes number of detected objects Output
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect

  • Related Structures

    DtInput_t

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.6. ALGO_DT_Track

  • Function

    Track the detection results, obtain tracking results, and get the tracking ID

  • Syntax

    MI_S32 ALGO_DT_Track(void *handle, DtBox_t bboxes[MAX_DT_OBJECT], MI_S32 *num_bboxes);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    bboxes pointer to input detect results and also pointer to output track results In/Output
    num_bboxes number of output track results In/Output
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect->ALGO_DT_Track

  • Related Structures

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.7. ALGO_DT_Count

  • Function

    Count the flow of people in a specified area

  • Syntax

    MI_S32 ALGO_DT_Count(void *handle, CountRoi_t rois[MAX_DT_ROI], MI_S32 num_rois, DtBox_t bboxes_input[MAX_DT_OBJECT], MI_S32 num_bboxes_input);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    rois Array of areas for flow statistics Input /Output
    num_rois Number of areas for flow statistics Input
    bboxes_input Array used for inputting tracking result boxes Input
    num_bboxes_input Number of input tracking result boxes Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect->ALGO_DT_Track->ALGO_DT_Count

  • Related Structures

    CountRoi_t

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.8. ALGO_DT_RoiAlarmDetect

  • Function

    Determine if there is an intrusion by objects within a defined area

  • Syntax

    MI_S32 ALGO_DT_RoiAlarmDetect(void* handle, ALGO_DtRoiAlarm_t rois[MAX_DT_ROI], MI_S32 num_rois, DtBox_t bboxes_input[MAX_DT_OBJECT], MI_S32 num_bboxes_input);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    rois Define alarm zones In/Output
    num_rois Number of zones Input
    bboxes_input Tracking result boxes Input
    num_bboxes_input Number of tracking result boxes Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect->ALGO_DT_Track->ALGO_DT_RoiAlarmDetect

  • Related Structures

    ALGO_DtRoiAlarm_t

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.9. ALGO_DT_RoiWanderDetect

  • Function

    Detect loitering of objects within a defined area

  • Syntax

    MI_S32 ALGO_DT_RoiWanderDetect(void* handle, ALGO_DtRoiWander_t rois[MAX_DT_ROI], MI_S32 num_rois, DtBox_t bboxes_input[MAX_DT_OBJECT], MI_S32 num_bboxes_input);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    rois Define region information In/Output
    num_rois Number of regions Input
    bboxes_input Tracking result box information Input
    num_bboxes_input Number of tracking result boxes Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect->ALGO_DT_Track->ALGO_DT_RoiWanderDetect

  • Related Structures

    ALGO_DtRoiWander_t

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.10. ALGO_DT_RoiFastMovingDetect

  • Function

    Detect fast-moving objects within a defined area

  • Syntax

    MI_S32 ALGO_DT_RoiFastMovingDetect(void* handle, ALGO_DtRoiFastMove_t rois[MAX_DT_ROI], MI_S32 num_rois, DtBox_t bboxes_input[MAX_DT_OBJECT], MI_S32 num_bboxes_input);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    rois Region information In/Output
    num_rois Number of regions Input
    bboxes_input Detection box information Input
    num_bboxes_input Number of detection boxes Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect->ALGO_DT_Track->ALGO_DT_RoiFastMovingDetect

  • Related Structures

    ALGO_DtRoiFastMove_t

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.11. ALGO_DT_LineAlarmDetect

  • Function

    Determine if there is an intrusion by objects crossing a defined line

  • Syntax

    MI_S32 ALGO_DT_LineAlarmDetect(void* handle, ALGO_DtLineAlarm_t lines[MAX_DT_ROI], MI_S32 num_lines, DtBox_t bboxes_input[MAX_DT_OBJECT], MI_S32 num_bboxes_input);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
    lines Line alarm information In/Output
    num_lines Number of lines Input
    bboxes_input Tracking result box information Input
    num_bboxes_input Number of tracking result boxes Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Call Flow

    ALGO_DT_CreateHandle->ALGO_DT_InitHandle->ALGO_DT_SetParams->ALGO_DT_Detect->ALGO_DT_Track->ALGO_DT_LineAlarmDetect

  • Related Structures

    ALGO_DtLineAlarm_t

    DtBox_t

  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.12. ALGO_DT_DeinitHandle

  • Function

    Stop the algorithm

  • Syntax

    MI_S32 ALGO_DT_DeinitHandle(void *handle);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

2.13. ALGO_DT_ReleaseHandle

  • Function

    Release resources occupied by the handle

  • Syntax

    MI_S32 ALGO_DT_ReleaseHandle(void *handle);
    
  • Parameters

    Parameters Description In/Output
    handle algo handle Input
  • Return Values

    Return Values Description
    0 Success
    Others Failure(see Error Code for details)
  • Dependencies

    • Header File: sgs_dt_api.h

    • Library File: libsgsalgo_dt.a / libsgsalgo_dt.so

3. Structure/Enum Type Description

The relevant data type definitions are as follows:

Structure Type Definitions
DtInit_t Algorithm-related initialization configurations
DtInputAttr_t Algorithm input attribute structure
DtParams_t Algorithm-related configurable items
DtInput_t Algorithm input image data information
DtBox_t Detection and tracking output structure
DtPoint_t Vertex pixel coordinate
DtRoi_t Polygonal region position
CountRoi_t Region flow statistics information
RoiAlarmMode_e Region intrusion mode
ALGO_DtRoiAlarm_t Region intrusion structure
ALGO_DtRoiFastMove_t Fast-moving object in the region structure
ALGO_DtRoiWander_t Wandering object in the region structure
DtLine_t Tripwire structure
ALGO_DtLineAlarm_t Tripwire intrusion structure
Label_PD_Person_e Person detection algorithm class_id and category name correspondence
Label_FD_Face_e Face detection algorithm class_id and category name correspondence
Label_PCN_e Person, non-motor vehicle, and vehicle detection algorithm class_id and category name correspondence
Label_PCD_e Person and pet detection algorithm class_id and category name correspondence
Label_FSD_e Flame and smoke detection algorithm class_id and category name correspondence
Label_SD_e Person, car, pet, head, and face detection algorithm class_id and category name correspondence
Label_SPD_e Person, head, and face detection algorithm class_id and category name correspondence

3.1 DtInit_t

  • Description

    Algorithm-related initialization configurations

  • Definitions

    typedef struct
    {
        char ipu_firmware_path[MAX_DT_STRLEN];
        char model_path[MAX_DT_STRLEN];
        MI_BOOL create_device;
        MI_BOOL destroy_device;
        void *model_buffer;
        MI_U32 model_buffer_len;
    } DtInit_t;
    
  • Members

    Members Description
    ipu_firmware_path[MAX_DT_STRLEN] Path to the IPU firmware
    model_path[MAX_DT_STRLEN] Path to the model file
    create_device Whether to create the IPUDevice within the algorithm library, default is true (i.e., created inside the library). If you need to call the algorithm library simultaneously, it can be set to false and the IPUDevice should be created externally.
    destroy_device Whether to destroy the IPUDevice within the algorithm library, default is true (i.e., destroyed inside the library). If you need to call the algorithm library simultaneously, it can be set to false and the IPUDevice should be destroyed externally.
    model_buffer When using model_path, please set to NULL. Leaving model_path empty and setting model_buffer and model_buffer_len allows for initializing the algorithm from a model memory block.
    model_buffer_len When using model_path, please set to 0. Set the length of the model_buffer memory block.
  • Related Data Types and Interfaces

    ALGO_DT_InitHandle

3.2 DtInputAttr_t

  • Description

    definition of input resolution and data type

  • Definitions

    typedef struct
    {
        MI_U32 width;
        MI_U32 height;
        MI_IPU_ELEMENT_FORMAT format;
    } DtInputAttr_t;
    
  • Members

    Members Description
    width Width of the input data for the model
    height Height of the input data for the model
    format Type of the input data for the model
  • Related Data Types and Interfaces

    ALGO_DT_GetInputAttr

3.3 DtParams_t

  • Description

    Algorithm-related configurable items

  • Definitions

    typedef struct
    {
        MI_S32 disp_width;               // default=1920
        MI_S32 disp_height;              // default=1080
    
        // detect
        MI_FLOAT conf_threshold=0.5;     // default=0.5
    
        // track
        MI_BOOL ignore_static_objects;   // default=false
        MI_BOOL stable_bbox;             // default=false
        MI_FLOAT stable_iou_threshold;   // default=0.65
        MI_FLOAT static_iou_threshold;   // default=0.85
        MI_S32 ignore_frame_number;      // default=0
        MI_FLOAT ignore_static_time;     // default=0
        MI_BOOL use_detect_bbox;         // default=false
        MI_BOOL strict_mode;             // default=false
    } DtParams_t;
    
  • Members

    Members Description
    disp_width Display stream resolution width (used for mapping detection box positions), default value is 1920
    disp_height Display stream resolution height (used for mapping detection box positions), default value is 1080
    conf_threshold Detection algorithm threshold, default value is 0.5
    ignore_static_objects Whether to ignore static objects, default is false, meaning both dynamic and static objects are detected
    stable_bbox Whether to perform stable bounding box
    stable_iou_threshold Sensitivity of the stable bounding box algorithm, range 0.0~1.0, smaller values result in stronger stabilization, default value is 0.65
    static_iou_threshold Sensitivity for determining if an object is static, range 0.0~1.0, default value is 0.85, higher values tend to retain slightly moving boxes
    ignore_frame_number Number of frames to ignore for static object filtering, mainly used for static filtering. If static filtering is needed, it is recommended to set to 8, otherwise set to 0
    ignore_static_time Only static objects that have been stationary for a specified time will be ignored, unit is seconds
    use_detect_bbox In the tracking algorithm, whether to use the detection bounding box. If false, the tracking bounding box is used
    strict_mode Whether to use strict detection mode, default value is false
  • Related Data Types and Interfaces

    ALGO_DT_SetParams

3.4 DtInput_t

  • Description

    algorithm input image data information

  • Definitions

    typedef struct
    {
        void *p_vir_addr;
        MI_PHY phy_addr;
        MI_U32 buf_size;
        MI_U64 pts;
    } DtInput_t;
    
  • Members

    Members Description
    p_vir_addr Virtual address of the input buffer
    phy_addr Physical address of the input buffer
    buf_size Length of the input buffer
    pts Timestamp of the input buffer
  • Related Data Types and Interfaces

    ALGO_DT_Detect

3.5 DtBox_t

3.6 DtPoint_t

  • Description

    Vertex pixel coordinate

  • Definitions

    typedef struct
    {
        MI_U32 x;
        MI_U32 y;
    } DtPoint_t;
    
  • Members

    Members Description
    x X-coordinate of the vertex
    y Y-coordinate of the vertex
  • Related Data Types and Interfaces

    DtRoi_t

    DtLine_t

3.7 DtRoi_t

  • Description

    Polygonal region position

  • Definitions

    typedef struct
    {
        DtPoint_t point[MAX_DT_VERTEX];
        MI_U32 point_num;
    } DtRoi_t;
    
  • Members

    Members Description
    point Array of polygon vertex coordinates (maximum number of vertices MAX_DT_VERTEX)
    point_num Number of polygon vertices
  • Related Data Types and Interfaces

    DtPoint_t

    CountRoi_t

    ALGO_DtRoiAlarm_t

    ALGO_DtRoiFastMove_t

    ALGO_DtRoiWander_t

3.8 CountRoi_t

  • Description

    Region flow statistics information

  • Definitions

    typedef struct
    {
        DtRoi_t roi;
        MI_U32 count;
        MI_FLOAT interval;
        MI_U32 interval_in_count;
        MI_U32 interval_out_count;
        MI_U32 count_cls[MAX_DT_NUM_CLASS];
        MI_S16 num_count_cls;
    } CountRoi_t;
    
  • Members

    Members Description
    roi Polygonal region location, configured clockwise or counterclockwise around the region
    count Region flow counter value
    interval Time interval for counting people entering and exiting (in seconds)
    interval_in_count Number of people entering the region during the time interval, reset to 0 upon reaching the interval
    interval_out_count Number of people leaving the region during the time interval, reset to 0 upon reaching the interval
    count_cls Array of classes to be counted
    num_count_cls Number of classes to be counted, if 0, then count all classes
  • Related Data Types and Interfaces

    DtRoi_t

    ALGO_DT_Count

3.9 RoiAlarmMode_e

  • Description

    Region intrusion mode(normal mode or illegal parking mode)

  • Definitions

    typedef enum
    {
        E_NORMAL_ROI_ALARM = 0,
        E_ILLEGAL_PARKING,
    } RoiAlarmMode_e;
    
  • Members

    Members Description
    E_NORMAL_ROI_ALARM Normal region intrusion
    E_ILLEGAL_PARKING Illegal parking
  • Related Data Types and Interfaces

    ALGO_DtRoiAlarm_t

3.10 ALGO_DtRoiAlarm_t

  • Description

    Region intrusion structure information

  • Definitions

    typedef struct
    {
        DtRoi_t roi;
        RoiAlarmMode_e roi_model;
        MI_BOOL inbreak;
        DtBox_t inbreak_box[MAX_DT_OBJECT];
        MI_U32  inbreak_box_num;
        MI_BOOL target_enter;
        DtBox_t target_enter_box[MAX_DT_OBJECT];
        MI_U32  target_enter_box_num;
        MI_BOOL target_leave;
        DtBox_t target_leave_box[MAX_DT_OBJECT];
        MI_U32  target_leave_box_num;
    }ALGO_DtRoiAlarm_t;
    
  • Members

    Members Description
    roi Region information, configured clockwise or counterclockwise around the region
    roi_model Alarm mode
    inbreak Whether there is an intrusion
    inbreak_box Intrusion target box
    inbreak_box_num Number of intrusion targets
    target_enter Whether there is a target entering
    target_enter_box Box of the target entering the region
    target_enter_box_num Number of targets entering the region
    target_leave Whether there is a target leaving
    target_leave_box Box of the target leaving the region
    target_leave_box_num Number of targets leaving the region
  • Related Data Types and Interfaces

    DtBox_t

    DtRoi_t

    RoiAlarmMode_e

    ALGO_DT_RoiAlarmDetect

3.11 ALGO_DtRoiFastMove_t

  • Description

    Fast-moving object in the region structure

  • Definitions

    typedef struct
    {
        DtRoi_t roi;
        MI_BOOL fase_move;
        DtBox_t fast_move_box[MAX_DT_OBJECT];
        MI_U32  fast_move_box_num;
        MI_FLOAT sensitive;
    }ALGO_DtRoiFastMove_t;
    
  • Members

    Members Description
    roi Region information, configured clockwise or counterclockwise around the region
    fase_move Whether there is a fast-moving object in the region
    fast_move_box Box of the fast-moving object in the region
    fast_move_box_num Number of fast-moving objects in the region
    sensitive Sensitivity of fast movement, 0.0-5.0, the higher the value, the faster the required movement
  • Related Data Types and Interfaces

    DtBox_t

    DtRoi_t

    ALGO_DT_RoiFastMovingDetect

3.12 ALGO_DtRoiWander_t

  • Description

    Wandering object in the region structure

  • Definitions

    typedef struct
    {
        DtRoi_t roi;
        MI_BOOL wander;
        DtBox_t target_wander_box[MAX_DT_OBJECT];
        MI_U32  target_wander_num;
        MI_FLOAT interval;
    }ALGO_DtRoiWander_t;
    
  • Members

    Members Description
    roi Region information, configured clockwise or counterclockwise around the region
    wander Whether there is a wandering object in the region
    target_wander_box Box of the wandering object in the region
    target_wander_num Number of wandering objects in the region
    interval Wandering time setting
  • Related Data Types and Interfaces

    DtBox_t

    DtRoi_t

    ALGO_DT_RoiWanderDetect

3.13 DtLine_t

  • Description

    Tripwire structure information

  • Definitions

    typedef struct
    {
        DtPoint_t point1;
        DtPoint_t point2;
    }DtLine_t;
    
  • Members

    Members Description
    point1 The first point of the tripwire
    point2 The second point of the tripwire
  • Related Data Types and Interfaces

    DtPoint_t

    ALGO_DtLineAlarm_t

    ALGO_DtLineAlarm_t

3.14 ALGO_DtLineAlarm_t

  • Description

    Tripwire intrusion structure

  • Definitions

    typedef struct
    {
        DtLine_t line;
        MI_BOOL inbreak;
        DtBox_t inbreak_box[MAX_DT_OBJECT];
        MI_U32  inbreak_box_num;
        MI_BOOL cross_line;
        DtBox_t cross_line_box[MAX_DT_OBJECT];
        MI_S32  cross_line_orien[MAX_DT_OBJECT];
        MI_S32  cross_line_num;
        MI_FLOAT sensitive; //between(-1.0 - 1.0)
    }ALGO_DtLineAlarm_t;
    
  • Members

    Members Description
    line Tripwire information
    inbreak Whether there is a tripwire intrusion
    inbreak_box Box of the object that caused the tripwire intrusion
    inbreak_box_num Number of boxes that caused the tripwire intrusion
    cross_line Whether there is a crossing of the tripwire, which means the object moved from one side of the tripwire to the other
    cross_line_box Box of the object that crossed the tripwire
    cross_line_orien Orientation of the object that crossed the tripwire, 1 is left to right, 2 is right to left, 3 is top to bottom, 4 is bottom to top
    cross_line_num Number of objects that crossed the tripwire
    sensitive (-0.1 - 1.0) Scaling factor for the bounding box, keeping the center unchanged while changing the width and height, width = width - sensitive * width, height = height - sensitive * height, to prevent the box from being too large and not properly detecting the crossing of the tripwire.
  • Related Data Types and Interfaces

    DtBox_t

    DtLine_t

    ALGO_DT_LineAlarmDetect

3.15 Label_PD_Person_e

  • Description

    Person detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_PD_PERSON = 0
    } Label_PD_Person_e;
    
  • Members

    Members Description
    E_PD_PERSON Person category (class_id=0)

3.16 Label_FD_Face_e

  • Description

    Face detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_FD_FACE = 0,
    } Label_FD_Face_e;
    
  • Members

    Members Description
    E_FD_FACE Face category (class_id=0)

3.17 Label_PCN_e

  • Description

    Person, non-motor vehicle, and vehicle detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_PCN_PERSON = 0,
        E_PCN_BICYCLE,
        E_PCN_CAR,
        E_PCN_MOTOCYCLE,
        E_PCN_BUS,
        E_PCN_TRUCK
    } Label_PCN_e;
    
  • Members

    Members Description
    E_PCN_PERSON Person category (class_id=0)
    E_PCN_BICYCLE Bicycle category (class_id=1)
    E_PCN_CAR Car category (class_id=2)
    E_PCN_MOTOCYCLE Motorcycle category (class_id=3)
    E_PCN_BUS Bus category (class_id=4)
    E_PCN_TRUCK Truck category (class_id=5)

3.18 Label_PCD_e

  • Description

    Person and pet detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_PCD_PERSON,
        E_PCD_CAT,
        E_PCD_DOG
    } Label_PCD_e;
    
  • Members

    Members Description
    E_PCN_PERSON Person category (class_id=0)
    E_PCN_CAT Cat category (class_id=1)
    E_PCN_DOG Dog category (class_id=2)

3.19 Label_FSD_e

  • Description

    Flame and smoke detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_FSD_FIRE,
        E_FSD_SMOKE
    } Label_FSD_e;
    
  • Members

    Members Description
    E_FSD_FIRE Flame category (class_id=0)
    E_FSD_SMOKE Smoke category (class_id=1)

3.20 Label_SD_e

  • Description

    Person, car, pet, head, and face detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_SD_PERSON = 0,
        E_SD_BICYCLE,
        E_SD_CAR,
        E_SD_MOTOCYCLE,
        E_SD_BUS,
        E_SD_TRUCK,
        E_SD_CAT,
        E_SD_DOG,
        E_SD_HEAD,
        E_SD_FACE,
    } LABEL_SD_e;
    
  • Members

    Members Description
    E_SD_PERSON Person category (class_id=0)
    E_SD_BICYCLE Bicycle category (class_id=1)
    E_SD_CAR Car category (class_id=2)
    E_SD_MOTOCYCLE Motorcycle category (class_id=3)
    E_SD_BUS Bus category (class_id=4)
    E_SD_TRUCK Truck category (class_id=5)
    E_SD_CAT Cat category (class_id=6)
    E_SD_DOG Dog category(class_id=7)
    E_SD_HEAD Head category(class_id=8)
    E_SD_FACE Face category(class_id=9)

3.21 Label_SPD_e

  • Description

    Person, head, and face detection algorithm class_id and category name correspondence

  • Definitions

    typedef enum
    {
        E_SPD_PERSON = 0,
        E_SPD_HEAD,
        E_SPD_FACE
    } LABEL_SPD_e;
    
  • Members

    Members Description
    E_SPD_PERSON Person category (class_id=0)
    E_SPD_HEAD Head category(class_id=1)
    E_SPD_FACE Face category(class_id=2)

4. Error Code

Error Code Value Description
E_ALGO_SUCCESS 0 Operation successful
E_ALGO_HANDLE_NULL 1 Algorithm handle is null
E_ALGO_INVALID_PARAM 2 Invalid input parameter
E_ALGO_DEVICE_FAULT 3 Hardware error
E_ALGO_LOADMODEL_FAIL 4 Model loading failed
E_ALGO_INIT_FAIL 5 Algorithm initialization failed
E_ALGO_NOT_INIT 6 Algorithm has not been initialized
E_ALGO_INPUT_DATA_NULL 7 Algorithm input data is null
E_ALGO_INVALID_INPUT_SIZE 8 Invalid dimensions of the algorithm input data
E_ALGO_INVALID_LICENSE 9 Invalid license permission
E_ALGO_MEMORY_OUT 10 Insufficient memory
E_ALGO_FILEIO_ERROR 11 File read/write operation error
E_ALGO_INVALID_OUTPUT_SIZE 12 Invalid dimensions of the algorithm output data