mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-23 05:56:34 +00:00
Enables use of multiple TPUs in OPI5
This commit is contained in:
@@ -12,13 +12,19 @@ AiEngineInferenceOpi5::AiEngineInferenceOpi5(QString modelPath, QObject *parent)
|
||||
: AiEngineInference{modelPath, parent}
|
||||
{
|
||||
qDebug() << "AiEngineInferenceOpi5() test mModelPath=" << mModelPath;
|
||||
}
|
||||
|
||||
memset(&mRrknnAppCtx, 0, sizeof(rknn_app_context_t));
|
||||
|
||||
void AiEngineInferenceOpi5::initialize(int number)
|
||||
{
|
||||
mNumber = number;
|
||||
|
||||
memset(&mRrknnAppCtx0, 0, sizeof(rknn_app_context_t));
|
||||
init_post_process();
|
||||
|
||||
int ret = init_yolov8_model(modelPath.toLocal8Bit(), &mRrknnAppCtx);
|
||||
int ret = init_yolov8_model(mModelPath.toLocal8Bit(), &mRrknnAppCtx0);
|
||||
if (ret != 0) {
|
||||
qDebug() << "init_yolov8_model() failure! ret: " << ret << "modelPath = " << modelPath;
|
||||
qDebug() << "init_yolov8_model() failure! ret: " << ret << "modelPath = " << mModelPath << "number:" << number;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +33,7 @@ AiEngineInferenceOpi5::AiEngineInferenceOpi5(QString modelPath, QObject *parent)
|
||||
AiEngineInferenceOpi5::~AiEngineInferenceOpi5()
|
||||
{
|
||||
deinit_post_process();
|
||||
release_yolov8_model(&mRrknnAppCtx);
|
||||
release_yolov8_model(&mRrknnAppCtx0);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +116,7 @@ void AiEngineInferenceOpi5::performInferenceSlot(cv::Mat frame)
|
||||
image_buffer_t imgBuffer = convertCV2FrameToImageBuffer(scaledFrame);
|
||||
|
||||
object_detect_result_list od_results;
|
||||
int ret = inference_yolov8_model(&mRrknnAppCtx, &imgBuffer, &od_results);
|
||||
int ret = inference_yolov8_model(&mRrknnAppCtx0, &imgBuffer, &od_results, mNumber);
|
||||
if (ret != 0) {
|
||||
qDebug() << "inference_yolov8_model() failure! ret: " << ret;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user