dusty-nv / jetson-inference

Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
https://developer.nvidia.com/embedded/twodaystoademo
MIT License
7.89k stars 2.99k forks source link

How to use USB Camera in recognition #1720

Open WangQingchen123 opened 1 year ago

WangQingchen123 commented 1 year ago

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

[TRT] TensorRT version 7.1.3 [TRT] loading NVIDIA plugins... [TRT] Registered plugin creator - ::GridAnchor_TRT version 1 [TRT] Registered plugin creator - ::NMS_TRT version 1 [TRT] Registered plugin creator - ::Reorg_TRT version 1 [TRT] Registered plugin creator - ::Region_TRT version 1 [TRT] Registered plugin creator - ::Clip_TRT version 1 [TRT] Registered plugin creator - ::LReLU_TRT version 1 [TRT] Registered plugin creator - ::PriorBox_TRT version 1 [TRT] Registered plugin creator - ::Normalize_TRT version 1 [TRT] Registered plugin creator - ::RPROI_TRT version 1 [TRT] Registered plugin creator - ::BatchedNMS_TRT version 1 [TRT] Could not register plugin creator - ::FlattenConcat_TRT version 1 [TRT] Registered plugin creator - ::CropAndResize version 1 [TRT] Registered plugin creator - ::DetectionLayer_TRT version 1 [TRT] Registered plugin creator - ::Proposal version 1 [TRT] Registered plugin creator - ::ProposalLayer_TRT version 1 [TRT] Registered plugin creator - ::PyramidROIAlign_TRT version 1 [TRT] Registered plugin creator - ::ResizeNearest_TRT version 1 [TRT] Registered plugin creator - ::Split version 1 [TRT] Registered plugin creator - ::SpecialSlice_TRT version 1 [TRT] Registered plugin creator - ::InstanceNormalization_TRT version 1 [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, INT8 [TRT] selecting fastest native precision for GPU: FP16 [TRT] found engine cache file networks/Googlenet/bvlc_googlenet.caffemodel.1.1.7103.GPU.FP16.engine [TRT] found model checksum networks/Googlenet/bvlc_googlenet.caffemodel.sha256sum [TRT] echo "$(cat networks/Googlenet/bvlc_googlenet.caffemodel.sha256sum) networks/Googlenet/bvlc_googlenet.caffemodel" | sha256sum --check --status [TRT] model matched checksum networks/Googlenet/bvlc_googlenet.caffemodel.sha256sum [TRT] loading network plan from engine cache... networks/Googlenet/bvlc_googlenet.caffemodel.1.1.7103.GPU.FP16.engine [TRT] device GPU, loaded networks/Googlenet/bvlc_googlenet.caffemodel [TRT] Deserialize required 2929823 microseconds. [TRT]
[TRT] CUDA engine context initialized on device GPU: [TRT] -- layers 85 [TRT] -- maxBatchSize 1 [TRT] -- workspace 0 [TRT] -- deviceMemory 11307520 [TRT] -- bindings 2 [TRT] binding 0 -- index 0 -- name 'data' -- type FP32 -- in/out INPUT -- # dims 3 -- dim #0 3 (SPATIAL) -- dim #1 224 (SPATIAL) -- dim #2 224 (SPATIAL) [TRT] binding 1 -- index 1 -- name 'prob' -- type FP32 -- in/out OUTPUT -- # dims 3 -- dim #0 1000 (SPATIAL) -- dim #1 1 (SPATIAL) -- dim #2 1 (SPATIAL) [TRT]
[TRT] binding to input 0 data binding index: 0 [TRT] binding to input 0 data dims (b=1 c=3 h=224 w=224) size=602112 [TRT] binding to output 0 prob binding index: 1 [TRT] binding to output 0 prob dims (b=1 c=1000 h=1 w=1) size=4000 [TRT]
[TRT] device GPU, networks/Googlenet/bvlc_googlenet.caffemodel initialized. [TRT] loaded 1000 class labels [TRT] imageNet -- networks/Googlenet/bvlc_googlenet.caffemodel initialized. [gstreamer] initialized gstreamer, version 1.14.5.0 [gstreamer] gstCamera -- attempting to create device csi://0 [gstreamer] gstCamera pipeline string: [gstreamer] nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, framerate=30/1, format=(string)NV12 ! nvvidconv flip-method=2 ! video/x-raw(memory:NVMM) ! appsink name=mysink [gstreamer] gstCamera successfully created device csi://0 [video] created gstCamera from csi://0

gstCamera video options:

-- URI: csi://0

`

For study Running the Live Camera Recognition Demo, I plugged a USB camera into the jetson Xavier NX board and ran . /imagenet.py csi://0 without the expected results. But as you can see from the output on the command line, the video stream has been created.

dusty-nv commented 1 year ago

For study Running the Live Camera Recognition Demo, I plugged a USB camera into the jetson Xavier NX board and ran . /imagenet.py csi://0 without the expected results. But as you can see from the output on the command line, the video stream has been created.

@WangQingchen123 csi://0 is for using MIPI CSI camera, for USB camera you would start it with something like /dev/video0

For more info, see here: https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-streaming.md#v4l2-cameras

ryzen-n commented 12 months ago

I have the same problem and I did try ./imagenet.py /dev/video0 but nothing changes.