You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
3.6 KiB
107 lines
3.6 KiB
/*
|
|
* @Author: xiewenji 527774126@qq.com
|
|
* @Date: 2025-09-03 10:33:48
|
|
* @LastEditors: xiewenji 527774126@qq.com
|
|
* @LastEditTime: 2025-09-14 20:28:10
|
|
* @FilePath: /AI_SO_Test/AIEngineModule/src/AI_Factory.cpp
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
#include "AI_Factory.h"
|
|
|
|
#include "AIModel_Impl.h"
|
|
|
|
std::shared_ptr<AIModel_Base> AIModel_Base::GetInstance()
|
|
{
|
|
std::shared_ptr<AIModel_Base> instance = std::make_shared<AIModel_Impl>();
|
|
return instance;
|
|
}
|
|
|
|
AIFactory::AIFactory()
|
|
{
|
|
}
|
|
|
|
AIFactory::~AIFactory()
|
|
{
|
|
}
|
|
std::shared_ptr<AIFactory> AIFactory::GetInstance()
|
|
{
|
|
static std::shared_ptr<AIFactory> instance = std::make_shared<AIFactory>();
|
|
return instance;
|
|
}
|
|
|
|
int AIFactory::InitALLAIModle(GPU_Config gupconfig)
|
|
{
|
|
if (gupconfig.GetNum() == 0)
|
|
{
|
|
printf("GPU Num Error \n");
|
|
return 1;
|
|
}
|
|
|
|
if (!CELL_CA_Det)
|
|
{
|
|
CELL_CA_Det = AIModel_Base::GetInstance();
|
|
AIModel_Base::AIModelRun_Config edge_config;
|
|
edge_config.gpuconfig.copy(gupconfig);
|
|
edge_config.strPath = "/home/aidlux/BOE/UseModel_CellAOI/Detect_CA.engine";
|
|
edge_config.strName = "CA_Det";
|
|
edge_config.inputType = AIModel_Base::Input_HWC;
|
|
edge_config.Stream_num = 2;
|
|
CELL_CA_Det->Init(edge_config);
|
|
}
|
|
if (!CELL_TA_Det)
|
|
{
|
|
CELL_TA_Det = AIModel_Base::GetInstance();
|
|
AIModel_Base::AIModelRun_Config edge_config;
|
|
edge_config.gpuconfig.copy(gupconfig);
|
|
edge_config.strPath = "/home/aidlux/BOE/UseModel_CellAOI/Detect_TA.engine";
|
|
edge_config.strName = "TA_Det";
|
|
edge_config.inputType = AIModel_Base::Input_HWC;
|
|
edge_config.Stream_num = 2;
|
|
CELL_TA_Det->Init(edge_config);
|
|
}
|
|
if (!CELL_Align)
|
|
{
|
|
CELL_Align = AIModel_Base::GetInstance();
|
|
AIModel_Base::AIModelRun_Config edge_config;
|
|
edge_config.gpuconfig.copy(gupconfig);
|
|
edge_config.strPath = "/home/aidlux/BOE/UseModel_CellAOI/Align.engine";
|
|
edge_config.strName = "Align";
|
|
edge_config.inputType = AIModel_Base::Input_HWC;
|
|
CELL_Align->Init(edge_config);
|
|
}
|
|
if (!CELL_Mark)
|
|
{
|
|
CELL_Mark = AIModel_Base::GetInstance();
|
|
AIModel_Base::AIModelRun_Config edge_config;
|
|
edge_config.gpuconfig.copy(gupconfig);
|
|
edge_config.strPath = "/home/aidlux/BOE/UseModel_CellAOI/Cell_marker.engine";
|
|
edge_config.strName = "Mark";
|
|
edge_config.inputType = AIModel_Base::Input_HWC;
|
|
CELL_Mark->Init(edge_config);
|
|
}
|
|
if (!CELL_CA_Cls)
|
|
{
|
|
CELL_CA_Cls = AIModel_Base::GetInstance();
|
|
AIModel_Base::AIModelRun_Config jbl_config;
|
|
jbl_config.gpuconfig.copy(gupconfig);
|
|
jbl_config.strPath = "/home/aidlux/BOE/UseModel_CellAOI/Class_10.engine";
|
|
jbl_config.inputType = AIModel_Base::Input_HWC;
|
|
jbl_config.strName = "CA_Class";
|
|
jbl_config.IsClass = true;
|
|
CELL_CA_Cls->Init(jbl_config);
|
|
}
|
|
if (!CELL_TA_Cls)
|
|
{
|
|
CELL_TA_Cls = AIModel_Base::GetInstance();
|
|
AIModel_Base::AIModelRun_Config jbl_config;
|
|
jbl_config.gpuconfig.copy(gupconfig);
|
|
jbl_config.strPath = "/home/aidlux/BOE/UseModel_CellAOI/Class_10_TA.engine";
|
|
jbl_config.inputType = AIModel_Base::Input_HWC;
|
|
jbl_config.strName = "TA_Class";
|
|
jbl_config.IsClass = true;
|
|
CELL_TA_Cls->Init(jbl_config);
|
|
}
|
|
m_bInitSucc = true;
|
|
return 0;
|
|
}
|