Realtime Semantic Segmentation on Jetson Nano in Python and C++

Realtime Semantic Segmentation on Jetson Nano in Python and C++

Recently I updated the Hello AI World project on GitHub with new semantic segmentation models based on FCN-ResNet18 that run in realtime on Jetson Nano, in addition to Python bindings and examples for segmenting images and live camera video. Like with the other networks in the project, they use NVIDIA TensorRT underneath for optimized performance.

The segmentation models have been trained in PyTorch at various resolutions on datasets including Cityscapes, DeepScene, Multi-Human Parsing, Pascal VOC, and SUN RGB-D:

No alt text provided for this image

Below is example Python code that segments an image using the library:

import jetson.inference
import jetson.utils

# load an image (into shared CPU/GPU memory)
img, width, height = jetson.utils.loadImageRGBA("my_image.jpg")

# allocate output image for the overlay/mask (float4)
img_output = jetson.utils.cudaAllocMapped(width * height * 16)

# load the segmentation model
net = jetson.inference.segNet("fcn-resnet18-voc-512x320")

# process the segmentation network
net.Process(img, width, height)

# perform the visualization
net.Overlay(img_output, width, height)
	
# save the image to disk
jetson.utils.saveImageRGBA("my_output.jpg", img_output, width, height)

See the updated documentation for the new tutorial steps around semantic segmentation. Samples and APIs are provided for both Python and C++ depending on your preference.

Grab the latest code and models from here...https://github.com/dusty-nv/jetson-inference


Jaswanth Bandlamudi

Senior Deep Learning Engineer | AI/ML Specialist | Expert in Python, C++, CUDA, & Automotive Systems

5y

I'm doing a similar project...... Implementing E-net for real time semantic segmentation on Jetson Nano... Hoopefully the results will be positive... So good to see some one in the same boat..... BTW is it real time ?

Like
Reply
Simone Girardi

Software Quality Engineer at Infineon | MCU Tools Development | Technical Marketing

5y

Thank you Dustin! I’m working on my master degree thesis based on your Hello AI World project 😊 I’m happy to hear about these updates! 🙏🏻

Davor Jordačević

Senior AI Solutions Engineer @ SeeChange Technologies

5y

Great work!

Like
Reply
John Oliver

Sr. Principal Engineer/Architect @ SiMa.ai | AI for the Edge

5y

I've got a Jetson Nano that I'm playing around with.  Expecting the last of my parts to come in this weekend as I turn it into a JetBot.

To view or add a comment, sign in

Others also viewed

Explore topics