MTMC

mdxWebApiCore.Services. MTMC

Class used for obtaining MTMC related information.

Constructor

new MTMC()

Source:

Methods

(async) consumeAMRMessages(messageBroker)

Description:
  • consumes incoming AMR messages.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const kafka = new mdx.Utils.Kafka({brokers: ["kafka-broker-url"]}, kafkaConfigMap);
let mtmcObject = new mdx.Services.MTMC();
await mtmcObject.consumeAMRMessages(kafka);
Parameters:
Name Type Description
messageBroker MessageBroker MessageBroker Object

(async) consumeRTLSMessages(messageBroker)

Description:
  • consumes incoming rtls messages.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const kafka = new mdx.Utils.Kafka({brokers: ["kafka-broker-url"]}, kafkaConfigMap);
let mtmcObject = new mdx.Services.MTMC();
await mtmcObject.consumeRTLSMessages(kafka);
Parameters:
Name Type Description
messageBroker MessageBroker MessageBroker Object

(async) getBehaviorsSimilarToEmbeddings(vectorDb, input) → {Promise.<Array.<Object>>}

Description:
  • returns behavior info with similar embeddings from vectorDb.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const milvus = new mdx.Utils.Milvus({url: "milvus-url"},databaseConfigMap);
let input = {fromTimestamp: "2023-01-12T11:20:10.000Z", toTimestamp: "2023-01-12T14:20:10.000Z", embedding: embedding, sensorIdOfExample: "abc", objectIdOfExample: "120", timestampOfExampleBehavior: "2023-01-12T12:00:00.000Z" };
let mtmc = new mdx.Services.MTMC();
let similarBehaviorInfo = await mtmc.getBehaviorsSimilarToEmbeddings(milvus, input);
Parameters:
Name Type Description
vectorDb Database Database Object
input Object Input object.
Properties
Name Type Attributes Default Description
sensorIdOfExample string <optional>
<nullable>
null Atleast one of (sensorIdOfExample, objectIdOfExample and timestampOfExampleBehavior) or sensorId should be present
objectIdOfExample string <optional>
<nullable>
null Atleast one of (sensorIdOfExample, objectIdOfExample and timestampOfExampleBehavior) or sensorId should be present
timestampOfExampleBehavior string <optional>
<nullable>
null Atleast one of (sensorIdOfExample, objectIdOfExample and timestampOfExampleBehavior) or sensorId should be present
sensorId string <optional>
<nullable>
null Atleast one of (sensorIdOfExample, objectIdOfExample and timestampOfExampleBehavior) or sensorId should be present
embedding Array.<number>
fromTimestamp string
toTimestamp string
topKMatches number <optional>
50 topKMatches must be an integer.
matchScoreThreshold number <optional>
0.65
Returns:
Info of behaviors with similar embeddings are returned
Type
Promise.<Array.<Object>>

(async) getLocationsOfMatchedBehaviors(documentDb, input) → {Promise.<Object>}

Description:
  • returns locations of matched objects.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {globalId: "12", fromTimestamp: "2023-01-12T11:20:10.000Z", toTimestamp: "2023-01-12T14:20:10.000Z"};
let mtmc = new mdx.Services.MTMC();
let behaviors = await mtmc.getLocationsOfMatchedBehaviors(elastic, input);
Parameters:
Name Type Description
documentDb Database Database Object
input Object Input object.
Properties
Name Type Attributes Description
fromTimestamp string
toTimestamp string
behaviorIds Array.<string> <optional>
Either behaviorIds or globalId should be present.
globalId string <optional>
Either behaviorIds or globalId should be present.
Returns:
Locations of matched objects are returned
Type
Promise.<Object>

getNormalizedEmbedding(embedding) → {Array.<number>}

Description:
  • returns normalized embedding.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
let mtmc = new mdx.Services.MTMC();
let normalizedEmbedding = mtmc.getNormalizedEmbedding(embedding);
Parameters:
Name Type Description
embedding Array.<number>
Returns:
Normalized embedding is returned
Type
Array.<number>

(async) getSimilarBehaviorsBasedOnExample(documentDb, vectorDb, input) → {Promise.<Object>}

Description:
  • returns an object containing scored behaviors which are similar to the input example.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
const milvus = new mdx.Utils.Milvus({url: "milvus-url"},databaseConfigMap);
let input = {sensorIdOfExample: "abc", objectIdOfExample: "120", timestampOfExample: "2023-01-12T12:02:00.000Z"};
let mtmc = new mdx.Services.MTMC();
let behaviors = await mtmc.getSimilarBehaviorsBasedOnExample(elastic, milvus, input);
Parameters:
Name Type Description
documentDb Database Database Object
vectorDb Database Database Object
input Object Input object.
Properties
Name Type Attributes Default Description
sensorIdOfExample string
objectIdOfExample string
timestampOfExample string <optional>
Either timestampOfExample or frameIdOfExample should be present
frameIdOfExample string <optional>
Either timestampOfExample or frameIdOfExample should be present
sensorId string <optional>
<nullable>
null
hoursAgo number <optional>
48 hoursAgo must be an integer. Either (fromTimestamp and toTimestamp) or hoursAgo can be present. timeRange (fromTimestamp, toTimestamp) and hoursAgo are mutually exclusive.
fromTimestamp string <optional>
Either (fromTimestamp and toTimestamp) or hoursAgo can be present. timeRange (fromTimestamp, toTimestamp) and hoursAgo are mutually exclusive.
toTimestamp string <optional>
Either (fromTimestamp and toTimestamp) or hoursAgo can be present. timeRange (fromTimestamp, toTimestamp) and hoursAgo are mutually exclusive.
topKMatches number <optional>
50 topKMatches must be an integer.
matchScoreThreshold number <optional>
0.65
Returns:
Scored behaviors which are similar to the input example are returned
Type
Promise.<Object>

(async) getUniqueObjectCount(documentDb, input) → {Promise.<Object>}

Description:
  • returns unique object count.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorIds: ["abc"], timestamp: "2023-01-12T11:20:10.000Z", timeWindowInMs: 100};
let mtmc = new mdx.Services.MTMC();
let uniqueObjectCount = await mtmc.getUniqueObjectCount(elastic, input);
Parameters:
Name Type Description
documentDb Database Database Object
input Object Input object.
Properties
Name Type Attributes Default Description
timestamp string
timeWindowInMs string
sensorIds Array.<string> <optional>
Either sensorIds or place can be present. They are mutually exclusive. Exactly one sensorId should be in the array when objectId is present.
objectId string <optional>
<nullable>
null
place string <optional>
Either sensorIds or place can be present. They are mutually exclusive.
Returns:
An object containing unique object count is returned
Type
Promise.<Object>

(async) getUniqueObjectCountWithLocations(documentDb, messageBroker, input) → {Promise.<Object>}

Description:
  • returns an object containing unique object count of a place with object locations.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
const kafka = new mdx.Utils.Kafka({brokers: ["kafka-broker-url"]}, kafkaConfigMap);
let input = {place: "building=abc/room=xyz"};
let mtmc = new mdx.Services.MTMC();
let uniqueObjectCountWithLocations = await mtmc.getUniqueObjectCountWithLocations(elastic,kafka,input);
Parameters:
Name Type Description
documentDb Database Database Object
messageBroker MessageBroker MessageBroker Object
input Object Input object.
Properties
Name Type Attributes Default Description
place string
timestamp string <optional>
<nullable>
null
timeWindowInMs number <optional>
3000 timeWindowInMs must be an integer.
amrTimestampWindowInMs number <optional>
200 amrTimestampWindowInMs must be an integer.
amrWithoutRtlsMinTimestampThresholdInMs number <optional>
2000 amrWithoutRtlsMinTimestampThresholdInMs must be an integer.
amrRouteMinTimestampThresholdInMs number <optional>
1000 amrRouteMinTimestampThresholdInMs must be an integer.
amrRouteMaxTimestampThresholdInMs number <optional>
200 amrRouteMaxTimestampThresholdInMs must be an integer.
Returns:
Unique object count of a place along with object locations is returned
Type
Promise.<Object>

(async) getUniqueObjects(documentDb, input) → {Promise.<Object>}

Description:
  • returns unique objects.
Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorIds: ["abc"], fromTimestamp: "2023-01-12T11:20:10.000Z", toTimestamp: "2023-01-12T14:20:10.000Z"};
let mtmc = new mdx.Services.MTMC();
let uniqueObjects = await mtmc.getUniqueObjects(elastic, input);
Parameters:
Name Type Description
documentDb Database Database Object
input Object Input object.
Properties
Name Type Attributes Default Description
fromTimestamp string
toTimestamp string
sensorIds Array.<string> <optional>
Either sensorIds, globalId or place can be present. They are mutually exclusive. Exactly one sensorId should be in the array when objectId is present.
objectId string <optional>
<nullable>
null
place string <optional>
Either sensorIds, globalId or place can be present. They are mutually exclusive.
globalId string <optional>
Either sensorIds, globalId or place can be present. They are mutually exclusive.
maxResultSize number <optional>
25 maxResultSize must be an integer. globalId and maxResultSize can't occur together.
Returns:
Unique objects are returned
Type
Promise.<Object>