# Models

The Live Sense models provide an interface for interacting with the underlying machine learning (ML) models used to detect objects.

### Note

Object Detection/Recognition describes the combination of object classification, identifying objects of interest that exist in an image, and localization by identifying where the object is located in the image. An example is a Live Sense model that identifies a vehicle in the image and provides a bounding box of where the vehicle was identified.

The core function of every model is to take in an RGB image and return a list of detections found within the image.

Each Live Sense model has a set of object classes that it is able to detect. It is up to the developer to determine which objects, and therefore models, are relevant to their use case.

## Model Types and Detection Classes

Category Model Name Label Recommended Confidence
rider 47
car 46
bicycle 45
motorcycle 47
truck 45
traffic-light 47
bus 50
Road Hazards Cones & Barriers rectangular-barrier 60
strip-stand 60
cylindrical-barrier 60
delineator-barrier 60
cone 60
Pothole pothole 80
DS_SpeedLimit[5-130]_White_Rectangle_01 60
stop-sign 60
Brake Light BrakeLight car-brake-light-on 45

### Note

For DS_SpeedLimit, the label suffix [White_Circle_00/White_Rectangle_01] denotes the sign shape.

• White_Circle_00 denotes a circular sign
• White_Rectangle_01 denote a rectangular sign.

### Models Available in Beta Mode

The models below are available for beta testing:

Category Model Name Label Recommended Confidence
Road Basics Traffic Light Status traffic-light-green 75
traffic-light-red 75
traffic-light-yellow 75
motorcycle 40
car 40
truck 40
bus 40
Lane Detection Road Lanes lane N/A
speed_bump_signage speed-bump-sign 55
bridge_tunnel bridge 75
tunnel 75
height_restriction_signs height-restriction-sign-Xft-Yin 60

### Confidence Configuration

Live Sense SDK for Linux allows you to configure the confidence values of the models.

#### Update the Confidence of a Model

You may set the minimum confidence threshold for all classes available in a specified model using the model classes' respective options struct. The options are set during model initialization and may be updated via a setter method.

// Road Basics
// Brake Light
ls::BrakeLightModelOptions brakeLightOptions;
brakeLightOptions.brakeLightConfidenceThresh = 0.8;


For a model, the confidence threshold here can be used from the 'Recommended Confidence' described in the Model Types and Detection Classes table.

### Limitations

Using a lower confidence threshold will result in more detections, but an overall lower accuracy. This can sometimes cause the labels to show false positives. For this reason, applications should keep their confidence threshold at or above 0.6 to maintain reasonably accurate output.

The Live Sense models are not thread-safe and should be both initialized and executed on the same thread. Utilizing multiple threads for the same model instance may result in unexpected behavior.

Models may be executed in parallel, but each model instance can only handle one image at a time. Executing a model before the previous call has completed will result in an exception.

## Model Execution Options

Live Sense SDK for Linux supports multiple instances for executing the Live Sense models. Exact support depends upon the device and model being used.

## Object Recognition

A Live Sense Recognition describes the following properties of a detected object:

• class - What object was detected. For more information, see Model Types and Detection Classes.
• location - Where the object was found in the image frame.
• confidence score - A number between 0 and 1 that indicates confidence that the object was correctly detected.

### Model Types

The following libraries are supported:

• TensorFlow Lite (TFLite)
• TensorRT
• Coral Edge TPU

#### Engine Runtime Support

CPU GPU TPU
TensorFlow Lite Y Y N
TensorRT N Y N
Coral Edge TPU N N Y

For the TensorFlow Lite variant to load a model on GPU, you must set the appropriate model option to true.

ls::ModelOptions mOptions;
// Enable GPU delegate in TensorFlow Lite SDK variant
mOptions.setUseGpuDelegate(true);


### Note

TensorFlow Lite's Linux-based OpenGL ES GPU support is still experimental. Not all Live Sense models may be supported on all GPUs.

#### Model Runtime Support

TFLite fp32 TFLite fp16 TFLite INT8/Quant TensorRT fp32 TensorRT fp16 Edge TPU INT8
Road Basics Y Y Y Y Y Y
Road Basics Night Y Y Y N N Y
Road Signs Y Y Y Y Y Y
Cones & Barriers Y Y Y Y Y Y
Pothole Y Y Y Y Y Y
Speed Bumps Y Y N N N N
Speed Bumps Signs Y Y Y N N Y
Bridges & Tunnels Y Y Y N N Y
Height Restriction Signs Y Y Y N N N
Road Lanes Y Y Y Y Y N
Brake Light Y Y Y Y Y Y

By default, the SDK will run fp32 variant. You can enable fp16 or INT8 by setting the respective variable to TRUE in the model options. Ensure that only one variant is set to TRUE at a time.

ls::ModelOptions mOptions;
mOptions.setRunInFp16(true);
//OR
mOptions.setRunInInt8(true);


## Distance and Position Estimation

### Note

This feature is in Beta, the returned distance and relative position values may be inaccurate.

All of the object detection models listed above can provide an estimated distance and position relative to the camera's point of view for each detected object.

The output values for the distance and relativePosition properties of a detected object are as follows:

• Height: Distance of the detection from the ground.
• Lateral: Distance of the detection relative to the center of the camera's view. This value may be positive or negative with a negative value signifying that the detection is towards the left side of the camera's view and vice versa.
• Depth: Distance that the device needs to travel forward in a straight line so that the actual distance is equal to the lateral distance.
• Distance: Actual distance of the detection from the camera's point of view.

All distance values are provided in meters and are used in the following features of Live Sense SDK