Hi,
We noticed inconsistent behavior in the API response when querying objectType
for ROI occupancy metrics. Specifically, if the count for one or more specified objectType
values is 0
, the response sometimes only includes a generic count (*
), and omits the breakdown by object type. However, when increasing the time window or modifying the query, the response can include all object types.
Additionally, we observed similar issues with the histogram v2 API, while the v1 API seems to behave more reliably. Below are the details.
Here’s a detailed breakdown:
Setup:
- Hardware Platform: Jetson Orin NX 16GB/8GB
- Jetpack 6.2 (L4T 36.4.3)
- ai_nvr 2.0.1 (jps_v1.2.9)
1. Query without objectType
having zero counts
GET /emdx/api/v2/metrics/occupancy/roi?sensorId=CORRIENTES&roiId=3777029a-e55e-453d-9d6e-4cde64ad7408&toTimestamp=2025-01-23T13:48:00.000Z&fromTimestamp=2025-01-23T13:47:00.000Z&objectType=car,bus,motorbike
Response:
{
"roiOccupancy": [
{
"roiId": "3777029a-e55e-453d-9d6e-4cde64ad7408",
"objects": [
{"averageCount": 1.0, "sumCount": 1.0, "type": "bus"},
{"averageCount": 3.11, "sumCount": 18.0, "type": "car"},
{"averageCount": 1.0, "sumCount": 1.0, "type": "motorbike"},
{"averageCount": 3.47, "sumCount": 20.0, "type": "*"}
]
}
]
}
2. Query with objectType
including a type with zero counts
GET /emdx/api/v2/metrics/occupancy/roi?sensorId=CORRIENTES&roiId=3777029a-e55e-453d-9d6e-4cde64ad7408&toTimestamp=2025-01-23T13:48:00.000Z&fromTimestamp=2025-01-23T13:47:00.000Z&objectType=car,bus,motorbike,truck
Response:
{
"roiOccupancy": [
{
"roiId": "3777029a-e55e-453d-9d6e-4cde64ad7408",
"objects": [
{"averageCount": 3.47, "sumCount": 20.0, "type": "*"}
]
}
]
}
3. Increasing the time window (same query as above)
GET /emdx/api/v2/metrics/occupancy/roi?sensorId=CORRIENTES&roiId=3777029a-e55e-453d-9d6e-4cde64ad7408&toTimestamp=2025-01-23T13:58:00.000Z&fromTimestamp=2025-01-23T13:47:00.000Z&objectType=car,bus,motorbike,truck
Response:
{
"roiOccupancy": [
{
"roiId": "3777029a-e55e-453d-9d6e-4cde64ad7408",
"objects": [
{"averageCount": 1.0, "sumCount": 1.0, "type": "bus"},
{"averageCount": 3.69, "sumCount": 182.0, "type": "car"},
{"averageCount": 1.01, "sumCount": 23.0, "type": "motorbike"},
{"averageCount": 1.0, "sumCount": 3.0, "type": "truck"},
{"averageCount": 3.88, "sumCount": 209.0, "type": "*"}
]
}
]
}
4. Using *
in objectType
query
GET /emdx/api/v2/metrics/occupancy/roi?sensorId=CORRIENTES&roiId=3777029a-e55e-453d-9d6e-4cde64ad7408&toTimestamp=2025-01-23T13:58:00.000Z&fromTimestamp=2025-01-23T13:47:00.000Z&objectType=*
Response:
{
"roiOccupancy": [
{
"roiId": "3777029a-e55e-453d-9d6e-4cde64ad7408",
"objects": [
{"averageCount": 3.88, "sumCount": 209.0, "type": "*"}
]
}
]
}
5. Histogram API: Issues with v2
and better results with v1
We also observed inconsistent behavior with the histogram v2 API. For example:
5.1 V2
GET /api/v2/metrics/occupancy/roi/histogram?fromTimestamp=2025-01-23T13:47:00.000Z&toTimestamp=2025-01-23T13:50:00.000Z&roiId=3777029a-e55e-453d-9d6e-4cde64ad7408&sensorId=CORRIENTES&objectType=*
Response:
File response_v2.txt
response_v2.txt (27.0 KB)
5.1 V1
GET /api/metrics/occupancy/roi/histogram?fromTimestamp=2025-01-23T13:47:00.000Z&toTimestamp=2025-01-23T13:50:00.000Z&roiId=3777029a-e55e-453d-9d6e-4cde64ad7408&sensorId=CORRIENTES&objectType=*
Response:
File response_v1.txt
response_v1.txt (42.3 KB)
When testing the same query with histogram v1, the response is more consistent and includes detailed counts for all object types, even when they are 0
. This suggests the issue might be specific to the v2 implementation.
Expected Behavior
We expect the response to consistently include all object types specified in the query, even if the count for some types is 0
.
Is this the intended behavior, or could this be an issue in the API? The same behavior is observed with the fov
endpoint, and v1 API version on Occupancy count.
Similarly, the histogram v2 API should behave consistently and match the reliability of v1.