Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i use this code to two-category yolov5.trt #2

Open
little-siskin opened this issue Jan 4, 2022 · 3 comments
Open

how can i use this code to two-category yolov5.trt #2

little-siskin opened this issue Jan 4, 2022 · 3 comments

Comments

@little-siskin
Copy link

i use this code but i got wrong resuit

@little-siskin
Copy link
Author

i use this code without docker

@little-siskin
Copy link
Author

`import cv2
from yolov5_trt import Yolov5TRTWrapper

engine_path = '/home/o/zrl/models/short/ki67.trt'
labels = ['Y_3', 'B_1'] # List of class names for your model
conf_th = 0.25 # Confidence threshold

wrapper = Yolov5TRTWrapper(engine_path, labels=labels, conf_thresh=conf_th) # See additional options in trt/examples/yolov5_detect.py

images_paths = ["/home/o/zrl/test/2100868-20211012124523_11_8_0.jpg", "/home/o/zrl/test/2101192C-20211012124324_11_13.jpg"] # Path to images

_images_paths = images_paths.split(',')

images_batch = [cv2.imread(image_path) for image_path in images_paths] # read images batch

for image, bboxes in wrapper.detect_from_itterator(images_batch): # Gets detection and image from the itterator
image = wrapper.draw_detections(image, bboxes) # Drawing bboxes on the image
cv2.imwrite('demo.jpg', image)
print(bboxes)`

my code is here
could you give me some advice
thanks

@alxmamaev
Copy link
Owner

@little-siskin Hello, you are do not provide an example of the model wrong output.
By the way, it may depend on your model or environment, the inference code is simple and straightforward.
The first a wall, are you sure, that's you running your code on Jetson?
Jetson has different memory management than regular PC, it used the same memory for GPU and CPU, and code uses this feature for the inference speedup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants