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); std::vector<float> output(cls_num);
for (int i = 0; i < output.size(); i++) for (int i = 0; i < output.size(); i++)
{ {
float outi = (float)exp(data[i]) / (float)total; // float outi = (float)exp(data[i]) / (float)total;
output[i] = outi; output[i] = data[i]; // 不做softmax处理(模型已经做了)
// output.push_back(outi); // output.push_back(outi);
// std::cout<<"output["<<i<<"]="<<output[i]<<std::endl; // 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_QueXi, // 缺锡
AI_CLass_QX_NAME_YiWu, // 异物 AI_CLass_QX_NAME_YiWu, // 异物
AI_CLass_QX_NAME_C_BianXing, // C型卡口异常 AI_CLass_QX_NAME_C_BianXing, // C型卡口异常
AI_CLass_QX_NAME_Panel, // 其他
AI_CLass_QX_NAME_count, AI_CLass_QX_NAME_count,
}; };
// 缺陷项对应在参数中的名称 // 缺陷项对应在参数中的名称
@ -32,6 +33,7 @@ static const std::string AI_CLass_QX_NAME_Names[] =
"QueXi", "QueXi",
"YiWu", "YiWu",
"C_BianXing", "C_BianXing",
"Panel",
}; };
#endif #endif

@ -180,6 +180,9 @@ static int GetClsTypeByLabel(int nLabel)
case 6: case 6:
cls_num = AI_CLass_QX_NAME_C_BianXing; cls_num = AI_CLass_QX_NAME_C_BianXing;
break; break;
case 7:
cls_num = AI_CLass_QX_NAME_Panel;
break;
default: default:
break; break;
} }
@ -1927,8 +1930,8 @@ int ImgCheckAnalysisy::AI_QX_Class_Thread()
// 分类 label 映射:优先读映射配置文件(KK_cls.txt),读不到用默认顺序 // 分类 label 映射:优先读映射配置文件(KK_cls.txt),读不到用默认顺序
int cls_num = GetClsTypeByLabel(temClass); int cls_num = GetClsTypeByLabel(temClass);
// std::string strclassName = AI_CLass_QX_NAME_Names[cls_num]; 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); 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) if (m_pbaseCheckFunction->saveImg.bSaveClsImg)
@ -2186,7 +2189,7 @@ int ImgCheckAnalysisy::AIClassTypeToConfigType(int nAIQXType)
{ {
// 无对应缺陷类型时返回 CONFIG_QX_NAME_count(缺陷列表已移除 other) // 无对应缺陷类型时返回 CONFIG_QX_NAME_count(缺陷列表已移除 other)
int resultError_type = CONFIG_QX_NAME_count; int resultError_type = AI_CLass_QX_NAME_Panel;
switch (nAIQXType) switch (nAIQXType)
{ {
case AI_CLass_QX_NAME_PIN_PoSun: case AI_CLass_QX_NAME_PIN_PoSun:
@ -2210,6 +2213,9 @@ int ImgCheckAnalysisy::AIClassTypeToConfigType(int nAIQXType)
case AI_CLass_QX_NAME_C_BianXing: case AI_CLass_QX_NAME_C_BianXing:
resultError_type = CONFIG_QX_NAME_C_BianXing; resultError_type = CONFIG_QX_NAME_C_BianXing;
break; break;
case AI_CLass_QX_NAME_Panel:
resultError_type = CONFIG_QX_NAME_Panel;
break;
default: default:
break; break;
} }

Loading…
Cancel
Save