Skip to content

Latest commit

 

History

History
104 lines (85 loc) · 4.47 KB

building-dsl.md

File metadata and controls

104 lines (85 loc) · 4.47 KB

Building and Importing DSL

The DSL shared library is built using GCC and GNU Make. The MakeFile is located in the DSL root folder. There are a few simple steps involved in creating and installing the shared library, libdsl.so. The current default make -- prior to releasing DSL v1.0 -- builds DSL into a command line test-executable for running all API and Unit level test cases. The DSL source-only object files, built for the test application, are re-linked into the libdsl.so shared library.

Contents / Steps

  1. Clone this repository to pull down all source
  2. Use the make (all) default to build the dsl-test-app executable
  3. Use the sudo make install option to build the object files into libdsl.so and intall the lib
  4. Generate trafficcamnet engine files (optional)
  5. Import the shared lib using Python3

Clone the Repository

Clone the repository to pull all source code required to build the DSL test application - then navigate to the deepstream-services-library root folder.

git clone https://github.com/prominenceai/deepstream-services-library.git
cd deepstream-services-library

Import Note: When building with GStreamer v1.18 on Ubuntu 20.04, you will need to set the GStreamer sub version in the Makefile to 18 for the WebRTC Sink and WebSocket source code to be included in the build.

Make (all)

Invoke the standard make (all) to compile all source code and test scenarios into objects files, and link them into a Catch2 test application. On successful build, the dsl-test-app will be found under the same root folder.

make -j$(nproc)

Make and install the shared library and install dsl.py

Once the dsl-test-app.exe has been created, the source-only objects can be re-linked into the libdsl.so with the make install option. Root level privileges are required for the Makefile to copy the lib to /usr/local/lib once built.

The DSL Python bindings file (dsl.py) is also copied to .local/lib/python3.6/site-packages with the following command.

sudo make install

Generate trafficcamnet engine files (optional)

execute the python script in the deepstream-services-library root folder.

sudo python3 make_trafficcamnet_engine_files.py

Note: this script can take several minutes to run.

The following files are generated

/opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b8_gpu0_int8.engine
/opt/nvidia/deepstream/deepstream/samples/models/Secondary_VehicleMake/resnet18_vehiclemakenet.etlt_b8_gpu0_int8.engine
/opt/nvidia/deepstream/deepstream/samples/models/Secondary_VehicleTypes/resnet18_vehicletypenet.etlt_b8_gpu0_int8.engine

Update the Primary detector path specification in the script to generate files for other devices.

Import the shared lib using Python3

The shared lib libdsl.so is mapped to Python3 using CTypes in the python module dsl.py.

Import dsl into your python code.

#!/usr/bin/env python
from dsl import *

# New CSI Live Camera Source
retval = dsl_source_csi_new('csi-source', 1280, 720, 30, 1)

if retval != DSL_RETURN_SUCCESS:
    print(retval)
    # --- handle error

Getting Started

API Reference