1、修复读取品规信息excel文件的一些bug。2、当采集到的数量数据行数小于设定的窗口行数时依然能检测

LanXin3D
QuShuailong 2 years ago
parent e51da4f96e
commit 022467dc77

@ -83,7 +83,7 @@ SmokeBoxIdentification::SmokeBoxIdentification(QWidget *parent)
SmokeBoxIdentification::~SmokeBoxIdentification() SmokeBoxIdentification::~SmokeBoxIdentification()
{ {
emit sgControlSideLight(lightCtrl::emTurnOffLight); //emit sgControlSideLight(lightCtrl::emTurnOffLight);
DELETE_POINTER(m_pCategoryMatcher); DELETE_POINTER(m_pCategoryMatcher);
DELETE_POINTER(m_pNetControl); DELETE_POINTER(m_pNetControl);
if (m_pTcpClientThread) if (m_pTcpClientThread)
@ -505,7 +505,10 @@ bool SmokeBoxIdentification::decodeSmokeInfoCsv(const QString& filePath)
{ {
QString smokeCode = wsheet->read(i, colStart).toString(); QString smokeCode = wsheet->read(i, colStart).toString();
QString smokeName = wsheet->read(i, colStart + 1).toString(); QString smokeName = wsheet->read(i, colStart + 1).toString();
if (smokeCode.isEmpty() || smokeName.isEmpty())
continue;
m_mapSmokeCode2Name.insert(smokeCode, smokeName); m_mapSmokeCode2Name.insert(smokeCode, smokeName);
//qDebug() << "insert: " << smokeCode << " and " << smokeName;
} }
qDebug() << "Decode smokeInfo from " << filePath << " successed"; qDebug() << "Decode smokeInfo from " << filePath << " successed";
return true; return true;
@ -542,6 +545,8 @@ bool SmokeBoxIdentification::matchSmokeNameAndTemplateFolderName(const QString&
if (typeFolderName.contains(smokeCNName)) if (typeFolderName.contains(smokeCNName))
{ {
m_mapSmokeName2TemplateFolderName.insert(smokeCNName, typeFolderName); m_mapSmokeName2TemplateFolderName.insert(smokeCNName, typeFolderName);
//qDebug() << "find " << typeFolderName << " in excel";
//qDebug() << "insert " << smokeCNName << " and " << typeFolderName;
smokeCNNameList.removeAt(i); smokeCNNameList.removeAt(i);
bFind = true; bFind = true;
break; break;
@ -549,7 +554,7 @@ bool SmokeBoxIdentification::matchSmokeNameAndTemplateFolderName(const QString&
} }
if (!bFind) if (!bFind)
{ {
qDebug() << "Not find: " << typeFolderName << "in excel"; qDebug() << "Not find: " << typeFolderName << " in excel";
} }
} }
qDebug() << "match smokeName and templateFolderName successed"; qDebug() << "match smokeName and templateFolderName successed";

@ -525,18 +525,19 @@ int dataPreProcessing::dataRepeatMatch(int mBoundary,
if (dataVec[0].size() <= 0) return -1; if (dataVec[0].size() <= 0) return -1;
int startIndex = 20; int startIndex = 20;
int step = 1; int step = 1;
int win = mBoundary + startIndex; int endIndex = mBoundary + startIndex;
qWarning() << "I print mBoundary:" << mBoundary; qWarning() << "I print mBoundary:" << mBoundary;
qWarning() << "I print winSize:" << win; qWarning() << "I print endIndex:" << endIndex;
qWarning() << "I print sensor data size:" << dataVec[0].size(); qWarning() << "I print sensor data size:" << dataVec[0].size();
while (win < dataVec[0].size()) endIndex = endIndex <= dataVec[0].size() ? endIndex : dataVec[0].size();
while (endIndex <= dataVec[0].size())
{ {
QVector<QVector<double>> mLocalData; QVector<QVector<double>> mLocalData;
mLocalData.resize(4); mLocalData.resize(4);
for (int i = 0; i < dataVec.size(); ++i) for (int i = 0; i < dataVec.size(); ++i)
{ {
for (int j = startIndex; j < win; ++j) for (int j = startIndex; j < endIndex; ++j)
{ {
mLocalData[i].push_back(dataVec[i][j]); mLocalData[i].push_back(dataVec[i][j]);
} }
@ -544,7 +545,7 @@ int dataPreProcessing::dataRepeatMatch(int mBoundary,
int val = modelPrediction(mLocalData, typeSerial, leftRightJudge); int val = modelPrediction(mLocalData, typeSerial, leftRightJudge);
if (val < 0) return -1; if (val < 0) return -1;
startIndex+=step; startIndex+=step;
win+=step; endIndex +=step;
} }
int label = -1; int label = -1;
if (mComparedValMapLabel.size() > 0) if (mComparedValMapLabel.size() > 0)

Loading…
Cancel
Save