Commit 77e9fc8c authored by das-qa's avatar das-qa
Browse files

Add deepstream-test3 deepstream-test4 and deepstream_mqtt_test

parent 633cf47f
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
APP:= deepstream-test4-app
TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
NVDS_VERSION:=7.1
LIB_INSTALL_DIR?=/opt/deepstream/lib/
APP_INSTALL_DIR?=/opt/deepstream/bin/
ifeq ($(TARGET_DEVICE),aarch64)
CFLAGS:= -DPLATFORM_TEGRA
endif
C_SRCS:= $(wildcard *.c)
CPP_SRCS:= $(wildcard *.cpp)
INCS:= $(wildcard *.h)
PKGS:= gstreamer-1.0
OBJS:= $(CPP_SRCS:.cpp=.o) $(C_SRCS:.c=.o)
CFLAGS+= -I/opt/deepstream/include/ \
-I /opt/dtk/cuda/cuda-12/targets/x86_64-linux/include
CFLAGS+= $(shell pkg-config --cflags $(PKGS))
LIBS:= $(shell pkg-config --libs $(PKGS))
LIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_meta -lnvds_meta -lrt \
-I /opt/dtk/cuda/cuda-12/targets/x86_64-linux/lib -lcudart -lnvds_yml_parser \
-lnvbufsurface_sugon -lnvdsgst_helper \
-lcuda -lyaml-cpp -Wl,-rpath,$(LIB_INSTALL_DIR)
all: $(APP)
%.o: %.cpp $(INCS) Makefile
$(CXX) -c -o $@ $(CFLAGS) $<
%.o: %.c $(INCS) Makefile
$(CC) -c -o $@ $(CFLAGS) $<
$(APP): $(OBJS) Makefile
$(CXX) -o $(APP) $(OBJS) $(LIBS)
install: $(APP)
cp -rv $(APP) $(APP_INSTALL_DIR)
clean:
rm -rf $(OBJS) $(APP)
*****************************************************************************
* SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*****************************************************************************
*****************************************************************************
deepstream-test4-app
README
*****************************************************************************
===============================================================================
1. Prerequisites:
===============================================================================
Please follow instructions in the apps/sample_apps/deepstream-app/README on how
to install the prerequisites for Deepstream SDK, the DeepStream SDK itself and
the apps.
You must have the following development packages installed
GStreamer-1.0
GStreamer-1.0 Base Plugins
GStreamer-1.0 gstrtspserver
X11 client-side library
To install these packages, execute the following command:
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
libgstrtspserver-1.0-dev libx11-dev
This example can be configured to use either the nvinfer or the nvinferserver
element for inference.
If nvinferserver is selected, the Triton Inference Server is used for inference
processing. In this case, the example needs to be run inside the
DeepStream-Triton docker container. Please refer
samples/configs/deepstream-app-triton/README for the steps to download the
container image and setup model repository.
#Deepstream msgbroker supports sending messages to Azure(mqtt) IOThub, kafka, AMQP broker(rabbitmq) and Redis
Dependencies
------------
Azure Iot:
----------
Refer to the README files available under
/opt/nvidia/deepstream/deepstream/sources/libs/azure_protocol_adaptor
for detailed documentation on prerequisites and usages of Azure protocol
adaptor with the message broker plugin for sending messages to cloud.
Kafka:
------
Refer to the README file available under
/opt/nvidia/deepstream/deepstream/sources/libs/kafka_protocol_adaptor
for detailed documentation on prerequisites and usages of kafka protocol
adaptor with the message broker plugin for sending messages to cloud.
AMQP (rabbitmq):
----------------
Install rabbitmq-c library
--------------------------
Refer to the README file available under
/opt/nvidia/deepstream/deepstream/sources/libs/amqp_protocol_adaptor
for detailed documentation on prerequisites and usages of rabbitmq based
amqp protocol adaptor with the message broker plugin for sending messages to cloud.
Redis:
------
Refer to the README file available under
/opt/nvidia/deepstream/deepstream/sources/libs/redis_protocol_adaptor
for detailed documentation on prerequisites and usages of redis protocol
adaptor with the message broker plugin for sending messages to cloud.
SETUP:
1.Use --proto-lib or -p command line option to set the path of adaptor library.
Adaptor library can be found at /opt/nvidia/deepstream/deepstream/lib
kafka lib - libnvds_kafka_proto.so
azure device client - libnvds_azure_proto.so
AMQP lib - libnvds_amqp_proto.so
Redis lib - libnvds_redis_proto.so
2.Use --conn-str command line option as required to set connection to backend server.
For Azure - Full Azure connection string
For Kafka - Connection string of format: host;port
For Amqp - Connection string of format: host;port;username;password
For Redis - Connection string of format: host;port
Provide connection string under quotes. e.g. --conn-str="host;port;topic;password"
3.Use --topic or -t command line option to provide message topic
4.Use --schema or -s command line option to select the message schema (optional).
Json payload to send to cloud can be generated using different message schemas.
schema = 0; Full message schema with separate payload per object (Default)
schema = 1; Minimal message with multiple objects in single payload.
schema = 2; Protobuf encoded message with multiple objects in single payload.
Refer user guide to get more details about message schema.
5.Use --no-display to disable display.
6.Use --msg2p-meta to choose the metadata type to create payload (optional).
0=Event Msg meta(default), Create NVDS_EVENT_MSG_META type of meta and attach to buffer
1=nvdsmeta, Use the fields within NvDsFrameMeta/NvDsObjectMeta to populate payload
7.Use --frame-interval to specify frame interval to generate message payload
default value=30; Message payloads generated every 30 frames
8.Use --cfg-file or -c command line option to set adaptor configuration file.
This is optional if connection string has all relevent information.
For kafka: use /opt/nvidia/deepstream/deepstream/sources/libs/kafka_protocol_adaptor/cfg_kafka.txt as reference.
This file is used to define the parition key field to be used while sending messages to the
kafka broker. Refer Kafka Protocol Adaptor section in the DeepStream Plugin Manual for
more details about using this config option. The partition-key setting within the cfg_kafka.txt
should be set based on the schema type selected using the --schema option. Set this to
"sensor.id" in case of Full message schema, and to "sensorId" in case of Minimal message schema
For Azure, use /opt/nvidia/deepstream/deepstream/sources/libs/azure_protocol_adaptor/device_client/cfg_azure.txt as reference.
It has the following section:
[message-broker]
#connection_str = HostName=<my-hub>.azure-devices.net;DeviceId=<device_id>;SharedAccessKey=<my-policy-key>
#custom_msg_properties = <key>=<value>;
#share-connection=1
Azure device connection string:
-------------------------------
You can provide the connection_str within cfg_azure.txt of format:
connection_str = HostName=<my-hub>.azure-devices.net;DeviceId=<device_id>;SharedAccessKey=<my-policy-key>
OR
you can pass in full connection string with --conn-str option
For AMQP, use /opt/nvidia/deepstream/deepstream/sources/libs/amqp_protocol_adaptor/cfg_amqp.txt as reference.
It has the following default options:
[message-broker]
password = guest
hostname = localhost
username = guest
port = 5672
exchange = amq.topic
topic = topicname
#share-connection=1
AMQP connection string:
----------------------
Provide hostname, port, username, password details in the cfg_amqp.txt
OR
you can pass in full connection string with --conn-str option in format: "hostname;port;username;password"
For Redis, use /opt/nvidia/deepstream/deepstream/sources/libs/redis_protocol_adaptor/cfg_redis.txt as reference.
It has the following default options:
[message-broker]
hostname=localhost
port=6379
consumergroup=mygroup
consumername=myname
streamsize=10000
share-connection = 1
Redis connection string:
----------------------
Provide hostname, port details in the cfg_redis.txt
OR
you can pass in full connection string with --conn-str option in format: "hostname;port"
NOTE:
- DO NOT delete the line [message-broker] in cfg file. Its the section identifier used for parsing
- Share connection
----------------
#share-connection=1
Uncomment the field share-connection in cfg_*.txt and set its value to 1
if you need to generate a connection signature. This signature is a unique string
which is generated by parsing all the connection related params used for making a connection.
Uncommenting this field signifies that the connection created can be shared
with other components within the same process.
7. Enable logging:
Go through the README to setup & enable logs for the messaging libraries(kafka, azure, amqp)
$ cat ../../../tools/nvds_logger/README
===============================================================================
2. Purpose:
===============================================================================
This sample builds on top of the deepstream-test1 sample to demonstrate to use
"nvmsgconv" and "nvmsgbroker" plugins in the pipeline. Create NVDS_EVENT_MSG_META
type of meta and attach to buffer. NVDS_EVENT_MSG_META is used for different types
of objects e.g. vehicle, person etc.
===============================================================================
3. To compile:
===============================================================================
$ Set CUDA_VER in the MakeFile as per platform.
For both Jetson & x86, CUDA_VER=12.6
$ sudo make (sudo not required in case of docker containers)
NOTE: To compile the sources, run make with "sudo" or root permission.
===============================================================================
4. Usage:
===============================================================================
Two ways to run the application:
1.Run with command line arguments as shown below. In this method, user needs to modify the source
code of deepstream-test4-app to configure pipeline properties.
$ ./deepstream-test4-app -i <H264 filename> -p <Proto adaptor library> --conn-str=<Connection string> --topic=<topicname> -s <0/1>
2.Run with the yml file. In this method, user needs to update the yml file to configure
pipeline properties.
$ ./deepstream-test4-app <yml file>
e.g. $ ./deepstream-test4-app dstest4_config.yml
The GIE configuration group in the YAML configuration file of the application
can be used to set the inference plugin type (nvinfer or nvinferserver) and
corresponding plugin configuration file.
3.Send the image by the broker based on Kafka
1) Change the parameters of msgconv filed in the dstest4_config.yml
2) Run with the yml file
$ ./deepstream-test4-app <yml file>
e.g. $ ./deepstream-test4-app dstest4_config.yml
3) The format of the image message
Image message fields are separated by ";".
Specific Format: "image;image_format;image_widthximage_height;time;encoded_data;"
For Example: "image;jpg;640x480;2023-07-31T10:20:13;xxxxxxxxxxx;"
4) How to decode the data encoded by base64 for consumer
C/C++ snippet code
-----------------
#include <glib.h>
gsize size = 0;
guchar *decoded_data = g_base64_decode (encoded_data, &size);
-----------------
Python snippet code
-----------------
import base64
decoded_data = base64.b64decode(encoded_data)
-----------------
NOTE: More details about the message adapters can be found at README inside DS_PACKAGE_DIR/sources/libs/*_protocol_adaptor
Update the msgbroker properties, "proto-lib", "conn-str" and "topic" accordingly in the dstest4_config.yml before running
the application.
Azure Iotedge runtime integration of deepstream-test4-app:
----------------------------------------------------------
# Refer to sections within DS_PACKAGE_DIR/sources/libs/azure_protocol_adaptor/module_client/README to:
1. Create azure IotHub
2. Register a new Azure IoT Edge device from the Azure portal
3. Setup and install Azure Iot Edge on your machine
4. Install dependencies
5. Specify connection string
6. Use cfg file (optional)
7. Install & setup nvidia-docker
8. Deploy a iotedge module
9. Start the edge runtime
# On Azure iothub deployment page, use the information below as an example to use deepstream-test4-app using
* sample video stream (sample_720p.h264)
* send messages with minimal schema
* with display disabled
* Message topic = mytopic
(Note: Message topic cant be empty)
NOTE: Sign up & create a Nvidia GPU Cloud account to be to pull containers : https://ngc.nvidia.com/
Once you sign in goto Dashboard->Configuration->Get API key (to get your nvcr.io Authentication details)
Deployment of a Module:
-----------------------
On the Azure portal, Click on the Iot edge device you have created and click Set Modules:
Container Registry Settings:
Name: NGC
Address: nvcr.io
User Name: $oauthtoken
Password: <password (or API key) from your NGC account>
Deployment modules:
Add new module:
- Name: ds
- Image URI:
For x86 dockers:
docker pull nvcr.io/nvidia/deepstream:<tag>-devel
docker pull nvcr.io/nvidia/deepstream:<tag>-samples
docker pull nvcr.io/nvidia/deepstream:<tag>-iot
docker pull nvcr.io/nvidia/deepstream:<tag>-base
docker pull nvcr.io/nvidia/deepstream:<tag>-triton
For Jetson dockers:
docker pull nvcr.io/nvidia/deepstream-l4t:<tag>-samples
docker pull nvcr.io/nvidia/deepstream-l4t:<tag>-iot
docker pull nvcr.io/nvidia/deepstream-l4t:<tag>-base
- container Create options:
{
"HostConfig": {
"Runtime": "nvidia",
},
"WorkingDir": "/opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-test4",
"ENTRYPOINT":
[
"/opt/nvidia/deepstream/deepstream/bin/deepstream-test4-app",
"-i", "/opt/nvidia/deepstream/deepstream/ samples/streams/sample_720p.h264",
"-p",
"/opt/nvidia/deepstream/deepstream/lib/libnvds_azure_edge_proto.so",
"--no-display",
"-s",
"1",
"--topic",
"mytopic"
]
}
- specify route options for the module:
option 1) Default route where every message from every module is sent upstream
{
"routes": {
"route": "FROM /messages/* INTO $upstream"
}
}
option 2) you can mention specific routes where messages sent upstream based on topic name
ex: in the sample test programs, topic name "mytopic" is used for the module name ds
{
"routes": {
"route": "FROM /messages/modules/ds/outputs/mytopic INTO $upstream",
}
}
#Start the edge runtime and verify if modules are running:
---------------------------------------------------------
#Restart the iotedge on your system
sudo systemctl restart iotedge
#Give it a few seconds
#check edge runtime status
systemctl status iotedge
#List the modules running
sudo iotedge list
#check output from the modules
sudo iotedge logs ds
This document shall describe about the sample deepstream-test4 application.
This sample builds on top of the deepstream-test1 sample to demonstrate how to:
* Use "nvmsgconv" and "nvmsgbroker" plugins in the pipeline.
* Create NVDS_EVENT_MSG_META type of meta and attach to buffer.
* Use NVDS_EVENT_MSG_META for different types of objects e.g. vehicle, person etc.
* Provide copy / free functions if meta data is extended through "extMsg" field.
* Use "msg_custom_meta" to send images.
"nvmsgconv" plugin uses NVDS_EVENT_MSG_META type of metadata from the buffer
and generates the "DeepStream Schema" payload in Json format. Static properties
of schema are read from configuration file in the form of key-value pair.
Check dstest4_msgconv_config.txt for reference. Generated payload is attached
as NVDS_META_PAYLOAD type metadata to the buffer.
"nvmsgbroker" plugin extracts NVDS_META_PAYLOAD type of metadata from the buffer
and sends that payload to the server using APIs in nvmsgbroker C library.
Generating custom metadata for different type of objects:
In addition to common fields provided in NvDsEventMsgMeta structure, user can
also create custom objects and attach to buffer as NVDS_EVENT_MSG_META metadata.
To do that NvDsEventMsgMeta provides "extMsg" and "extMsgSize" fields. User can
create custom structure, fill that structure and assign the pointer of that
structure as "extMsg" and set the "extMsgSize" accordingly.
If custom object contains fields that can't be simply mem copied then user should
also provide function to copy and free those objects.
Refer generate_event_msg_meta() to know how to use "extMsg" and "extMsgSize"
fields for custom objects and how to provide copy/free function and attach that
object to buffer as metadata.
NOTE: This app by default sends message for first object of every 30th frame.
Default option uses NVDS_EVENT_MSG_META type (--msg2p-meta 0 or -m 0)
To change the frequency of messages, modify the following line in source code accordingly.
if (is_first_object && !(frame_number % frame_interval)) should be changed to:
if (!(frame_number % frame_interval)) //To get all objects of a single frame
If NvDsMeta type is used (--msg2p-meta 1 or -m 1),
every frame_interval, payload is generated and all objects in a frame are part of payload.
This diff is collapsed.
/*
* SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "deepstream_test4_yml_parse.h"
#include <yaml-cpp/yaml.h>
#include <string>
#include <iostream>
guint ds_test4_parse_meta_type(gchar *cfg_file_path, const char* group)
{
std::string paramKey = "";
auto docs = YAML::LoadAllFromFile(cfg_file_path);
int total_docs = docs.size();
guint val = 0;
for (int i =0; i < total_docs;i++)
{
if (docs[i][group]) {
if (docs[i][group]["msg2p-newapi"]) {
val= docs[i][group]["msg2p-newapi"].as<guint>();
return val;
}
}
}
return 0;
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#ifndef _DS_TEST4_YAML_PARSER_H_
#define _DS_TEST4_YAML_PARSER_H_
#include <gst/gst.h>
G_BEGIN_DECLS
guint ds_test4_parse_meta_type(gchar *cfg_file_path, const char* group);
G_END_DECLS
#endif
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
source:
location: ../../../streams/cr7_1920x1080.h264
streammux:
batch-size: 1
batched-push-timeout: 40000
width: 1920
height: 1080
msgconv:
#If you want to send images, please set the "payload-type: 1" and "msg2p-newapi: 1"
payload-type: 1
msg2p-newapi: 1
frame-interval: 30
msgbroker:
proto-lib: /opt/deepstream/lib/libnvds_mqtt_proto.so
conn-str: 127.0.0.1;1883
topic: /server/fromArm
sync: 0
sink:
sync: 1
# Inference using nvinferserver:
primary-gie:
plugin-type: 1
config-file-path: yolov5_nvinferserver_config.txt
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2018-2019 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
[sensor0]
enable=1
type=Camera
id=CAMERA_ID
location=45.293701447;-75.8303914499;48.1557479338
description="Entrance of Garage Right Lane"
coordinate=5.2;10.1;11.2
[place0]
enable=1
id=1
type=garage
name=XYZ
location=30.32;-40.55;100.0
coordinate=1.0;2.0;3.0
place-sub-field1=walsh
place-sub-field2=lane1
place-sub-field3=P2
[place1]
enable=1
id=1
type=garage
name=XYZ
location=28.47;47.46;1.53
coordinate=1.0;2.0;3.0
place-sub-field1="C-76-2"
place-sub-field2="LEV/EV/CP/ADA"
place-sub-field3=P2
[analytics0]
enable=1
id=XYZ
description="Vehicle Detection and License Plate Recognition"
source=OpenALR
version=1.0
\ No newline at end of file
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
sensor0:
enable: 1
type: Camera
id: CAMERA_ID
location: 45.293701447;-75.8303914499;48.1557479338
description: "Entrance of Garage Right Lane"
coordinate: 5.2;10.1;11.2
place0:
enable: 1
id: 1
type: garage
name: XYZ
location: 30.32;-40.55;100.0
coordinate: 1.0;2.0;3.0
place-sub-field1: walsh
place-sub-field2: lane1
place-sub-field3: P2
place1:
enable: 1
id: 1
type: garage
name: XYZ
location: 28.47;47.46;1.53
coordinate: 1.0;2.0;3.0
place-sub-field1: "C-76-2"
place-sub-field2: "LEV/EV/CP/ADA"
place-sub-field3: P2
analytics0:
enable: 1
id: XYZ
description: "Vehicle Detection and License Plate Recognition"
source: OpenALR
version: 1.0
\ No newline at end of file
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2018-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
infer_config {
unique_id: 1
gpu_ids: [0]
max_batch_size: 30
backend {
inputs: [ {
name: "input_1:0"
}]
outputs: [
{name: "output_cov/Sigmoid:0"},
{name: "output_bbox/BiasAdd:0"}
]
triton {
model_name: "Primary_Detector"
version: -1
model_repo {
root: "../../../../samples/triton_model_repo"
strict_model_config: true
}
}
}
preprocess {
network_format: MEDIA_FORMAT_NONE
tensor_order: TENSOR_ORDER_LINEAR
tensor_name: "input_1:0"
maintain_aspect_ratio: 0
frame_scaling_hw: FRAME_SCALING_HW_DEFAULT
frame_scaling_filter: 1
normalize {
scale_factor: 0.00392156862745098
channel_offsets: [0, 0, 0]
}
}
postprocess {
labelfile_path: "../../../../samples/models/Primary_Detector/labels.txt"
detection {
num_detected_classes: 4
per_class_params {
key: 0
value { pre_threshold: 0.4 }
}
nms {
confidence_threshold:0.2
topk:20
iou_threshold:0.5
}
}
}
extra {
copy_input_to_host_buffers: false
output_buffer_pool_size: 2
}
}
input_control {
process_mode: PROCESS_MODE_FULL_FRAME
operate_on_gie_id: -1
interval: 0
}
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2018-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
infer_config {
unique_id: 1
gpu_ids: [0]
max_batch_size: 1
backend {
inputs: [ {
name: "images"
}]
outputs: [
{name: "output0"}
]
triton {
model_name: "YOLOV5_FP16"
version: 1
model_repo {
root: "../../../sugon_samples/triton_model_repo"
strict_model_config: true
backend_dir: "/opt/deepstream/third_party/backends"
log_level: 1
}
}
}
preprocess {
network_format: IMAGE_FORMAT_RGB
tensor_order: TENSOR_ORDER_LINEAR
maintain_aspect_ratio: 0
frame_scaling_hw: FRAME_SCALING_HW_DEFAULT
frame_scaling_filter: 1
normalize {
scale_factor: 0.00392157
channel_offsets: [0, 0, 0]
}
}
postprocess {
labelfile_path: "../../../sugon_samples/labels/YOLOV5/labels.txt"
detection {
num_detected_classes: 80
per_class_params {
key: 0
value { pre_threshold: 0.4 }
}
nms {
confidence_threshold:0.2
topk:20
iou_threshold:0.5
}
custom_parse_bbox_func: "parseYolov5OutputBoundingBoxFP32"
}
}
extra {
copy_input_to_host_buffers: false
output_buffer_pool_size: 2
}
custom_lib {
path: "/opt/deepstream/lib/libnvdsinferserver__customparser_sugon.so"
}
}
input_control {
process_mode: PROCESS_MODE_FULL_FRAME
operate_on_gie_id: -1
interval: 0
}
*****************************************************************************
* SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*****************************************************************************
*****************************************************************************
deepstream-test1-app
README
*****************************************************************************
===============================================================================
1. Prerequisites:
===============================================================================
Please follow instructions in the apps/sample_apps/deepstream-app/README on how
to install the prerequisites for Deepstream SDK, the DeepStream SDK itself and the
apps.
You must have the following development packages installed
GStreamer-1.0
GStreamer-1.0 Base Plugins
GStreamer-1.0 gstrtspserver
X11 client-side library
To install these packages, execute the following command:
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
libgstrtspserver-1.0-dev libx11-dev
This example can be configured to use either the nvinfer or the nvinferserver
element for inference.
If nvinferserver is selected, the Triton Inference Server is used for inference
processing. In this case, the example needs to be run inside the
DeepStream-Triton docker container. Please refer
samples/configs/deepstream-app-triton/README for the steps to download the
container image and setup model repository.
===============================================================================
2. Purpose:
===============================================================================
This document shall describe about the sample deepstream-test1 application.
It is meant for demonstration of how to use the various DeepStream SDK
elements in the pipeline and extract meaningful insights from a video stream.
===============================================================================
3. To compile:
===============================================================================
$ Set CUDA_VER in the MakeFile as per platform.
For both Jetson & x86, CUDA_VER=12.6
$ sudo make (sudo not required in case of docker containers)
===============================================================================
4. Usage:
===============================================================================
terminal 1:
mosquitto -c mosquitto.conf
terminal 2:
mosquitto_sub -v -h 127.0.0.1 -t /server/fromArm
terminal 3:
/usr/bin/gst-launch-1.0 filesrc location=/workspace/shared_docker/video/cr7_1920x1080.h264 ! h264parse ! mach264dec! queue name=q1 ! mux.sink_0 nvstreammux name=mux batch-size=1 ! queue name=q2 ! nvinferserver config-file-path=./yolov5_nvinferserver_config.txt ! nvmsgconv config=./dstest4_msgconv_config.txt payload-type=1 msg2p-newapi=1 ! nvmsgbroker proto-lib=/opt/deepstream/lib/libnvds_mqtt_proto.so conn-str="127.0.0.1;1883" topic="/server/fromArm" sync=0
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2018-2019 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
[sensor0]
enable=1
type=Camera
id=CAMERA_ID
location=45.293701447;-75.8303914499;48.1557479338
description="Entrance of Garage Right Lane"
coordinate=5.2;10.1;11.2
[place0]
enable=1
id=1
type=garage
name=XYZ
location=30.32;-40.55;100.0
coordinate=1.0;2.0;3.0
place-sub-field1=walsh
place-sub-field2=lane1
place-sub-field3=P2
[place1]
enable=1
id=1
type=garage
name=XYZ
location=28.47;47.46;1.53
coordinate=1.0;2.0;3.0
place-sub-field1="C-76-2"
place-sub-field2="LEV/EV/CP/ADA"
place-sub-field3=P2
[analytics0]
enable=1
id=XYZ
description="Vehicle Detection and License Plate Recognition"
source=OpenALR
version=1.0
\ No newline at end of file
# 设置 Mosquitto 服务器监听所有网络接口(通过 0.0.0.0 指定)上的 1883 端口.
listener 1883 127.0.0.1
# 设置运行 Mosquitto 服务时使用的用户为 root。
# 这通常不是一个安全的做法,因为通常推荐使用一个权限较低的专用用户账户来运行服务以减少潜在的安全风险。
user root
# 允许匿名用户连接到 MQTT 服务器。这意味着客户端无需提供用户名和密码即可连接并发布、订阅消息。
allow_anonymous true
# 指定 Mosquitto 服务运行时生成的进程 ID 文件位置。
#pid_file /var/run/mosquitto.pid
# 开启持久化模式,意味着在服务器重启后,一些会话状态和保留消息等信息会被保存下来
#persistence true
# 设置持久化数据存储的位置,在本例中是 /tmp 目录。
#persistence_location /tmp
# 指定日志输出方式为写入文件,并设定日志文件的路径为 /tmp/mosquitto.log。
#log_dest file /tmp/mosquitto.log
# 指定包含其他配置文件的目录,当 Mosquitto 启动时,会加载此目录下的所有 .conf 结尾的文件作为附加配置。
#include_dir /mnt/mosquitto/etc/mosquitto/conf.d/
#max_inflight_messages 1024
#max_queued_messages 5120
#message_size_limit 2048000
#set_tcp_nodelay true
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2018-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
################################################################################
infer_config {
unique_id: 1
gpu_ids: [0]
max_batch_size: 1
backend {
inputs: [ {
name: "images"
}]
outputs: [
{name: "output0"}
]
triton {
model_name: "YOLOV5_FP16"
version: 1
model_repo {
root: "../../../sugon_samples/triton_model_repo"
strict_model_config: true
backend_dir: "/opt/deepstream/third_party/backends"
log_level: 1
}
}
}
preprocess {
network_format: IMAGE_FORMAT_RGB
tensor_order: TENSOR_ORDER_LINEAR
maintain_aspect_ratio: 0
frame_scaling_hw: FRAME_SCALING_HW_DEFAULT
frame_scaling_filter: 1
normalize {
scale_factor: 0.00392157
channel_offsets: [0, 0, 0]
}
}
postprocess {
labelfile_path: "../../../sugon_samples/labels/YOLOV5/labels.txt"
detection {
num_detected_classes: 80
per_class_params {
key: 0
value { pre_threshold: 0.4 }
}
nms {
confidence_threshold:0.2
topk:20
iou_threshold:0.5
}
custom_parse_bbox_func: "parseYolov5OutputBoundingBoxFP32"
}
}
extra {
copy_input_to_host_buffers: false
output_buffer_pool_size: 2
}
custom_lib {
path: "/opt/deepstream/lib/libnvdsinferserver__customparser_sugon.so"
}
}
input_control {
process_mode: PROCESS_MODE_FULL_FRAME
operate_on_gie_id: -1
interval: 0
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment