Files
handleaiuinew/HanddleAI/HandleAiUi-new/handleAi/handleAiModel.cpp
T

40 lines
1.5 KiB
C++

#include<handleAiModelList.hpp>
#include <handleAiModel.h>
#define enableHandleAiModel 0
void handleAiModelManager::handleAiModelManager::run()
{
if (init == true)
return;
handleAiModelinitialization(this);
#if enableHandleAiModel
std::vector<std::future<std::string>> futures;
for (auto& model : segModels)
{
futures.push_back(std::async(std::launch::async, &handleAiModelSeg::init, model.second));
emit _core._qtFunc.sendInitString(QString::fromStdString(fileManager::getFileName(model.second->path) + "初始化中..."));
}
for (auto& model : clsModels)
{
futures.push_back(std::async(std::launch::async, &handleAiModelCls::init, model.second));
emit _core._qtFunc.sendInitString(QString::fromStdString(fileManager::getFileName(model.second->path) + "初始化中..."));
}
for (auto& model : detModels)
{
futures.push_back(std::async(std::launch::async, &handleAiModelDet::init, model.second));
emit _core._qtFunc.sendInitString(QString::fromStdString(fileManager::getFileName(model.second->path) + "初始化中..."));
}
for (auto& func : futures)
{
func.wait();
std::string result = func.get();
emit _core._qtFunc.sendInitString(QString::fromStdString(fileManager::getFileName(result) + "成功"));
qDebug() << QString::fromStdString(fileManager::getFileName(result) + "成功");
std::cout << fileManager::getFileName(result) + "成功" << std::endl;
}
init = true;
status = InitOK;
#endif
}