Jetson Inference

Hi all - Finally got one of the Jetson-Inference running, this is the Image Classification, so i used this docker because im on a Jetson Orin Nano Super:

sudo docker run --runtime nvidia -it --rm \

--network host \

--volume /tmp/argus_socket:/tmp/argus_socket \

--volume /etc/enctune.conf:/etc/enctune.conf \

--volume /etc/nv_tegra_release:/etc/nv_tegra_release \

--volume /tmp/nv_jetson_model:/tmp/nv_jetson_model \

--volume /var/run/dbus:/var/run/dbus \

--volume /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \

--volume ~/jetson-inference/data:/jetson-inference/data \

dustynv/jetson-inference:r36.3.0

I did the pre-trained review with this command, in particular for the cat & dog practice:

imagenet --network=resnet-18/opt/jetson-inference/data/cat_dog/test/cat/01.jpg /opt/jetson-inference/data/images/resultado_test_01.jpg

My result is that the ResNet-18 with no training is very good indentifing dog vs cats.

For training i used:

Sorry i got no logs but with 34 epoch it reached 71% accuracy.

And then i used the post trained ResNet-18 with another test sample with:

imagenet \

--model=/opt/jetson-inference/python/training/classification/models/cat_dog/resnet18.onnx \

--labels=/opt/jetson-inference/python/training/classification/models/cat_dog/labels.txt \

--input-blob=input_0 \

--output-blob=output_0 \

/opt/jetson-inference/data/cat_dog/test/cat/01.jpg \

/opt/jetson-inference/data/images/resultado_post.jpg


The post train is worst, so my question is this result expected? because im just using this amount of epoch cycles and the training sample size that is what is included in the excercise?

Hi,

Could you share your training logs that contain loss with us?

Thanks.

Hello — sorry, closed the terminal window by accident but the last thing i remember is loking at that accuracy number of 71%. Can we conclude on an answer to my original question?

hello - so i tried another excercise: used the same container:

sudo docker run --runtime nvidia -it --rm \

--network host \

--volume /tmp/argus_socket:/tmp/argus_socket \

--volume /etc/enctune.conf:/etc/enctune.conf \

--volume /etc/nv_tegra_release:/etc/nv_tegra_releas e \

--volume /tmp/nv_jetson_model:/tmp/nv_jetson_mod el \

--volume /var/run/dbus:/var/run/d bus \

--volume /var/run/avahi-daemon/socket:/var/run/avahi-daemon/so cket \

--volume ~/jetson-inference/data:/jetson-inference /data \

dustynv/jetson-inference :r36.3.0

But this time i used a foto of a thumbs up, need help interpreting the result: for me a confidence of 20% on a band aid is evidence that doesnt have a clue on what that object is but not sure if will be a fare sample because the ResNet-18 doesnt have an option of a thumbs up, what is your feedback?

jcm@ubuntu:~$ sudo docker run --runtime nvidia -it --rm --network host --volume /tmp/argus_socket:/tmp/argus_socket --volume /etc/enctune.conf:/etc/enctune.conf --volume /etc/nv_tegra_release:/etc/nv_tegra_release --volume /tmp/nv_jetson_model:/tmp/nv_jetson_model --volume /var/run/dbus:/var/run/dbus --volume /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket --volume ~/jetson-inference/data:/jetson-inference/data dustynv/jetson-inference:r36.3.0

root@ubuntu:/# imagenet /jetson-inference/data/muestra_dedos/dedos_arriba/captura_platon_2.jpg /jetson-inference/data/muestra_dedos/dedos_arriba/resultado_platon_2.jpg --network=resnet-18
[video] created imageLoader from file:///jetson-inference/data/muestra_dedos/dedos_arriba/captura_platon_2.jpg

imageLoader video options:

– URI: file:///jetson-inference/data/muestra_dedos/dedos_arriba/captura_platon_2.jpg

  • protocol: file
  • location: /jetson-inference/data/muestra_dedos/dedos_arriba/captura_platon_2.jpg
  • extension: jpg
    – deviceType: file
    – ioType: input
    – codec: unknown
    – codecType: v4l2
    – frameRate: 0
    – numBuffers: 4
    – zeroCopy: true
    – flipMethod: none
    – loop: 0

[video] created imageWriter from file:///jetson-inference/data/muestra_dedos/dedos_arriba/resultado_platon_2.jpg

imageWriter video options:

– URI: file:///jetson-inference/data/muestra_dedos/dedos_arriba/resultado_platon_2.jpg

  • protocol: file
  • location: /jetson-inference/data/muestra_dedos/dedos_arriba/resultado_platon_2.jpg
  • extension: jpg
    – deviceType: file
    – ioType: output
    – codec: unknown
    – codecType: v4l2
    – frameRate: 0
    – bitRate: 0
    – numBuffers: 4
    – zeroCopy: true

[OpenGL] failed to open X11 server connection.
[OpenGL] failed to create X11 Window.

imageNet – loading classification network model from:
– prototxt networks/ResNet-18/deploy.prototxt
– model networks/ResNet-18/ResNet-18.caffemodel
– class_labels networks/ilsvrc12_synset_words.txt
– input_blob ‘data’
– output_blob ‘prob’
– batch_size 1

[TRT] TensorRT version 8.6.2
[TRT] loading NVIDIA plugins…
[TRT] Registered plugin creator - ::BatchedNMSDynamic_TRT version 1
[TRT] Registered plugin creator - ::BatchedNMS_TRT version 1
[TRT] Registered plugin creator - ::BatchTilePlugin_TRT version 1
[TRT] Registered plugin creator - ::Clip_TRT version 1
[TRT] Registered plugin creator - ::CoordConvAC version 1
[TRT] Registered plugin creator - ::CropAndResizeDynamic version 1
[TRT] Registered plugin creator - ::CropAndResize version 1
[TRT] Registered plugin creator - ::DecodeBbox3DPlugin version 1
[TRT] Registered plugin creator - ::DetectionLayer_TRT version 1
[TRT] Registered plugin creator - ::EfficientNMS_Explicit_TF_TRT version 1
[TRT] Registered plugin creator - ::EfficientNMS_Implicit_TF_TRT version 1
[TRT] Registered plugin creator - ::EfficientNMS_ONNX_TRT version 1
[TRT] Registered plugin creator - ::EfficientNMS_TRT version 1
[TRT] Could not register plugin creator - ::FlattenConcat_TRT version 1
[TRT] Registered plugin creator - ::GenerateDetection_TRT version 1
[TRT] Registered plugin creator - ::GridAnchor_TRT version 1
[TRT] Registered plugin creator - ::GridAnchorRect_TRT version 1
[TRT] Registered plugin creator - ::InstanceNormalization_TRT version 1
[TRT] Registered plugin creator - ::InstanceNormalization_TRT version 2
[TRT] Registered plugin creator - ::LReLU_TRT version 1
[TRT] Registered plugin creator - ::ModulatedDeformConv2d version 1
[TRT] Registered plugin creator - ::MultilevelCropAndResize_TRT version 1
[TRT] Registered plugin creator - ::MultilevelProposeROI_TRT version 1
[TRT] Registered plugin creator - ::MultiscaleDeformableAttnPlugin_TRT version 1
[TRT] Registered plugin creator - ::NMSDynamic_TRT version 1
[TRT] Registered plugin creator - ::NMS_TRT version 1
[TRT] Registered plugin creator - ::Normalize_TRT version 1
[TRT] Registered plugin creator - ::PillarScatterPlugin version 1
[TRT] Registered plugin creator - ::PriorBox_TRT version 1
[TRT] Registered plugin creator - ::ProposalDynamic version 1
[TRT] Registered plugin creator - ::ProposalLayer_TRT version 1
[TRT] Registered plugin creator - ::Proposal version 1
[TRT] Registered plugin creator - ::PyramidROIAlign_TRT version 1
[TRT] Registered plugin creator - ::Region_TRT version 1
[TRT] Registered plugin creator - ::Reorg_TRT version 1
[TRT] Registered plugin creator - ::ResizeNearest_TRT version 1
[TRT] Registered plugin creator - ::ROIAlign_TRT version 1
[TRT] Registered plugin creator - ::RPROI_TRT version 1
[TRT] Registered plugin creator - ::ScatterND version 1
[TRT] Registered plugin creator - ::SpecialSlice_TRT version 1
[TRT] Registered plugin creator - ::Split version 1
[TRT] Registered plugin creator - ::VoxelGeneratorPlugin version 1
[TRT] completed loading NVIDIA plugins.
[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] [MemUsageChange] Init CUDA: CPU +2, GPU +0, now: CPU 33, GPU 6143 (MiB)
[TRT] Trying to load shared library libnvinfer_builder_resource.so.8.6.2
[TRT] Loaded shared library libnvinfer_builder_resource.so.8.6.2
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0
[TRT] [MemUsageChange] Init builder kernel library: CPU +1154, GPU +737, now: CPU 1223, GPU 6830 (MiB)
[TRT] CUDA lazy loading is enabled.
[TRT] native precisions detected for GPU: FP32, FP16, INT8
[TRT] selecting fastest native precision for GPU: FP16
[TRT] found engine cache file /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel.1.1.8602.GPU.FP16.engine
[TRT] found model checksum /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel.sha256sum
[TRT] echo “$(cat /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel.sha256sum) /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel” | sha256sum --check --status
[TRT] model matched checksum /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel.sha256sum
[TRT] loading network plan from engine cache… /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel.1.1.8602.GPU.FP16.engine
[TRT] device GPU, loaded /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel
[TRT] Loaded engine size: 24 MiB
[TRT] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[TRT] Deserialization required 72715 microseconds.
[TRT] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +22, now: CPU 0, GPU 22 (MiB)
[TRT] Total per-runner device persistent memory is 0
[TRT] Total per-runner host persistent memory is 130144
[TRT] Allocated activation device memory of size 2408448
[TRT] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +2, now: CPU 0, GPU 24 (MiB)
[TRT] CUDA lazy loading is enabled.
[TRT]
[TRT] CUDA engine context initialized on device GPU:
[TRT] – layers 27
[TRT] – maxBatchSize 1
[TRT] – deviceMemory 2408448
[TRT] – bindings 2
[TRT] binding 0
– index 0
– name ‘data’
– type FP32
– in/out INPUT
– # dims 3
– dim #0 3
– dim #1 224
– dim #2 224
[TRT] binding 1
– index 1
– name ‘prob’
– type FP32
– in/out OUTPUT
– # dims 3
– dim #0 1000
– dim #1 1
– dim #2 1
[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, /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel initialized.
[TRT] loaded 1000 class labels
[TRT] imageNet – networks/ResNet-18/ResNet-18.caffemodel initialized.
[image] loaded ‘/jetson-inference/data/muestra_dedos/dedos_arriba/captura_platon_2.jpg’ (1280x720, 3 channels)
imagenet: 20.03641% class #419 (Band Aid)
[image] saved ‘/jetson-inference/data/muestra_dedos/dedos_arriba/resultado_platon_2.jpg’ (1280x720, 3 channels)

[TRT] ------------------------------------------------
[TRT] Timing Report /usr/local/bin/networks/ResNet-18/ResNet-18.caffemodel
[TRT] ------------------------------------------------
[TRT] Pre-Process CPU 6.70103ms CUDA 8.59709ms
[TRT] Network CPU 30.79947ms CUDA 28.32387ms
[TRT] Post-Process CPU 0.22682ms CUDA 0.22733ms
[TRT] Total CPU 37.72732ms CUDA 37.14829ms
[TRT] ------------------------------------------------

[TRT] note – when processing a single image, run ‘sudo jetson_clocks’ before
to disable DVFS for more accurate profiling/timing measurements

[image] imageLoader – End of Stream (EOS) has been reached, stream has been closed
imagenet: shutting down…
imagenet: shutdown complete.
double free or corruption (out)
Aborted (core dumped)

Hi,

NvMapMemAllocInternalTagged: 1075072515 error 12
NvMapMemHandleAlloc: error 0

This is a known issue in r36.4.7 and has been fixed in r36.5.
To fix the error, you can try to upgrade the system to JetPack 6.2.2.

But Jetson-inference is deprecated, and the support is up to JetPack 6.0.

Thanks.

Ok, so i used the one from l4t-ml that have support for jetpack 6:

sudo docker run -it --rm --runtime nvidia --network host
–shm-size=2g
-v /home/jcm:/data

nvcr.io/nvidia/l4t-ml:r36.2.0-py3

Used the saem ResNet-18 with IMAGENET1K_V1 weights and got this result:

Thats band aid, this is the image class list: https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt

With the confidence level of 10.13% can we conclude that the ResNet18 with base weight cant understand what the thumbs up picture is?

jcm@ubuntu:~$ sudo docker run -it --rm --runtime nvidia --network host
–shm-size=2g
-v /home/jcm:/data

nvcr.io/nvidia/l4t-ml:r36.2.0-py3

allow 10 sec for JupyterLab to start @ http://192.168.100.80:8888 (password nvidia)
JupterLab logging location: /var/log/jupyter.log (inside the container)
root@ubuntu:/# # 1. Crear el archivo directamente
cat < /inferencia_platon.py
import torch
import torchvision.models as models
import torchvision.transforms as transforms
from PIL import Image
import torch.nn.functional as F
import os

img_path = ‘/data/jetson-inference/data/muestra_dedos/dedos_arriba/captura_platon_2.jpg’

if not os.path.exists(img_path):
print(f"ERROR: No se encuentra el archivo en {img_path}")
exit()

Forzamos CPU para evitar el error de memoria 12

device = torch.device(‘cpu’)
model = models.resnet18(weights=‘IMAGENET1K_V1’).to(device).eval()

preprocess = transforms.Compose([
transforms.Resize(256), transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

img = Image.open(img_path).convert(‘RGB’)
img_t = preprocess(img).unsqueeze(0).to(device)

with torch.no_grad():
output = model(img_t)

probabilities = F.softmax(output, dim=1)[0] * 100
confianza, indice = torch.max(probabilities, 0)

print(f"\n— RESULTADO DE PLATÓN —“)
python3 /inferencia_platon.py.item():.2f}%”)

— RESULTADO DE PLATÓN —
ID de Clase: 419
Confianza: 10.13%

Hi,

The container you pulled is for r36.2.
For JetPack 6.2.2 (BSP is r36.5), you can set up the PyTorch environment natively with the steps below:

Thanks.

Hello - The container page shows only one version for jetpack 6: