|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
#include "threadSend.h"
|
|
|
|
|
#include <PLCDevice.h>
|
|
|
|
|
#include "exportData.h"
|
|
|
|
|
#include <QMap>
|
|
|
|
|
|
|
|
|
|
extern AlgJd alg_jd[NumberOfSupportedCameras]; //检测胶点的AI算法
|
|
|
|
|
extern ConfPath g_conf_path;
|
|
|
|
@ -149,11 +150,25 @@ void WorkThread::run()
|
|
|
|
|
UDPSendInfo.JD = jd_no;
|
|
|
|
|
|
|
|
|
|
bool IsNG = false;
|
|
|
|
|
int ngReason = 0;
|
|
|
|
|
QMap<int, QString> ng_reason_maps;
|
|
|
|
|
ng_reason_maps[0] = "unknow";
|
|
|
|
|
ng_reason_maps[1] = "less_than_setting";
|
|
|
|
|
ng_reason_maps[2] = "too_diff_from_model";
|
|
|
|
|
ng_reason_maps[3] = "out_of_setting_range";
|
|
|
|
|
for(int index=0;index<unit_count;index++)
|
|
|
|
|
{
|
|
|
|
|
if(vec_results[index].size() < local_SysConf.no[local_camera_number][index])IsNG |= true;
|
|
|
|
|
if(vec_results[index].size() < local_SysConf.no[local_camera_number][index])
|
|
|
|
|
{
|
|
|
|
|
IsNG |= true;
|
|
|
|
|
ngReason = 1;
|
|
|
|
|
}
|
|
|
|
|
//if (vec_results[index].size() != 1)IsNG |= true;//反向训练
|
|
|
|
|
if (local_SysConf.ConfThreshold == 0)IsNG = false;
|
|
|
|
|
if (local_SysConf.ConfThreshold == 0)
|
|
|
|
|
{
|
|
|
|
|
IsNG = false;
|
|
|
|
|
ngReason = 0;
|
|
|
|
|
}
|
|
|
|
|
if (local_SysConf.save == 2)//三张照片分别存储
|
|
|
|
|
{
|
|
|
|
|
cv::Mat m = vec_in[index].clone();
|
|
|
|
@ -171,11 +186,17 @@ void WorkThread::run()
|
|
|
|
|
image1 = vec_out[(result_index) % 2].clone();
|
|
|
|
|
#ifdef DRAW_RECT
|
|
|
|
|
IsNG|=CheckSelectRects(image1,vec_results,(result_index) % 2,local_DisplayLabelConf,0);
|
|
|
|
|
if (IsNG) {
|
|
|
|
|
ngReason = 2;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}else {
|
|
|
|
|
image1 = vec_out[0].clone();
|
|
|
|
|
#ifdef DRAW_RECT
|
|
|
|
|
IsNG|=CheckSelectRects(image1,vec_results,0,local_DisplayLabelConf,0);
|
|
|
|
|
if (IsNG) {
|
|
|
|
|
ngReason = 2;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#ifdef DRAW_RECT
|
|
|
|
@ -187,6 +208,9 @@ void WorkThread::run()
|
|
|
|
|
#ifdef DRAW_RECT
|
|
|
|
|
DrawSelectRects(image2, local_DisplayLabelConf, 1);
|
|
|
|
|
IsNG|=CheckSelectRects(image1,vec_results,2,local_DisplayLabelConf,1);
|
|
|
|
|
if (IsNG) {
|
|
|
|
|
ngReason = 3;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
result_index++;
|
|
|
|
@ -217,7 +241,8 @@ void WorkThread::run()
|
|
|
|
|
now_ts.toString("yyyy-MM-dd") + "/"
|
|
|
|
|
+ QString::number(local_camera_number + 1) + "/" + QString::number(index + 1) + "/" +
|
|
|
|
|
now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + QString::number(local_camera_number + 1) +
|
|
|
|
|
"#" + "_" + QString::number(index + 1) + ".jpg";
|
|
|
|
|
"#" + "_" + QString::number(index + 1) + "_" + ng_reason_maps[ngReason] +
|
|
|
|
|
".jpg";
|
|
|
|
|
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
|
|
|
|
|
|
|
|
|
|
m = vec_out[index].clone();
|
|
|
|
@ -225,7 +250,8 @@ void WorkThread::run()
|
|
|
|
|
now_ts.toString("yyyy-MM-dd") + "/"
|
|
|
|
|
+ QString::number(local_camera_number + 1) + "/" + QString::number(index + 1) + "/" +
|
|
|
|
|
now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + QString::number(local_camera_number + 1) +
|
|
|
|
|
"#" + "_" + QString::number(index + 1) + ".bmp";;
|
|
|
|
|
"#" + "_" + QString::number(index + 1) + "_" + ng_reason_maps[ngReason] +
|
|
|
|
|
".bmp";;
|
|
|
|
|
//g_save_queue->put(std::make_pair(file_name.toStdString(), m));
|
|
|
|
|
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
|
|
|
|
|
}
|
|
|
|
|