#include #include #define enableHandleAiModel 1 void handleAiModelManager::handleAiModelManager::run() { if (init == true) return; handleAiModelinitialization(this); #if enableHandleAiModel std::vector> 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 }