PaddleOCR
PaddleOCR copied to clipboard
predictor->Run()在多线程下崩溃问题
2.2版本,c++使用paddleOcr, 创建多个线程,每个线程参考c++示例,同时识别多张图片,发现predictor->Run()这个函数经常崩溃,加锁后恢复正常,这个有人遇到过吗
请问你有解决问题了嘛
你有解决问题了嘛
我这边想到的就只是加锁
我改的多线程也崩溃了,请问需要在代码哪个地方加锁啊?
我改的多线程也崩溃了,请问需要在代码哪个地方加锁啊?
崩溃的地方加锁,predictor->Run()前后
您好,请教一下我这样加锁对吗?为什么我加了仍然会在这附近卡住挂掉
mutex mu_Run_Predictor;
mu_Run_Predictor.lock();
std::cout << "In -- this->predictor_->Run() " << std::endl;
this->predictor_->Run();
mu_Run_Predictor.unlock();
您好,请教一下我这样加锁对吗?为什么我加了仍然会在这附近卡住挂掉 mutex mu_Run_Predictor; mu_Run_Predictor.lock(); std::cout << "In -- this->predictor_->Run() " << std::endl; this->predictor_->Run(); mu_Run_Predictor.unlock();
我把锁包住了前面获取input handle到后面获取output handle并copy,整个用到preditor的地方都包住就不crash了