Python Module for data transferring#
CARS Stream has a functionality for transferring information about the detection of vehicle and LP to external systems (CARS API, CARS Analytics) via the python module «callback_manager.py».
The data is processed by the «process_callback» method. This method receives a set of discovery results in key-value format.
Translation of the response in JSON format:
{
'trackId' (int): 12,
'vehicleData' (dict): {
'licensePlate' (str): 'H919CH40',
'licensePlateScore' (double): 0.999257,
'vehicleType' (str): 'B',
'vehicleTypeScore' (double): 0.999257,
'vehicleEmergencyType' (str): 'not_emergency',
'vehicleEmergencyTypeScore' (double): 0.98,
'carBrand' (str): 'Kia',
'carBrandModel' (str): 'Cerato',
'carBrandModelScore' (double): 0.999257,
'country' (str): 'RUS',
'countryScore' (double): 0.997342,
'carImg' (numpy.ndarray, optional): [...],
'licensePlateImg' (numpy.ndarray, optional): [...],
},
'detections' (list(dict)): [{
'frameId' (int): 12,
'x' (int): 1282,
'y' (int): 1390,
'width' (int): 200,
'height' (int): 120,
}, ...],
'operation' (str): 'recogn_update',
}
«trackID» and «vehicleData» blocks include general information about the vehicle and LP. The description of the «trackId» and «vehicleData» fields is given in Table 12.
Table 12. «trackId» and «vehicleData» fields
Field | Description | Type |
---|---|---|
trackId | Vehicle track id | Int |
licensePlate | Car license plate’s data | String |
licensePlateScore | Score confidence of responsed license plate | Double |
vehicleType | Type of the vehicle | String |
vehicleTypeScore | Score confidence of determining the vehicle type | Double |
vehicleEmergencyType | Vehicle emergency type | String |
vehicleEmergencyTypeScore | Score confidence of responsed vehicle type | Double |
carBrand | Recognized car brand | String |
carBrandModel | Recognized car model | String |
carBrandModelScore | Score confidence of responsed car model | Double |
country | Car license plate country | String |
countryScore | Score confidence of responsed license plate country | Double |
carImg | Car img represented as numpy array | numpy.ndarray |
licensePlateImg | Car license plate img represented as numpy array | numpy.ndarray |
«detections» block includes information about the position of the vehicle and LP on the frame. The description of the «detections» fields is given in Table 13.
Table 13. «Detections» fields
Field | Description | Type |
---|---|---|
frameId | Bbox vehicle ID | Int |
x | X coordinate bbox | Int |
y | Y coordinate bbox | Int |
width | Bbox width | Int |
height | Bbox height | Int |
|«operations» field includes the type of operation performed. The description of the «operations» possible values is given in Table 14.
Table 14. Description of the «operations» field
Field | Description | Type |
---|---|---|
recogn_update | The best shot of the current track | String |
track_end | Track end event | String |