Closed HarborC closed 1 year ago
没有检测到物体啊,确认下你的图片没问题,或者你直接在python下面用pt模型检测能检测到结果吗? 不行的话请提供一下图片,我我检查一下啥问题。
我只读取了一张图片,然后再循环中检测同一张图像的物体,控制台显示在一开始可以检测出来,后面就都检测不出来了,图片应该是没有问题。python下面用pt模型检测能检测到结果。我用cpu运行就没有这个问题
std::string model_path = "D:/Code/onnx_sky_seg/Sky-Segmentation-and-Post-processing/skyseg.onnx";
SkySeg sky_seg(model_path);
std::string image_path = "D:/Code/onnx_sky_seg/Sky-Segmentation-and-Post-processing/pano_images/1679476170.981470.jpg";
cv::Mat image = cv::imread(image_path);
std::string seg_model_path = "D:/Code/onnx_sky_seg/yolov8m-seg.onnx";
PersonSeg person_seg(seg_model_path);
for (int i = 0; i < 100; i++) {
TicToc timer;
cv::Mat result;
person_seg.segment(image, result);
cv::imwrite("D:/Code/onnx_sky_seg/yolov8-opencv-onnxruntime-cpp-main/test.jpg", image);
std::cout << "time: " << timer.toc() << " ms" << std::endl;
}
如果是这样,你将读取部分也放置在循环当中,或者去掉drawPred,因为这个函数会在原来的图像上面绘制结果,会修改到原始图片导致你后面无法检测
有效,谢谢你的帮助
Hi, Thank you for your work. I modified you code as the below, and I test the segment function of yolov8_seg.h by loop using cuda. Then Error messages "Detect Failed!" appear one line apart. Could you give me some advice.