Hello,
I’m using Jetson Xavier and I have created python multiprocess application for video analytics, containing the following 2 processes (Entirely Separate with no inter process communication):
- Simple process for capture video source by openCV and showing it with openCV imshow .
- Process that taking constant tenzor and run it through a pytorch nn model with cuda in an infinite loop.
(I started with 2 connected processes for capture the video and then process the frames concurrent but to debug the problem I broke the connection and ran it on constant tensor)
The problem is that when only the video process is running the video is smooth. But when the NN process works concurrently the video become not smooth, that, even though the fps for the video process is 25 like I designed it by waitkey.
I suspect that I’m using all my gpu resources for the NN and then the frame show rendering is on hold for a few milliseconds until the gpu is free for render. If it’s indeed the reason for my problem, can I determine priority for gpu usage between the two processes? Do you have another idea how to solve it?
This is the pseudo code (the original is offline and I can’t upload it):
Process1:
Video = cv2.capture (video_source)
While True
Frame = Video.get()
Cv2.imshow(frame)
Waitkey(40)
# Check fps
Process2:
model = # loading the pytorch NN model
tenzor = # creating zeros pytorch cuda tenzor
while True
model(tenzor)
Attaching tegrastats from running time
Thanks
moti