Event: HTTP Generic Event Send Metadata with boundary boxes

Answered

Comments

16 comments

  • Avatar
    Andrey Terentyev

    Hello,

    Could you please provide OS version, VMS build number?

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    LastOne: metavms-bundle-5.0.0.36634-windows_x64

    Windows 11 and 2022 Server

    I expected to post HTTP API something like this

    {
    "timestamp": "2016-09-16T16:02:41Z",
    "caption": "CreditCardUsed",
    "metadata": {
    "cameraRefs": [
    "3A4AD4EA-9269-4B1F-A7AA-2CEC537D0240"
    ],
    Polygon1 { .... },
    Polygon2 { .... },
     
    }
    }

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Thanks for the detail.

    Could you please tell more about your business case, your scenario? What is supposed to be framed by bounding boxes in your scenario?

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    We have an AI that processes video frame by frame, captioning stream directly from cameras.

    The same stream goes into the VMS. 

    So we want to put events generated by our AI into the VMS.

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Ok. I see. Thanks.

    At the moment, there is no REST API to push metadata for events or object.

    You need to develop an analytics plugin.

    Here are the articles to start with to make yourself familiar with the topic

    https://meta.nxvms.com/docs/developers/knowledgebase/195-1-integration-capabilities--what-to-expect

    https://meta.nxvms.com/docs/developers/knowledgebase/200-introduction-to-creating-a-video-analytics-plugin

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    Your C++ SDK is using the same JSON structures to operate with VMS.

    As I understand, your VMS also uses SQLite for storing metadata. Is it a supported scenario to store data from 3rd party directly in the VMS database? 

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello,

    Is it a supported scenario to store data from 3rd party directly in the VMS database? 

    No, it isn't.

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    Your colleague mentioned that 5.2 is a planned introduction API (REST to post Event with METADATA).

    What is the estimated timeframe for it?

    Is it any lighter solution than introducing a C++-based plugin into the system?

     

     

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Your colleague mentioned that 5.2 is a planned introduction API (REST to post Event with METADATA).

    That's correct.

    Even v5.1 is not yet released, so there is no schedule for v5.2 at the moment.

    At the moment, the easiest way would be refactoring the sample_analytics_plugin (aka "hello world" pluigin) of Metadata SDK by introducing a thread listening on a network socket for JSON messaged.

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    So my analytical plugin will act as a server running on the VMS side. Will ignore frames from VMS and just listening certain TCP port for the event data message, and store this message in your SQLite DB.

    Could the plugin can be written in a different language?  

    if I do not depend on frames from VMS, why do I still need a plugin running on VMS context?

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    So my analytical plugin will act as a server running on the VMS side. Will ignore frames from VMS and just listening certain TCP port for the event data message, and store this message in your SQLite DB.

    The plugin won't write anything to the SQLite DB directly. Instead, using Metadata SDK classes, it will pass metadata to the Server via metadata packet. That's it. Afterward, it's up to the Server to deal with metadata.

    Here is the Control Flow diagram with detailed technical description.

    https://meta.nxvms.com/docs/developers/knowledgebase/204-plugin-control-flow

    if I do not depend on frames from VMS, why do I still need a plugin running on VMS context?

    To be able to pass metadata packets from the plugin to the Server.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Could the plugin can be written in a different language? 

    Technically it could, however,

    1. The resulting file should be a binary file.

    2. The final binary should be either a .DLL for Windows or .so library for Linux.

    3. The final binary should comply with С++ ABI presented in the Metadata SDK.

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    One More Question, to better understand your plugin model

    Is your plugin model stateful or stateless?

    So when you load the plugin, how is your system calling 

    pushUncomressedFrames() and pullMetadataPackets() sequence.

    If the plugin is stateful, where is the best place to create network listeners for th3-party AI's.

     

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi Irakli,

    So when you load the plugin, how is your system calling pushUncomressedFrames() and pullMetadataPackets() sequence.

    According to the SDK documentation

    bool nx::sdk::analytics::ConsumingDeviceAgent::pullMetadataPackets  (   std::vector< IMetadataPacket *> *   metadataPackets )

    Override to send the newly constructed metadata packets to Server - add the packets to the provided list. Called after pushVideoFrame() to retrieve any metadata packets available to the moment (not necessarily referring to that frame). As an alternative, send metadata to Server by calling pushMetadataPacket() instead of implementing this method. 

    Is your plugin model stateful or stateless?

    I'm afraid, I don't understand your question. Could you please elaborare?

    If you need a network listener per camera, it would be DeviceAgent constructor.

    If you want on network listener for all cameras, it would be Engine class constructor.

    0
    Comment actions Permalink
  • Avatar
    Irakli Lomidze

    Hello Andrey,

    What I mean is that some applications load DLL and call some functions. That's what your VMS is doing,

    it loads each plugin and calls predefined functions like ( pushMetadataPacket) for each one. 

    Stateless means, in our case, that your VMS is calling the function pushMetadataPacket in a predefined sequence. There is no way to implement some listeners in the plugin. The only way we left it was to call the-3 party AI server within pushMetadataPacket() function.

     

    Stateful means that I can make my own loop, e.g., HTTP server, and call pushMetadataPacket() by triggering some event. As your C++ SDK does not refer to any DLL or binary, I think your plugin model is stateless.

    Please correct me if I'm wrong. 

     

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello,

    Stateful means that I can make my own loop, e.g., HTTP server, and call pushMetadataPacket() by triggering some event.

    When a plugin binary is loaded, you can do that: create a separate thread, with a loop and call pushMetadataPacket() periodically.

    Here is a quotation from the guide by the link above

    You can choose either one of the "push" or "pull" paradigms depending on the desired workflow in the Plugin. The differences are:

    • pushMetadataPacket() is called by the Plugin, while pullMetadataPackets() is called by the Server.
    • pushMetadataPacket() expects one metadata packet, while pullMetadataPackets() expects a std::vector of them
    0
    Comment actions Permalink

Please sign in to leave a comment.