Run image acquisition and imageNet in parallel processes


I have the following few lines of code in Python:

import jetson.utils
import jetson.inference
import multiprocessing

def detect(frame):
    detections = net1.Detect(frame, overlay="labels")
def imagenet(frame):
    class_id, confidence = net2.Classify(frame

net1 = jetson.inference.detectNet("",arg_detectnet, threshold=0.3)
net2 = jetson.inference.imageNet('googlenet', arg_imagenet)
input = jetson.utils.videoSource("csi://0", arg)
output = jetosn.utils.videoOutput("", arg_out)
frame = input.Capture()
#detect_net = net1.Detect(frame, overlay="labels")
#classify_net = net2.Classify(frame)
multiprocess.Process(target=detect, args(frame,))
multiprocess.Process(target=imagenet, args(frame,))

I want run my networks parallel to my image aqcuistion. But if I try to run the networks in a parallel process I will get the following error:

[cuda]        initialization error (error 3) (hex 0x03)
[cuda]        /home/roman/Downloads/jetson-inference/c/tensorNet.h:627

I want to have a smooth image in my output and won´t be processing every image. But I still want to show the image in output.Render.
Is it possible to run the image acquisition parallel to my detectnet and/or imagenet?

Thank you in advance for your help.

Both imageNet and detectNet use the GPU, so you would probably not want to run them from parallel CPU threads/processes. Also the multi-process is probably messing up the CUDA memory because multiple processes aren’t sharing the address spaces.