Jetson Nano USB camera

  1. I compiled nano according to this tutorial

before run

cmake ../

I modified imagenet-camera.cpp as follows


then I did

sudo make install

When I run

./imagenet-camera googlenet

it shows

args (2):  0 [./imagenet-camera]  1 [googlenet]

[gstreamer] initialized gstreamer, version
[gstreamer] gstCamera attempting to initialize with GST_SOURCE_NVCAMERA
[gstreamer] gstCamera pipeline string:
v4l2src device=/dev/video1 ! video/x-raw, width=(int)1280, height=(int)720, format=YUY2 ! videoconvert ! video/x-raw, format=RGB ! videoconvert !appsink name=mysink
[gstreamer] gstCamera successfully initialized with GST_SOURCE_V4L2

imagenet-camera:  successfully initialized video device
    width:  1280
   height:  720
    depth:  24 (bpp)

imageNet -- loading classification network model from:
         -- prototxt     networks/googlenet.prototxt
         -- model        networks/bvlc_googlenet.caffemodel
         -- class_labels networks/ilsvrc12_synset_words.txt
         -- input_blob   'data'
         -- output_blob  'prob'
         -- batch_size   2

[TRT]  TensorRT version 5.0.6
[TRT]  detected model format - caffe  (extension '.caffemodel')
[TRT]  desired precision specified for GPU: FASTEST
[TRT]  requested fasted precision for device GPU without providing valid calibrator, disabling INT8
[TRT]  native precisions detected for GPU:  FP32, FP16
[TRT]  selecting fastest native precision for GPU:  FP16
[TRT]  attempting to open engine cache file networks/bvlc_googlenet.caffemodel.2.1.GPU.FP16.engine
[TRT]  loading network profile from engine cache... networks/bvlc_googlenet.caffemodel.2.1.GPU.FP16.engine
[TRT]  device GPU, networks/bvlc_googlenet.caffemodel loaded
[TRT]  device GPU, CUDA engine context initialized with 2 bindings
[TRT]  binding -- index   0
               -- name    'data'
               -- type    FP32
               -- in/out  INPUT
               -- # dims  3
               -- dim #0  3 (CHANNEL)
               -- dim #1  224 (SPATIAL)
               -- dim #2  224 (SPATIAL)
[TRT]  binding -- index   1
               -- name    'prob'
               -- type    FP32
               -- in/out  OUTPUT
               -- # dims  3
               -- dim #0  1000 (CHANNEL)
               -- dim #1  1 (SPATIAL)
               -- dim #2  1 (SPATIAL)
[TRT]  binding to input 0 data  binding index:  0
[TRT]  binding to input 0 data  dims (b=2 c=3 h=224 w=224) size=1204224
[cuda]  cudaAllocMapped 1204224 bytes, CPU 0x100e30000 GPU 0x100e30000
[TRT]  binding to output 0 prob  binding index:  1
[TRT]  binding to output 0 prob  dims (b=2 c=1000 h=1 w=1) size=8000
[cuda]  cudaAllocMapped 8000 bytes, CPU 0x100f60000 GPU 0x100f60000
device GPU, networks/bvlc_googlenet.caffemodel initialized.
[TRT]  networks/bvlc_googlenet.caffemodel loaded
imageNet -- loaded 1000 class info entries
networks/bvlc_googlenet.caffemodel initialized.
[OpenGL]  failed to open X11 server connection.[OpenGL]  failed to create X11 Window.

imagenet-camera:  failed to create openGL display
loaded image  fontmapA.png  (256 x 512)  2097152 bytes
[cuda]  cudaAllocMapped 2097152 bytes, CPU 0x101060000 GPU 0x101060000
[cuda]  cudaAllocMapped 8192 bytes, CPU 0x100f62000 GPU 0x100f62000
[gstreamer] gstreamer transitioning pipeline to GST_STATE_PLAYING
[gstreamer] gstreamer failed to set pipeline state to PLAYING (error 0)

imagenet-camera:  failed to open camera for streaming

I checked my camera with

ls /dev/v*

it shows

/dev/vcs   /dev/vcs3  /dev/vcs6  /dev/vcsa1  /dev/vcsa4  /dev/vcsa7
/dev/vcs1  /dev/vcs4  /dev/vcs7  /dev/vcsa2  /dev/vcsa5  /dev/vhci
/dev/vcs2  /dev/vcs5  /dev/vcsa  /dev/vcsa3  /dev/vcsa6  /dev/video0

by-id  by-path


and I input cheese, camera works well.

so why I can not run

./imagenet-camera googlenet

Thanks for help

It works when I do this


What fps can you get? I just got 5.

How did you get fps?

I run the imagine-camera sample, it shows the fps on the title bar. The default resolution is 1280x720, the fps is around 5. I reduce the resolution to 640x480 and I can get 15 fps. Today, I borrow a CSI camera (raspberry pi camera v2) from my colleague, I can get around 25 fps at resolution 1280x720.


In latest Jetpackk 4.2.2 there is no such #def statement.

Did you try USB camera dev in latest release?