-
Notifications
You must be signed in to change notification settings - Fork 536
Expand file tree
/
Copy pathREADME
More file actions
executable file
·94 lines (82 loc) · 5.25 KB
/
Copy pathREADME
File metadata and controls
executable file
·94 lines (82 loc) · 5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
Prerequisites:
- DeepStreamSDK 9.0
- Python 3.12
- Gst-python
- NumPy package <2.0, >=1.22 (2.0 and above not supported)
- OpenCV package
To install required packages:
$ source /path/to/pyds/bin/activate # Activate the environment
$ pip3 install --force-reinstall numpy==1.26.0
$ pip3 install opencv-python
Download Peoplenet model:
$ mkdir -p /opt/nvidia/deepstream/deepstream/samples/models/peoplenet
$ cd /opt/nvidia/deepstream/deepstream/samples/models/peoplenet
$ wget --content-disposition 'https://api.ngc.nvidia.com/v2/models/org/nvidia/team/tao/peoplenet/pruned_quantized_decrypted_v2.3.4/files?redirect=true&path=resnet34_peoplenet_int8.onnx' -O resnet34_peoplenet_int8.onnx
$ wget --content-disposition 'https://api.ngc.nvidia.com/v2/models/org/nvidia/team/tao/peoplenet/pruned_quantized_decrypted_v2.3.4/files?redirect=true&path=resnet34_peoplenet_int8.txt' -O resnet34_peoplenet_int8.txt
$ wget --content-disposition 'https://api.ngc.nvidia.com/v2/models/org/nvidia/team/tao/peoplenet/pruned_quantized_decrypted_v2.3.4/files?redirect=true&path=labels.txt' -O labels.txt
To run:
$ python3 deepstream_imagedata-multistream_redaction.py -i <uri1> [uri2] ... [uriN]
For command line argument details:
$ python3 deepstream_imagedata-multistream_redaction.py -h
e.g.
$ python3 deepstream_imagedata-multistream_redaction.py -i file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4 file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4
This document describes the sample deepstream-imagedata-multistream-redaction application.
This sample builds on top of the deepstream-imagedata-multistream sample to demonstrate how to:
* Demonstrates the use-case of face redaction and storing the detected objects (faces) in
cropped images to an "out_crops" dir in the present working directory
* Access imagedata in a multistream source
* Modify the images in-place. Changes made to the buffer will reflect in the downstream but
color format, resolution and numpy transpose operations are not permitted.
* Make a copy of the image, modify it and save to a file. These changes are made on the copy
of the image and will not be seen downstream.
* Extract the stream metadata, imagedata, which contains useful information about the
frames in the batched buffer.
* Annotating detected objects regardless of confidence level
* Use OpenCV to crop the image around a detected object (face class) and save it to file.
* Use multiple sources in the pipeline.
* Use a uridecodebin so that any type of input (e.g. RTSP/File), any GStreamer
supported container format, and any codec can be used as input.
* Configure the stream-muxer to generate a batch of frames and infer on the
batch for better resource utilization.
* Display output locally using eglglessink (x86) or nv3dsink (ARM/Tegra)
NOTE:
- For x86, only CUDA unified memory is supported. Consequently, vGPU is not supported.
- Only RGBA color format is supported for access from Python. Color conversion
is added in the pipeline for this reason.
This sample accepts one or more H.264/H.265 video streams as input. It creates
a source bin for each input and connects the bins to an instance of the
"nvstreammux" element, which forms the batch of frames. The batch of
frames is fed to "nvinfer" for batched inferencing. The batched buffer is
composited into a 2D tile array using "nvmultistreamtiler." The rest of the
pipeline is similar to the deepstream-test3 and deepstream-imagedata sample.
The "width" and "height" properties must be set on the stream-muxer to set the
output resolution. If the input frame resolution is different from
stream-muxer's "width" and "height", the input frame will be scaled to muxer's
output resolution.
The stream-muxer waits for a user-defined timeout before forming the batch. The
timeout is set using the "batched-push-timeout" property. If the complete batch
is formed before the timeout is reached, the batch is pushed to the downstream
element. If the timeout is reached before the complete batch can be formed
(which can happen in case of rtsp sources), the batch is formed from the
available input buffers and pushed. Ideally, the timeout of the stream-muxer
should be set based on the framerate of the fastest source. It can also be set
to -1 to make the stream-muxer wait infinitely.
The "nvmultistreamtiler" composite streams based on their stream-ids in
row-major order (starting from stream 0, left to right across the top row, then
across the next row, etc.).