Python Code to Compile YOLOv3/v2 Darknet in TX2 that works on GPU

If you have the answer, please comment down bellow, I need your help, Thanks

Hi yohanmarvel012,

I don’t have quick answer, could you list what have you done so far? What issue did you meet on implementation?
Have you search the forum to see if any similar cases as yours?

Thanks

I have a Jetson TX2 that i flash with Jetpack 3.3 and i used opencv 3.4.6
what i have done is I can compile Yolov3 in a real time object detection with the on board camera of TX2 and it works with GPU, but with their file which is darknet.exe
but i want to modify it to be another program, so i search a python code to compile “my yolo file”
but all of the code that i search is work in CPU not work in GPU, and it’s to slow


import numpy as np
import cv2

cap = cv2.VideoCapture(“nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)640, height=(int)480, format=(string)I420, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink”)

while(True):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow(‘frame’,frame)
if cv2.waitKey(1) & 0xFF == ord(‘q’):
break

cap.release()
cv2.destroyAllWindows()

but the weird things is i just make this simple code to activate the on board camera, and it’s works with GPU

I have search a lot of similar case like this bus not works with GPU
what i think is if i can compile a code that works in GPU, it’s going to be real time object detection again
sorry i’m newbie :)

Hi,

Have you check our TensorRT sample?
/usr/src/tensorrt/samples/python/yolov3_onnx/

Thanks.

can you share the link again?

Do you know how to use YOLO from this site?

AastaLLL
I flashed my tx2 with jetpack 3.3 and from the information its included with tensorrt
do you know why i cannot import tensorrt in python?

Hi,

TensorRT python API is supported after JetPack4.2.
Please use our latest JetPack to have the package.

Thanks.