AxisCommunications / tutorial-axis-object-analytics-to-grafana

Visualizing AXIS Object Analytics data in Grafana.
https://www.axis.com/products/axis-object-analytics
Apache License 2.0
10 stars 0 forks source link

Cannot get expected MQTT message content #2

Open qraleq opened 10 months ago

qraleq commented 10 months ago

Hi, I'm trying to follow your instructions to send MQTT data to AWS IoT.

When I get a message from my camera (Axis Q-6135-LE running on 11.5.64) on the MQTT test client on AWS IoT, it looks like this:

{
  "topic": "axis:CameraApplicationPlatform/ObjectAnalytics/Device1ScenarioANY",
  "timestamp": 1692892990562,
  "serial": "B8A44F4DAC06",
  "message": {
  "source": {},
  "key": {},
  "data": {
  "active": "0"
}
}
}

while this is the output that they get in the tutorial.

{
  "topic": "axis:CameraApplicationPlatform/ObjectAnalytics/Device1Scenario1",
  "timestamp": 1670518346712,
  "serial": "0123456789AB",
  "message": {
  "source": {},
  "key": {},
  "data": {
  "startTime": "2022-12-06T22:01:25Z",
  "reason": "car",
  "total": "20960",
  "totalBus": "0",
  "totalCar": "18103",
  "totalHuman": "0",
  "totalMotorcycle/bicycle": "0",
  "totalTruck": "2857",
  "totalUnknown": "0"
}
}
}

How can I get the camera to send the additional metadata that is contained in the sample MQTT message?

Thank you!

mattias-kindborg-at-work commented 10 months ago

Hi! I think the structure of the data depends on the scenario created in AXIS Object Analytics. Please verify that you've created a scenario in AXIS Object Analytics and that it is of the correct type.

qraleq commented 10 months ago

@mattias-kindborg-at-work I was able to get the format that is described in the README by subscribing to Device1Scenario1 instead of Device1ScenarioANY, but the additional metadata is available only for line crossing, and not available for object detection in a region. I'm wondering if there's documentation where I could find the formats returned by MQTT and the metadata for each event type?

Thank you!

mattias-kindborg-at-work commented 10 months ago

I think the best way is to trigger the scenario while subscribed to the broker to see the format of the payload.

qraleq commented 10 months ago

Unfortunately, the format looks like this:

{
  "topic": "axis:CameraApplicationPlatform/ObjectAnalytics/Device1ScenarioANY",
  "timestamp": 1692892990562,
  "serial": "B8A44F4DAC06",
  "message": {
  "source": {},
  "key": {},
  "data": {
  "active": "0"
}
}
}

If I create a object analytics scenario where I have people and vehicles defined as triggering objects, this response doesn't give me context on what was detected, and I would expect to get something closer to the line crossing response.

Thank you.

mattias-kindborg-at-work commented 10 months ago

Can you create different scenarios for different objects, and use topic to differentiate them?

qraleq commented 10 months ago

Yes, I could do that, but it seems like a hacky solution for something that should be supported out-of-the-box. Do you have any insights if this will be supported in the upcoming versions of Axis firmware?

mattias-kindborg-at-work commented 10 months ago

No, sorry.