fix 分类添加panel,分类分数不做softmax

dev_lsy
liusiyang 2 weeks ago
parent 13afe246d5
commit 5ad8f89815

@ -600,8 +600,8 @@ int AIModel_Impl::F2softmaxId(float *data, int class_num, float *fmaxScore)
std::vector<float> output(cls_num);
for (int i = 0; i < output.size(); i++)
{
float outi = (float)exp(data[i]) / (float)total;
output[i] = outi;
// float outi = (float)exp(data[i]) / (float)total;
output[i] = data[i]; // 不做softmax处理(模型已经做了)
// output.push_back(outi);
// std::cout<<"output["<<i<<"]="<<output[i]<<std::endl;
}

@ -20,6 +20,7 @@ enum AI_CLass_QX_NAME_
AI_CLass_QX_NAME_QueXi, // 缺锡
AI_CLass_QX_NAME_YiWu, // 异物
AI_CLass_QX_NAME_C_BianXing, // C型卡口异常
AI_CLass_QX_NAME_Panel, // 其他
AI_CLass_QX_NAME_count,
};
// 缺陷项对应在参数中的名称
@ -32,6 +33,7 @@ static const std::string AI_CLass_QX_NAME_Names[] =
"QueXi",
"YiWu",
"C_BianXing",
"Panel",
};
#endif

@ -180,6 +180,9 @@ static int GetClsTypeByLabel(int nLabel)
case 6:
cls_num = AI_CLass_QX_NAME_C_BianXing;
break;
case 7:
cls_num = AI_CLass_QX_NAME_Panel;
break;
default:
break;
}
@ -1927,8 +1930,8 @@ int ImgCheckAnalysisy::AI_QX_Class_Thread()
// 分类 label 映射:优先读映射配置文件(KK_cls.txt),读不到用默认顺序
int cls_num = GetClsTypeByLabel(temClass);
// std::string strclassName = AI_CLass_QX_NAME_Names[cls_num];
// printf("AI Class num %d = %s %f\n", cls_num, strclassName.c_str(), result->cls_score);
std::string strclassName = AI_CLass_QX_NAME_Names[cls_num];
m_pdetlog->AddCheckstr(PrintLevel_1, "AI Class num", "%d = %s %f\n", cls_num, strclassName.c_str(), result->cls_score);
// 分类存图 开启。
if (m_pbaseCheckFunction->saveImg.bSaveClsImg)
@ -2186,7 +2189,7 @@ int ImgCheckAnalysisy::AIClassTypeToConfigType(int nAIQXType)
{
// 无对应缺陷类型时返回 CONFIG_QX_NAME_count(缺陷列表已移除 other)
int resultError_type = CONFIG_QX_NAME_count;
int resultError_type = AI_CLass_QX_NAME_Panel;
switch (nAIQXType)
{
case AI_CLass_QX_NAME_PIN_PoSun:
@ -2210,6 +2213,9 @@ int ImgCheckAnalysisy::AIClassTypeToConfigType(int nAIQXType)
case AI_CLass_QX_NAME_C_BianXing:
resultError_type = CONFIG_QX_NAME_C_BianXing;
break;
case AI_CLass_QX_NAME_Panel:
resultError_type = CONFIG_QX_NAME_Panel;
break;
default:
break;
}

Loading…
Cancel
Save