Skip to content

Commit 82b1036

Browse files
committed
updated readme
0 parents  commit 82b1036

File tree

6 files changed

+807
-0
lines changed

6 files changed

+807
-0
lines changed

Makefile

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
################################################################################
2+
# Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved.
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a
5+
# copy of this software and associated documentation files (the "Software"),
6+
# to deal in the Software without restriction, including without limitation
7+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
# and/or sell copies of the Software, and to permit persons to whom the
9+
# Software is furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
# DEALINGS IN THE SOFTWARE.
21+
#################################################################################
22+
#enable this flag to use optimized dsexample plugin
23+
#it can also be exported from command line
24+
25+
WITH_OPENCV?=1
26+
27+
CUDA_VER?=11.4
28+
ifeq ($(CUDA_VER),)
29+
$(error "CUDA_VER is not set")
30+
endif
31+
TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
32+
33+
CXX:= g++
34+
NVCC:= nvcc
35+
36+
SRCS:= $(wildcard *.cpp)
37+
CUSRCS:=$(wildcard *.cu)
38+
INCS:= $(wildcard *.h)
39+
LIB:=libnvdsgst_dscustomplugin.so
40+
41+
NVDS_VERSION:=6.2
42+
43+
CFLAGS+= -fPIC -DDS_VERSION=\"6.2.0\" \
44+
-I /usr/local/cuda-$(CUDA_VER)/include \
45+
-I ../../includes \
46+
-I/usr/src/jetson_multimedia_api/include \
47+
-I/usr/include/aarch64-linux-gnu \
48+
-I/usr/include/gstreamer-1.0/gst \
49+
-I/opt/nvidia/deepstream/deepstream-6.2/sources/includes
50+
51+
GST_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/gst-plugins/
52+
LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/
53+
54+
LIBS := -shared -Wl,-no-undefined \
55+
-L/usr/local/cuda-$(CUDA_VER)/lib64/ -lcudart -ldl \
56+
-L/usr/lib/aarch64-linux-gnu/ -lnvinfer_plugin \
57+
-L/usr/lib/aarch64-linux-gnu/tegra/ -lEGL -lGLESv2 \
58+
-L/usr/lib/aarch64-linux-gnu/tegra/ -lcuda -lnvbuf_utils \
59+
-L/usr/local/cuda-$(CUDA_VER)/lib64/ -lcudart \
60+
-L/usr/lib/aarch64-linux-gnu/ -lopencv_cudaimgproc \
61+
-L/opt/nvidia/deepstream/deepstream-6.2/includes \
62+
-L/opt/nvidia/deepstream/deepstream-6.2/lib/ -lnvdsgst_helper -lnvdsgst_meta -lnvds_meta -lnvbufsurface -lnvbufsurftransform -lnvinfer -lnvparsers -lnvonnxparser
63+
OBJS:= $(SRCS:.cpp=.o) $(CUSRCS:.cu=.o)
64+
65+
PKGS:= gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0
66+
67+
ifeq ($(WITH_OPENCV),1)
68+
CFLAGS+= -I /usr/local/include/opencv4
69+
PKGS+= opencv4
70+
endif
71+
72+
CFLAGS+=$(shell pkg-config --cflags $(PKGS))
73+
LIBS+=$(shell pkg-config --libs $(PKGS))
74+
75+
all: $(LIB)
76+
77+
%.o: %.cu Makefile
78+
$(NVCC) -c -o $@ -arch compute_87 --compiler-options '-fPIC' $<
79+
80+
%.o: %.cpp $(INCS) Makefile
81+
@echo $(CFLAGS)
82+
$(CXX) -c -o $@ $(CFLAGS) $<
83+
84+
$(LIB): $(OBJS) $(DEP) Makefile
85+
@echo $(CFLAGS)
86+
$(CXX) -o $@ $(OBJS) $(LIBS)
87+
88+
$(DEP): $(DEP_FILES)
89+
$(MAKE) -C dsexample_lib/
90+
91+
install: $(LIB)
92+
cp -rv $(LIB) $(GST_INSTALL_DIR)
93+
94+
clean:
95+
rm -rf *.so *.o

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Custom Gstreamer Element (GPU Usage)
2+
Deepstream SDK custom gst-element.
3+
(NVMM memory --> GpuMat)
4+
Sample Repo to get buffer from nvmm memory and map it to gpumat without going to/from cpu.
5+
It uses cuda programming to draw a filled rectangle. (basic preprocessing)
6+
7+
## System Environment
8+
- Hardware : Jetson Orin AGX
9+
- OS : Ubuntu 20.04
10+
- JetPack - 5.1.1
11+
- TensorRT - 8.5.2.2
12+
- Deepstream - 6.2
13+
- OpenCV - 4.6.0 + CUDA
14+
15+
16+
## Installation
17+
```
18+
git clone https://github.com/RajUpadhyay/Deepstream-Custom-Element
19+
cd Deepstream-Custom-Element
20+
```
21+
22+
Set your cuda version in the Makefile like this
23+
`CUDA_VER?=11.4`
24+
25+
Now run make and sudo make install
26+
```
27+
make
28+
sudo make install
29+
```
30+
31+
32+
## Please set up nvinfer by yourself or refer [this](https://github.com/RajUpadhyay/Detectron2-Deepstream) repo
33+
```
34+
gst-launch-1.0 uridecodebin3 uri=file:///video.mp4 ! nvvidconv ! m.sink_0 nvstreammux name=m width=1920 height=960 batch-size=1 ! dscustomplugin x1=100 y1=100 x2=400 y2=300 ! nvinfer config-file-path=config_infer.txt ! nvdsosd ! nvvidconv ! fpsdisplaysink sync=0
35+
```

0 commit comments

Comments
 (0)