laugh12321 / TensorRT-YOLO

🚀 你的YOLO部署神器。TensorRT Plugin、CUDA Kernel、CUDA Graphs三管齐下,享受闪电般的推理速度。| Your YOLO Deployment Powerhouse. With the synergy of TensorRT Plugins, CUDA Kernels, and CUDA Graphs, experience lightning-fast inference speeds.
https://github.com/laugh12321/TensorRT-YOLO
GNU General Public License v3.0
538 stars 67 forks source link

[Help]: 配合betterDXcam使用无法检出目标 #45

Closed qq923004243 closed 2 weeks ago

qq923004243 commented 2 weeks ago
from tensorrt_yolo.infer import DeployCGDet, generate_labels_with_colors, visualize_detections
import cv2
import betterdxcam

if __name__ == "__main__":

    is_obb = False
    labels = generate_labels_with_colors('labels_det.txt')
    model = DeployCGDet('yolov5x.engine', is_obb)

    camera = betterdxcam.create(region=(500,500,820, 820), output_color='BGR')
    while True:
        screen = camera.grab()
        if screen is None:
            continue
        results = model.predict(screen)
        # Visualize the detection results
        print(results)
        vis_img = visualize_detections(screen, results, labels)
        if vis_img is not None:
            # Display the visualization
            cv2.imshow('Detection Result', vis_img)
            if (cv2.waitKey(1) & 0xFF) == ord('q'):
                break

,如果是使用正常的yolov5模型预测正常可以输出检测项目,但是目前在该项目中貌似没有检测目标,是需要在单独完成什么插件吗,我已经按照步骤完成环境部署和模型转换,但是没结果哈,但是值得一提的是我使用官方demo,如果是使用读取文件能够正常的绘制图片并且写出,但是我用dxcam实时检测就不能检测数据,这是我的运行结果和环境输出: image

环境输出: image 官方demo运行结果: image image image

laugh12321 commented 2 weeks ago

@qq923004243 我这边电脑重装了,可能过段时间才能给你复现。

对于你说的使用betterDXcam没有结果,从它已经返回DetectionResult来看,推理是正常执行了的,那么只有两种可能:

qq923004243 commented 2 weeks ago

@laugh12321 感谢你的反馈,确实是betterdxcam.create().grab()返回的是RGB格式,在此之前的dxcam是可以默认返回RGB的,我完成了通道转换以后拥有了识别结果 感谢。 image