jetson-multicamera-pipelines icon indicating copy to clipboard operation
jetson-multicamera-pipelines copied to clipboard

Got Error in example.py: Pipeline element is None!

Open sharoseali opened this issue 2 years ago • 2 comments

@dusty-nv @tomek-l HI I am working on jetson Nano and I want to run detection with 4 usb camera streams simulteaneously. I downloaded deepstream version 5.1 for jetson from Nvidia deepstream website. After going from all steps as defined in readme. I run the script example.py but I get the following error. I have attached 4 usb webcams with my nano. Any help please..... thanks

Downloading pretrained weights for DashCamNet model. This may take a while...
Dowloaded pre-trained DashCamNet model to: /home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/models/dashcamnet/dashcamnet_pruned_v1.0
Pipeline element is None!
Traceback (most recent call last):
  File "example.py", line 16, in <module>
    display=False,
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/multicamDNN.py", line 47, in __init__
    super().__init__(**kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/basepipeline.py", line 25, in __init__
    self._p = self._create_pipeline(**kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/multicamDNN.py", line 52, in _create_pipeline
    p = self._create_pipeline_fully_connected(self._c, self._m, **kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/multicamDNN.py", line 86, in _create_pipeline_fully_connected
    nvinfers = [_make_element_safe("nvinfer") for _ in model_list]
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/multicamDNN.py", line 86, in <listcomp>
    nvinfers = [_make_element_safe("nvinfer") for _ in model_list]
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/utils/gst.py", line 45, in _make_element_safe
    raise NameError(f"Could not create element {el_type}")
NameError: Could not create element nvinfer
Exception ignored in: <bound method BasePipeline.__del__ of <jetmulticam.pipelines.multicamDNN.CameraPipelineDNN object at 0x7f7cf107f0>>
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/basepipeline.py", line 38, in __del__
    self.stop()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/jetmulticam/pipelines/basepipeline.py", line 41, in stop
    self._p.send_event(Gst.Event.new_eos())
AttributeError: 'CameraPipelineDNN' object has no attribute '_p'

Here is the code examples.py

import time
from jetmulticam import CameraPipelineDNN
from jetmulticam.models import PeopleNet, DashCamNet

if __name__ == "__main__":

    pipeline = CameraPipelineDNN(
        cameras=[0, 1, 2],
        models=[
            #PeopleNet.DLA1,
            #DashCamNet.DLA0,
            PeopleNet.GPU
        ],
        save_video=False,
        save_video_folder="/home/nx/logs/videos",
        display=False,
    )

    while pipeline.running():

        # We can access the captured images here.
        # For example `pipeline.images` is a list of numpy arrays for each camera
        # In my case (RGB 1080p image), `arr` will be np.ndarray with shape: (1080, 1920, 3)
        arr = pipeline.images[0]
        print(type(arr))

        # Detections in each image are available here as a list of dicts:
        dets = pipeline.detections[0]
        print(dets)

        # Assuming there's one detection in `image[0]`, `dets` can look like so:
        # [{
        #     'class': 'person',
        #     'position': (361.31, 195.60, 891.96, 186.05), # bbox (left, width, top, height)
        #     'confidence': 0.92
        # }]

        # Main thread is not tied in any computation.
        # We can perform any operations on our images.
        avg = pipeline.images[0].mean()
        print(avg)
        time.sleep(1 / 30)

I also run examples/example-no-ai.py with editing my camera 4 ids like here: import time

from jetmulticam import CameraPipeline

if __name__ == "__main__":

    p = CameraPipeline([1, 3, 0, 2])

    print(p.running())

    for _ in range(100):
        arr = p.read(0)
        if arr is not None:
            print(arr.shape)
        time.sleep(0.1) 

and the output I get is as follows

with Sudo

sudo python3 example-no-ai.py


[sudo] password for ubuntu: 
<__gi__.GstNvArgusCameraSrc object at 0x7f73d01990 (GstNvArgusCameraSrc at 0xe28d1a0)> <__gi__.Gstnvvconv object at 0x7f73d01af8 (Gstnvvconv at 0xdfed5d0)>
<__gi__.GstNvArgusCameraSrc object at 0x7f73d019d8 (GstNvArgusCameraSrc at 0xe28d860)> <__gi__.Gstnvvconv object at 0x7f73d01b88 (Gstnvvconv at 0xdfb6770)>
<__gi__.GstNvArgusCameraSrc object at 0x7f73d01a20 (GstNvArgusCameraSrc at 0xe294df0)> <__gi__.Gstnvvconv object at 0x7f73d01bd0 (Gstnvvconv at 0xdf02df0)>
<__gi__.GstNvArgusCameraSrc object at 0x7f73d01a68 (GstNvArgusCameraSrc at 0xe295420)> <__gi__.Gstnvvconv object at 0x7f73d01cf0 (Gstnvvconv at 0xdefd510)>
Opening in BLOCKING MODE 
Opening in BLOCKING MODE 
Opening in BLOCKING MODE 
Opening in BLOCKING MODE 
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:740 No cameras available
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:740 No cameras available
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:740 No cameras available
NvMMLiteOpen : Block : BlockType = 4 
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:740 No cameras available
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
NvMMLiteOpen : Block : BlockType = 4 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
True

I also verify my camera ids that either they are correct or not with v4l2-ctl --list-devices But they are fine. The output is :

Webcam C170 (usb-70090000.xusb-2.1.1.1):
	/dev/video1

Webcam C170 (usb-70090000.xusb-2.1.1.4):
	/dev/video3

Webcam C170 (usb-70090000.xusb-2.1.3):
	/dev/video0

Webcam C170 (usb-70090000.xusb-2.1.4):
	/dev/video2

sharoseali avatar Jun 16 '22 12:06 sharoseali

I had a similar error while using GStreamer and RTSP server. I used the command -- ./examples/test-launch "nvarguscamerasrc ! video/xraw(memory:NVMM) width=1920 height=1080 framerate=30/1 format=NV12 ! omxh264enc iframeinterval=15! h264parse ! rtph264pay name=pay0 pt=96" It shows -- stream ready at rtsp://127.0.0.1:8554/test Then later get this error same as mentioned in the thread above -- Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:740 No cameras available Framerate set to : 30 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4 ===== NVMEDIA: NVENC ===== NvMMLiteBlockCreate : Block : BlockType = 4 H264: Profile = 66, Level = 40

What is this error? Is there any help for this ?

roshan-gopalakrishnan avatar Jun 22 '22 09:06 roshan-gopalakrishnan

I am also getting the same issue.

@Authors, can you please have a explain on this.

MlLearnerAkash avatar Mar 09 '23 08:03 MlLearnerAkash