### Run the WebRTC recognizer example Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-recognizer.md Run the WebRTC recognizer example. First navigate to the recognizer directory, install dependencies, then launch the app with the --data argument pointing to your dataset and models directory. Requires HTTPS/SSL for browser webcam access. ```bash $ cd jetson-inference/python/www/recognizer $ pip3 install -r requirements.txt $ python3 app.py --data=data/my_dataset ``` -------------------------------- ### Setup nvcaffe build options Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-nvcaffe.md Sets up the build configuration by copying the example Makefile.config and removing CMake files to use the Make build system. ```bash $ cd caffe $ cp Makefile.config.example Makefile.config $ rm -rf cmake/ CMakeLists.txt ``` -------------------------------- ### Setup SSD training environment Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-ssd.md Run these commands only if you are not using the Docker container. They change to the SSD training directory, download the pre-trained base model (mobilenet-v1-ssd-mp-0_675.pth) to models/, and install required Python packages from requirements.txt. ```bash # you only need to run these if you aren't using the container $ cd jetson-inference/python/training/detection/ssd $ wget https://nvidia.box.com/shared/static/djf5w54rjvpqocsiztzaandq1m3avr7c.pth -O models/mobilenet-v1-ssd-mp-0_675.pth $ pip3 install -v -r requirements.txt ``` -------------------------------- ### Build segnet example with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/segnet/CMakeLists.txt CMake configuration for building the segnet example. It globs all .cpp and .h files in the directory, creates an executable named segnet, links against the jetson-inference library, and installs the binary to the bin directory. ```cmake file(GLOB segnetSources *.cpp) file(GLOB segnetIncludes *.h ) cuda_add_executable(segnet ${segnetSources}) target_link_libraries(segnet jetson-inference) install(TARGETS segnet DESTINATION bin) ``` -------------------------------- ### Run the WebRTC Dashboard (app.py) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-dash.md Run the WebRTC dashboard example. Navigate to the dash directory, install dependencies, and launch the app with detection, pose, and action models. The default port is 8050, changeable with --port=N. HTTPS/SSL is recommended. ```bash $ cd jetson-inference/python/www/dash $ pip3 install -r requirements.txt $ python3 app.py --detection=ssd-mobilenet-v2 --pose=resnet18-hand --action=resnet18-kinetics ``` -------------------------------- ### Quick Reference: Build and Install jetson-inference Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md Condensed commands to build and install the project directly on the Jetson, including installing dependencies, cloning with submodules, and running make. Use this if you are not using the Docker container. ```bash sudo apt-get update sudo apt-get install git cmake libpython3-dev python3-numpy git clone --recursive --depth=1 https://github.com/dusty-nv/jetson-inference cd jetson-inference mkdir build cd build cmake ../ make -j$(nproc) sudo make install sudo ldconfig ``` -------------------------------- ### Build actionnet example with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/actionnet/CMakeLists.txt CMake configuration for building the actionnet example. It globs all .cpp and .h files in the directory, creates an executable named actionnet, links it against the jetson-inference library, and installs the binary to the bin directory. ```cmake file(GLOB actionnetSources *.cpp) file(GLOB actionnetIncludes *.h ) cuda_add_executable(actionnet ${actionnetSources}) target_link_libraries(actionnet jetson-inference) install(TARGETS actionnet DESTINATION bin) ``` -------------------------------- ### Build posenet example with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/posenet/CMakeLists.txt CMake configuration for building the posenet example. It collects source files, creates an executable, links against jetson-inference, and installs the binary to bin. ```cmake file(GLOB posenetSources *.cpp) file(GLOB posenetIncludes *.h ) cuda_add_executable(posenet ${posenetSources}) target_link_libraries(posenet jetson-inference) install(TARGETS posenet DESTINATION bin) ``` -------------------------------- ### Install git and cmake Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md Install the required build tools git and cmake before cloning the repository. ```bash $ sudo apt-get update $ sudo apt-get install git cmake ``` -------------------------------- ### Build detectnet example with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/detectnet/CMakeLists.txt CMake configuration for building the detectnet example. It collects all .cpp and .h files in the directory, creates an executable named detectnet, links it against the jetson-inference library, and installs the binary to the bin directory. ```cmake file(GLOB detectnetSources *.cpp) file(GLOB detectnetIncludes *.h ) cuda_add_executable(detectnet ${detectnetSources}) target_link_libraries(detectnet jetson-inference) install(TARGETS detectnet DESTINATION bin) ``` -------------------------------- ### Run HTML WebRTC Example with Different DNN Models Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-html.md Launch the example with different DNN models. Omitting --model loads the default model for that network. ```bash $ python3 app.py --classification --model=resnet18 $ python3 app.py --detection --model=ssd-mobilenet-v2 $ python3 app.py --segmentation --model=fcn-resnet18-mhp $ python3 app.py --pose --model=resnet18-body $ python3 app.py --action --model=resnet18-kinetics $ python3 app.py --background --model=u2net ``` -------------------------------- ### Run Flask WebRTC Example Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-flask.md Starts the Flask webserver and WebRTC streaming thread. Requires HTTPS/SSL for receiving browser webcams. Default port is 8050, changeable with --port=N; use --input to set a different video input device. ```bash $ cd jetson-inference/python/www/flask $ pip3 install -r requirements.txt $ python3 app.py --detection=ssd-mobilenet-v2 --pose=resnet18-hand --action=resnet18-kinetics ``` -------------------------------- ### Install Docker prerequisites and add repository Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/digits-setup.md Installs Docker prerequisites, adds the Docker GPG key, and adds the Docker repository for Ubuntu. ```bash $ sudo apt-get install -y ca-certificates curl software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" ``` -------------------------------- ### CMakeLists.txt for my-recognition example Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/my-recognition/CMakeLists.txt Build configuration for the my-recognition example. Requires CMake 2.8 or greater and the jetson-inference and jetson-utils packages. VPI is optional, CUDA is required. Adds the Tegra link directory and links the executable against jetson-inference. ```cmake # require CMake 2.8 or greater cmake_minimum_required(VERSION 2.8) # declare my-recognition project project(my-recognition) # import jetson-inference and jetson-utils packages. # note that if you didn't do "sudo make install" # while building jetson-inference, this will error. find_package(jetson-utils) find_package(jetson-inference) # find VPI package (optional) find_package(VPI 2.0) # CUDA is required find_package(CUDA) # add directory for libnvbuf-utils to program link_directories(/usr/lib/aarch64-linux-gnu/tegra) # compile the my-recognition program cuda_add_executable(my-recognition my-recognition.cpp) # link my-recognition to jetson-inference library target_link_libraries(my-recognition jetson-inference) ``` -------------------------------- ### Import detectNet and videoSource/videoOutput modules Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/detectnet-example-2.md Imports the jetson_inference and jetson_utils modules used for object detection and camera capture. These modules are installed during the 'sudo make install' step of building the repo; if that step was skipped, the packages won't be found when the example is run. ```python from jetson_inference import detectNet from jetson_utils import videoSource, videoOutput ``` -------------------------------- ### Quick Reference: Download, Build, and Install jetson-inference Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo.md Condensed sequence of commands to download, build, and install the jetson-inference project. Run these on a Jetson device that has been flashed with JetPack or set up with the pre-populated SD card image. ```bash $ sudo apt-get update $ sudo apt-get install git cmake libpython3-dev python3-numpy $ git clone --recursive https://github.com/dusty-nv/jetson-inference $ cd jetson-inference $ mkdir build $ cd build $ cmake ../ $ make -j$(nproc) $ sudo make install $ sudo ldconfig ``` -------------------------------- ### Run HTML WebRTC Example with Classification Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-html.md Launch the HTML WebRTC example with classification. Requires HTTPS/SSL for receiving browser webcams. Default port is 8050, change with --port=N. ```bash $ cd jetson-inference/python/www/html $ python3 app.py --classification # see below for other DNN options ``` -------------------------------- ### Example Webapp Directory Structure Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-html.md Directory layout of the example webapps in the repository, showing the four subdirectories under python/www. ```text + python/ www/ - dash # Plotly Dashboard - html # core HTML/JavaScript - flask # Flask + REST - recognizer # interactive training ``` -------------------------------- ### Install iPython (optional) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-nvcaffe.md Optionally installs iPython and related packages for interactive use. ```bash $ sudo apt-get install ipython ipython-notebook python-pandas -y ``` -------------------------------- ### Build and install jetson-inference Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md Build the libraries, Python extension bindings, and code samples. The project will be built to jetson-inference/build/aarch64, and the sudo make install step also installs the Python bindings under /usr/lib/python*/dist-packages/. ```bash $ cd jetson-inference/build # omit if working directory is already build/ from above $ make $ sudo make install $ sudo ldconfig ``` -------------------------------- ### Start() Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/group__threads.html Start the thread using either the Run() method or a user-provided entry function. ```APIDOC ## Start() ### Description Start the thread. This overload starts the thread using the Run() method. ### Syntax ```cpp bool Start(); ``` ### Returns - **bool** - True if the thread started successfully, false otherwise. ``` ```APIDOC ## Start(ThreadEntryFunction entry, void *user_param = NULL) ### Description Start the thread, utilizing an entry function pointer provided by the user. ### Syntax ```cpp bool Start(ThreadEntryFunction entry, void *user_param = NULL); ``` ### Parameters - **entry** (ThreadEntryFunction) - Required - Pointer to the thread entry function. - **user_param** (void*) - Optional - User-defined parameter passed to the entry function. ### Returns - **bool** - True if the thread started successfully, false otherwise. ``` -------------------------------- ### Install nvidia-docker2 and set permissions Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/digits-setup.md Adds the nvidia-docker2 repository, installs nvidia-docker2, adds the current user to the docker group, and reboots. Note: the source contains typos (ccurl, csudo) that should be corrected to curl and sudo. ```bash $ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \ sudo apt-key add - $ ccurl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker.list | \ sudo tee /etc/apt/sources.list.d/nvidia-docker.list $ csudo apt-get update $ csudo apt-get install -y nvidia-docker2 $ csudo usermod -aG docker $USER $ sudo reboot ``` -------------------------------- ### Thread::Start() Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/Thread_8h_source.html Starts the thread. ```APIDOC ## Thread::Start() ### Description Starts the thread. ### Method Member function ### Signature `bool Start()` ### Parameters None ### Returns - **bool** - True if the thread started successfully, false otherwise. ``` -------------------------------- ### Run Example Programs Inside Container Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-docker.md Commands to run example programs inside the container. The 'cd' command enters the bin directory, then the programs are executed. The comment indicates pressing Ctrl+D exits the container. ```bash cd build/aarch64/bin ./video-viewer /dev/video0 ./imagenet images/jellyfish.jpg images/test/jellyfish.jpg ./detectnet images/peds_0.jpg images/test/peds_0.jpg Ctrl+D ``` -------------------------------- ### Run JetPack installer from host PC Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/jetpack-setup.md Run these commands from the host PC after downloading JetPack to start the JetPack GUI installer. The chmod command makes the installer executable, and the final command launches it. ```bash $ cd $ chmod +x JetPack-L4T--linux-x64.run $ ./JetPack-L4T--linux-x64.run ``` -------------------------------- ### Set up my-recognition project directory and download test images Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/imagenet-example.md Commands to create the project directory, create empty source files, and download test images (black_bear.jpg, brown_bear.jpg, polar_bear.jpg) for the image recognition example. ```bash $ mkdir ~/my-recognition $ cd ~/my-recognition $ touch my-recognition.cpp $ touch CMakeLists.txt $ wget https://github.com/dusty-nv/jetson-inference/raw/master/data/images/black_bear.jpg $ wget https://github.com/dusty-nv/jetson-inference/raw/master/data/images/brown_bear.jpg $ wget https://github.com/dusty-nv/jetson-inference/raw/master/data/images/polar_bear.jpg ``` -------------------------------- ### Build imagenet example with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/imagenet/CMakeLists.txt CMake configuration for building the imagenet example. It collects all .cpp and .h files in the directory, creates an executable named imagenet, links it against the jetson-inference library, and installs the binary to the bin directory. ```cmake file(GLOB imagenetSources *.cpp) file(GLOB imagenetIncludes *.h ) cuda_add_executable(imagenet ${imagenetSources}) target_link_libraries(imagenet jetson-inference) install(TARGETS imagenet DESTINATION bin) ``` -------------------------------- ### Build depthnet example with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/depthnet/CMakeLists.txt CMake configuration for building the depthnet example. It globs all .cpp and .h files in the directory, creates an executable named depthnet, links against the jetson-inference library, and installs the binary to the bin directory. ```cmake file(GLOB depthnetSources *.cpp) file(GLOB depthnetIncludes *.h ) cuda_add_executable(depthnet ${depthnetSources}) target_link_libraries(depthnet jetson-inference) install(TARGETS depthnet DESTINATION bin) ``` -------------------------------- ### Open() Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classvideoOutput.html Virtual method to begin streaming the device. ```APIDOC ## Open() ### Description Begins streaming the device. ### Method Open ### Signature `virtual bool Open()` ### Parameters None ### Returns - **bool** - True if the stream was successfully opened, false otherwise. ``` -------------------------------- ### Build homography-console with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/experimental/homography-console/CMakeLists.txt CMake configuration for building the homography-console example. It collects source files, creates an executable, links against jetson-inference, and installs the binary to bin. ```cmake file(GLOB homographyConsoleSources *.cpp) file(GLOB homographyConsoleIncludes *.h ) cuda_add_executable(homography-console ${homographyConsoleSources}) target_link_libraries(homography-console jetson-inference) install(TARGETS homography-console DESTINATION bin) ``` -------------------------------- ### Run C++ segnet camera demo Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/segnet-camera-2.md Launch the C++ segnet demo with a MIPI CSI camera, V4L2 camera, or save to a video file. Replace with an available segmentation model. ```bash $ ./segnet --network= csi://0 # MIPI CSI camera $ ./segnet --network= /dev/video0 # V4L2 camera $ ./segnet --network= /dev/video0 output.mp4 # save to video file ``` -------------------------------- ### Build homography-camera with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/experimental/homography-camera/CMakeLists.txt CMake configuration for building the homography-camera example. It collects source files, creates an executable, links against jetson-inference, and installs the binary to bin. ```cmake file(GLOB homographyCameraSources *.cpp) file(GLOB homographyCameraIncludes *.h ) cuda_add_executable(homography-camera ${homographyCameraSources}) target_link_libraries(homography-camera jetson-inference) install(TARGETS homography-camera DESTINATION bin) ``` -------------------------------- ### Create(cmdLine) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classdetectNet.html Loads a new network instance by parsing the command line. ```APIDOC ## Create(cmdLine) ### Description Loads a new network instance by parsing the command line. ### Method Create ### Parameters - **cmdLine** (const commandLine&) - Required - Command line object containing parsed arguments. ### Returns - **detectNet*** - Pointer to the created detectNet instance. ``` -------------------------------- ### Import required modules Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/imagenet-example-python-2.md Imports the jetson.inference and jetson.utils modules for image recognition and loading, plus the standard argparse module for command-line parsing. These Jetson modules are installed during the 'sudo make install' step of building the repo; if that step was skipped, the packages won't be found when running the example. ```python import jetson.inference import jetson.utils import argparse ``` -------------------------------- ### segNet::Create (commandLine) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classsegNet.html Loads a new network instance by parsing a commandLine object. ```APIDOC ## segNet::Create (commandLine) ### Description Load a new network instance by parsing the command line. ### Method static ### Signature ```cpp static segNet* Create(const commandLine& cmdLine); ``` ### Parameters - **cmdLine** (const commandLine&) - Required - Reference to a commandLine object. ### Returns - **segNet*** - Pointer to the created segNet instance. ``` -------------------------------- ### Build odometry-plot with CMake Source: https://github.com/dusty-nv/jetson-inference/blob/master/examples/experimental/odometry-plot/CMakeLists.txt CMake configuration for building the odometry-plot example. It collects source and header files, creates an executable with cuda_add_executable, links against jetson-inference, and installs the binary to bin. ```cmake file(GLOB odometryPlotSources *.cpp) file(GLOB odometryPlotIncludes *.h ) cuda_add_executable(odometry-plot ${odometryPlotSources}) target_link_libraries(odometry-plot jetson-inference) install(TARGETS odometry-plot DESTINATION bin) ``` -------------------------------- ### Launch container with ROS support using --ros=humble Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-docker.md Starts the container with ROS support by specifying the --ros option with a supported ROS distro (noetic, foxy, galactic, humble, iron). The container sources the ROS environment and packages when started. ```bash $ docker/run.sh --ros=humble # noetic, foxy, galactic, humble, iron ``` -------------------------------- ### Thread::InitRealtime() Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/Thread_8h_source.html Primes the system for realtime use. ```APIDOC ## Thread::InitRealtime() ### Description Primes the system for realtime use. ### Method Static member function ### Signature `static void InitRealtime()` ### Parameters None ### Returns None ``` -------------------------------- ### poseNet::Create() [3/4] Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classposeNet.html Loads a new network instance by parsing the command line. ```APIDOC ## poseNet::Create() [3/4] ### Description Loads a new network instance by parsing the command line. ### Method static poseNet* poseNet::Create(const commandLine& cmdLine) ### Parameters - **cmdLine** (const commandLine&) - Required - Command line object containing network configuration options. ### Returns - **poseNet*** - Pointer to the created poseNet instance. ### Example ```cpp commandLine cmdLine(argc, argv); poseNet* net = poseNet::Create(cmdLine); ``` ``` -------------------------------- ### GetFloat(const char* _argName, float _defaultValue = 0.0f, bool _allowOtherDelimiters = true) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classcommandLine.html Gets a float argument from the command line. For example, if argv contained `--foo=3.14159`, then `GetFloat("foo")` would return `3.14159f`. ```APIDOC ## GetFloat(const char* _argName, float _defaultValue = 0.0f, bool _allowOtherDelimiters = true) ### Description Get float argument. For example if argv contained `--foo=3.14159`, then `GetFloat("foo")` would return `3.14159f`. ### Method GetFloat ### Signature float commandLine::GetFloat(const char* _argName, float _defaultValue = 0.0f, bool _allowOtherDelimiters = true) const ### Parameters - **_argName** (const char*) - Required - The name of the argument to retrieve. - **_defaultValue** (float) - Optional - The default value to return if the argument is not found. Defaults to `0.0f`. - **_allowOtherDelimiters** (bool) - Optional - If true (default), the argName will be matched against occurrences containing either `-` or `_`. For example, `--foo-bar` and `--foo_bar` would be the same. ### Returns - `defaultValue` if the argument couldn't be found. (`0.0` by default). - Otherwise, returns the value of the argument. ``` -------------------------------- ### Train a classification model with train.py Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-collect.md Starts training a classification model with PyTorch. The training process is the same as in previous examples. If the process is killed due to memory, try mounting SWAP, disabling the desktop GUI, or reducing --batch-size (default 8) and --workers (default 2). ```bash $ cd jetson-inference/python/training/classification $ python3 train.py --model-dir=models/ data/ ``` -------------------------------- ### Run PyTorch installer script Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md Run the PyTorch installation tool again later if you decide to install PyTorch at another time. It will prompt you with the same dialog as seen in the installation step. ```bash $ cd jetson-inference/build $ ./install-pytorch.sh ``` -------------------------------- ### Create(const char* URI, const commandLine &cmdLine) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classvideoSource-members.html Static factory method to create a videoSource from a URI and command line arguments. ```APIDOC ## Create(const char* URI, const commandLine &cmdLine) ### Description Static factory method to create a videoSource from a URI and command line arguments. ### Method Create ### Parameters - **URI** (const char*) - Required - The URI of the video source. - **cmdLine** (const commandLine&) - Required - Command line arguments. ### Returns videoSource* ``` -------------------------------- ### Install NVIDIA driver with apt-get Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/digits-native.md Installs the NVIDIA PCIe driver on the host PC from the Ubuntu repo. Use nvidia-375 for an alternate version. A reboot is required after installation. ```bash $ sudo apt-get install nvidia-384 # use nvidia-375 for alternate version $ sudo reboot ``` -------------------------------- ### Create Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classWebRTCServer.html Static factory method to create a WebRTC server instance. ```APIDOC ## Create ### Description Creates a new WebRTC server instance on the specified port with optional STUN server and SSL configuration. ### Method static ### Signature `static WebRTCServer* Create(uint16_t port = WEBRTC_DEFAULT_PORT, const char* stun_server = WEBRTC_DEFAULT_STUN_SERVER, const char* ssl_cert = NULL, const char* ssl_key = NULL, bool threaded = true)` ### Parameters - **port** (uint16_t) - Optional - The port number to listen on. Defaults to `WEBRTC_DEFAULT_PORT`. - **stun_server** (const char*) - Optional - The STUN server address. Defaults to `WEBRTC_DEFAULT_STUN_SERVER`. - **ssl_cert** (const char*) - Optional - Path to the SSL certificate file. Defaults to NULL. - **ssl_key** (const char*) - Optional - Path to the SSL key file. Defaults to NULL. - **threaded** (bool) - Optional - Whether to run the server in a separate thread. Defaults to true. ### Returns - **WebRTCServer*** - Pointer to the created WebRTC server instance. ### Description Creates a WebRTC server on the specified port. ``` -------------------------------- ### Create project directory and download test images Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/imagenet-example-python-2.md Creates the project directory, an empty Python source file, and downloads three test bear images. Run these commands from a terminal outside the Docker container before mounting the directory. ```bash # run these commands outside of container $ cd ~/ $ mkdir my-recognition-python $ cd my-recognition-python $ touch my-recognition.py $ chmod +x my-recognition.py $ wget https://github.com/dusty-nv/jetson-inference/raw/master/data/images/black_bear.jpg $ wget https://github.com/dusty-nv/jetson-inference/raw/master/data/images/brown_bear.jpg $ wget https://github.com/dusty-nv/jetson-inference/raw/master/data/images/polar_bear.jpg ``` -------------------------------- ### Install Python Development Packages Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md Install the Python development packages needed to build the Python bindings. The project searches for installed Python versions and builds bindings for each one present. ```bash $ sudo apt-get install libpython3-dev python3-numpy ``` -------------------------------- ### Open() Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classgstCamera.html Begins streaming the camera. ```APIDOC ## Open() ### Description Begin streaming the camera. ### Method virtual bool Open() ### Parameters None ### Return Value - **bool** - True on success, false on failure. ``` -------------------------------- ### Create(argc, argv) Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classdetectNet.html Loads a new network instance by parsing the command line. ```APIDOC ## Create(argc, argv) ### Description Loads a new network instance by parsing the command line. ### Method Create ### Parameters - **argc** (int) - Required - Number of command line arguments. - **argv** (char**) - Required - Array of command line arguments. ### Returns - **detectNet*** - Pointer to the created detectNet instance. ``` -------------------------------- ### Run Python segnet camera demo Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/segnet-camera-2.md Launch the Python segnet demo with a MIPI CSI camera, V4L2 camera, or save to a video file. Replace with an available segmentation model. ```bash $ ./segnet.py --network= csi://0 # MIPI CSI camera $ ./segnet.py --network= /dev/video0 # V4L2 camera $ ./segnet.py --network= /dev/video0 output.mp4 # save to video file ``` -------------------------------- ### XML Document for XMLHandle Example Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classtinyxml2_1_1XMLHandle.html XML document used in the example that finds attributeB from the second Child element. ```xml ``` -------------------------------- ### actionNet::Create Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classactionNet.html Documentation for the static actionNet::Create method that loads a new network instance. ```APIDOC ## Create(const char*, const char*, const char*, const char*, uint32_t, precisionType, deviceType, bool) ### Description Load a new network instance. This static method creates an actionNet object with the specified model and configuration. ### Method Create ### Signature static actionNet* actionNet::Create(const char* model_path, const char* class_labels, const char* input = ACTIONNET_DEFAULT_INPUT, const char* output = ACTIONNET_DEFAULT_OUTPUT, uint32_t maxBatchSize = DEFAULT_MAX_BATCH_SIZE, precisionType precision = TYPE_FASTEST, deviceType device = DEVICE_GPU, bool allowGPUFallback = true) ### Parameters - **model_path** (const char*) - Required - File path to the caffemodel. - **class_labels** (const char*) - Required - File path to list of class name labels. - **input** (const char*) - Optional - Name of the input layer blob. - **output** (const char*) - Optional - Name of the output layer blob. - **maxBatchSize** (uint32_t) - Optional - The maximum batch size that the network will support and be optimized for. - **precision** (precisionType) - Optional - Precision type for the network. - **device** (deviceType) - Optional - Device type for the network. - **allowGPUFallback** (bool) - Optional - Whether to allow GPU fallback. ### Returns A pointer to the created actionNet instance. ``` -------------------------------- ### Common WebRTC Example File Layout Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-html.md Common file layout for the WebRTC example webapps, listing the server-side and client-side components. ```text - app.py # server-side Python code for running the webserver - stream.py # server-side Python code for WebRTC streaming/inferencing - webrtc.js # client-side WebRTC JavaScript code - index.html # client-side HTML code ``` -------------------------------- ### NGC login credentials example Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/digits-setup.md Example credentials for logging into nvcr.io: use $oauthtoken as the username and your NGC API key as the password. ```bash Username: $oauthtoken Password: ``` -------------------------------- ### Query available camera formats with v4l2-ctl Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/detectnet-camera.md Install v4l-utils and list the formats supported by the camera. Use this to determine the correct --width and --height values for the detectnet-camera demo. ```bash $ sudo apt-get install v4l-utils $ v4l2-ctl --list-formats-ext ``` -------------------------------- ### Start WebRTC Playback Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/webrtc-html.md Start WebRTC playback by connecting the output stream to the video player. Typically called in window.onload() or an event handler. ```javascript // playStream() is a helper function from webrtc.js that connects the specified WebRTC stream to the video player // getWebSocketURL() is a helper function that makes a URL path of the form: wss://:8554/output playStream(getWebsocketURL('output'), document.getElementById('video-player')); ``` -------------------------------- ### Create() [2/6] Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/html/classvideoOutput.html Creates a videoOutput interface from a resource URI string and parses command line arguments. ```APIDOC ## Create() [2/6] ### Description Creates a videoOutput interface from a resource URI string and parses command line arguments. ### Method static ### Signature static videoOutput* videoOutput::Create(const char* _URI_, const int _argc_, char** _argv_) ### Parameters - **URI** (const char*) - Required - Resource URI of a video device, IP stream, or file/directory. - **argc** (const int) - Required - Number of command line arguments. - **argv** (char**) - Required - Array of command line arguments. ### Returns - **videoOutput*** - Pointer to the created videoOutput interface. ### See Also - videoOptions for valid command-line arguments. - URI struct for more info about resource URIs. ``` -------------------------------- ### Example labels.txt file with 5 classes Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-collect.md Defines class labels for the camera-capture tool. Each line is a class name, and the file must be alphabetized to match the ordering of subdirectories on disk. ```bash background brontosaurus tree triceratops velociraptor ```