We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
温馨提示:根据社区不完全统计,按照模板提问,可以加快回复和解决问题的速度
cmake .. -DENABLE_ORT_BACKEND=ON \ -DENABLE_PADDLE_BACKEND=ON \ -DENABLE_OPENVINO_BACKEND=ON \ -DENABLE_TRT_BACKEND=ON \ -DWITH_GPU=ON \ -DTRT_DIRECTORY=${Path/to/TensorRT} \ -DCUDA_DIRECTORY=/usr/local/cuda \ -DCMAKE_INSTALL_PREFIX=${PWD}/compiled_fastdeploy_sdk \ -DENABLE_VISION=ON \ -DOPENCV_DIRECTORY=${/usr/local/lib/cmake/opencv4} make -j12 make install
void Model::ProcessBatchImage(std::vector<cv::Mat>& batch_images, std::vector<fastdeploy::vision::DetectionResult>* batch_results){ if (!model->BatchPredict(batch_images, batch_results)) { std::cerr << "Failed to predict batch." << std::endl; return; } batch_images.clear(); batch_results->clear(); } void Model::InferImagesBatch(const std::vector<std::string>& batch_files){ std::vector<cv::Mat> batch_images; std::vector<std::string> batch_names; std::vector<fastdeploy::vision::DetectionResult> batch_results; batch_images.reserve(cfg.bs); for (const auto& file_path : batch_files) { auto image = cv::imread(file_path); if (image.empty()) { std::cerr << "Failed to load image: " << file_path << std::endl; continue; // Skip this image and continue with the next } batch_images.push_back(image); if (batch_images.size() == cfg.bs) ProcessBatchImage(batch_images, &batch_results); } // 处理剩余的图片(如果有) if (!batch_images.empty()) ProcessBatchImage(batch_images, &batch_results); }
更多代码可以参考:https://github.com/LorenzoSun-V/LorenzoDeploy/tree/main/fd/src中的model.cc,核心的就是model->BatchPredict这个代码。
model->BatchPredict
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
+1,尤其是第一张没有结果,其他的就没有结果了
rainyfly
No branches or pull requests
温馨提示:根据社区不完全统计,按照模板提问,可以加快回复和解决问题的速度
环境
问题日志及出现问题的操作流程
我的多batch推理代码:
更多代码可以参考:https://github.com/LorenzoSun-V/LorenzoDeploy/tree/main/fd/src中的model.cc,核心的就是
model->BatchPredict
这个代码。The text was updated successfully, but these errors were encountered: