Deviation-lib is a library that contains utilities to detect real time changes.

Change detection alert

Change detection helps to detect live changes in road conditions and keep the driver updated. Detected objects / signs are compared against those received as an input (in close vicinity of detections) from various sources like maps, web-services. If there is a change in the detected feature vs. the input received, then an alert will be available.


Currently, the Change Detection function provides alerts for deviations in speed limits only.


The following list describes a few mandatory inputs required for this function:

  • The corresponding ML model needs to be initialized.
  • Geolocation of device. See Location Services.
  • Value of the stored feature.

For the geolocation and stored feature, up-to-date information is to be provided on a regular basis so that the detections are compared against the most closest and latest features.

If no stored feature exists for a particular geolocation, then the input values need to be reset to 0 or NULL based on the datatype. Else the function will keep comparing detections against the last input.

If no input is provided, then no alerts will be generated.


Not all raw detections will have a corresponding change detection result. Detections are filtered by an internal logic to remove duplicates i.e., Detections are filtered by an internal logic to remove duplicates, or identical objects in multiple consecutive frames, and then used for comparison.


For change detection to function, it requires an input from the map to be given to the setMapSpeedLimit() method. This value is then compared against any detections.

int speedLimit = numericSpeedLimitValue;
double longitude = currentLocation.longitude;
double latitude = currentLocation.latitude;
uint64_t timestamp = currentLocation.timestamp;

auto speedLimitDeviationManager = ls::SpeedLimitDeviationManager::getInstance();

speedLimitDeviationManager->setMapSpeedLimit(speedLimit, longitude, latitude, timestamp);

The alerts are received by registering a callback with the deviation manager.

auto speedLimitDeviationManager = ls::SpeedLimitDeviationManager::getInstance();

int handle = speedLimitDeviationManager->addCallback(
   [](const ls::SpeedLimitDeviation &deviation) {
        // Process speed limit deviation

// Use result of `addCallback` to later remove a specific listener

results matching ""

    No results matching ""