Compare commits

...

3 Commits
main ... Test

Author SHA1 Message Date
Mr.V 57b5178413 1、优化识别切分效果,增加报警信息 2024-08-12 09:44:49 +08:00
Mr.V f18e10f8f3 1、优化识别切分效果,增加报警信息 2024-08-12 09:41:48 +08:00
Mr.V d72bd78b59 1、识别结果增加车厢开始结束时间
2、来车检测后,对来车状态改为存储在txt中,模型推理时读取来判定帧所对应的车厢状态
2024-06-19 13:57:23 +08:00
30 changed files with 581 additions and 6992 deletions

File diff suppressed because one or more lines are too long

BIN
app/train

Binary file not shown.

View File

@ -114,7 +114,7 @@ model:
gc_http_open: 1 gc_http_open: 1
username: "guest_01" username: "guest_01"
password: "d55b0f642e817eea24725d2f2a31dd08" # 神东 password: "0a1688bce402a5f6a4279abbfc89c203" # 神东 d55b0f642e817eea24725d2f2a31dd08
gc_http_url: "http://192.168.2.211:20004/api/train-carriage/identification/video-save" gc_http_url: "http://192.168.2.211:20004/api/train-carriage/identification/video-save"
gc_gettoken_url: "http://192.168.2.211:20004/api/blade-auth/oauth/token" gc_gettoken_url: "http://192.168.2.211:20004/api/blade-auth/oauth/token"
gc_image_srv: "http://192.168.2.211:9010/" gc_image_srv: "http://192.168.2.211:9010/"
@ -182,5 +182,5 @@ gc_c_space_frame_width: 500
# 是否识别车头 # 是否识别车头
gc_train_heard_detect: true gc_train_heard_detect: true
#过期文件夹天数 # 识别结果保存天数
gc_days_for_result_expire_folder: 3 gc_days_for_result_expire_folder: 3

View File

@ -516,6 +516,7 @@ typedef struct
uint64_t i64TimeStamp = 0; //帧数据时间戳 uint64_t i64TimeStamp = 0; //帧数据时间戳
std::shared_ptr<DecodedData> pDecodeData = nullptr; std::shared_ptr<DecodedData> pDecodeData = nullptr;
int iDirection = 0; //行驶方向(0-未知; 1-向左; 2-向右) int iDirection = 0; //行驶方向(0-未知; 1-向左; 2-向右)
int nMonitorState = MONITOR_MODEL_INIT_STATE;
} SaveImgData; } SaveImgData;
//识别处理数据 //识别处理数据
@ -895,6 +896,7 @@ typedef struct
int iBigClassId = -1; //大框id (给第二步用 1-属性 23456-编号) int iBigClassId = -1; //大框id (给第二步用 1-属性 23456-编号)
uint32_t iFrameId = 0; //帧号 uint32_t iFrameId = 0; //帧号
float fCenterX; //第一步识别目标中心点X坐标 float fCenterX; //第一步识别目标中心点X坐标
float fTargetWidth; // 第一步识别目标X坐标宽度
} CalculateInfo; } CalculateInfo;

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,7 @@ private:
std::map<int, std::vector<std::string>> mapSourcePushPort_; std::map<int, std::vector<std::string>> mapSourcePushPort_;
MoveData moveData_; MoveData moveData_;
std::queue<MoveData> queuwMoveData_;
std::string strDataDir_; std::string strDataDir_;
uint32_t iOrigDataNO_; //原过车数据个数 uint32_t iOrigDataNO_; //原过车数据个数

File diff suppressed because one or more lines are too long

View File

@ -65,6 +65,8 @@ private:
int nDelayTime; int nDelayTime;
bool bIsAvc_ = false; bool bIsAvc_ = false;
int iAudioStream_ = -1; int iAudioStream_ = -1;
bool bCameraError_ = false;
}; };
ENGINE_REGIST(CameraEngine) ENGINE_REGIST(CameraEngine)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -48,6 +48,7 @@ private:
private: private:
std::string strResultPath_; std::string strResultPath_;
std::string strLogBakPath_;
int iDaysNumber_; int iDaysNumber_;
}; };

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,22 @@
using namespace ai_matrix; using namespace ai_matrix;
namespace
{
std::map<std::string, std::string> mapLoad = {
{"C62", "60"},
{"C62B", "61"},
{"C63", "61"},
{"C64", "61"},
{"C65", "60"},
{"C70", "70"},
{"C80", "80"},
{"KM70", "70"},
{"KM81", "81"},
{"KM98", "98"}
};
}
MergerAllEngine::MergerAllEngine() {} MergerAllEngine::MergerAllEngine() {}
MergerAllEngine::~MergerAllEngine() {} MergerAllEngine::~MergerAllEngine() {}
@ -113,6 +129,8 @@ void MergerAllEngine::PushData(std::shared_ptr<Train> pTrain)
<< "集装箱2: " << pTrain->container2.strContainerNo << "\n" << "集装箱2: " << pTrain->container2.strContainerNo << "\n"
<< "集装箱2图片: " << pTrain->container2.strBestImg << "\n" << "集装箱2图片: " << pTrain->container2.strBestImg << "\n"
<< "集装箱2时间戳: " << pTrain->container2.i64TimeStamp << "\n" << "集装箱2时间戳: " << pTrain->container2.i64TimeStamp << "\n"
<< "车厢开始时间: " << MyUtils::getins()->Stamp2Time(pTrain->i64StartTimeStamp, true) << "\n"
<< "车厢结束时间: " << MyUtils::getins()->Stamp2Time(pTrain->i64EndTimeStamp, true) << "\n"
<< " ---所有信息合并结果 END--- "; << " ---所有信息合并结果 END--- ";
if (pTrain->bIsEnd) if (pTrain->bIsEnd)
{ {
@ -310,12 +328,28 @@ APP_ERROR MergerAllEngine::Process()
web端无法过滤的问题 web端无法过滤的问题
*/ */
if (!bHeadFrontFlag_ && pTrain->bIsEnd && pTrain->trainNum.iTrainTypeId == -1) if (!bHeadFrontFlag_
&& pTrain->bIsEnd
&& pTrain->trainNum.iTrainTypeId == -1)
{ {
LogDebug << "cometime:" << pTrain->strTrainDate << " " << pTrain->strTrainName << " iCarXH:" << pTrain->iCarXH LogDebug << "cometime:" << pTrain->strTrainDate << " " << pTrain->strTrainName << " iCarXH:" << pTrain->iCarXH
<< " num:" << pTrain->trainNum.strTrainNum; << " num:" << pTrain->trainNum.strTrainNum;
pTrain->trainNum.iTrainTypeId = 0; pTrain->trainNum.iTrainTypeId = 0;
} }
// 修正载重
for (std::map<std::string, std::string>::iterator it =
mapLoad.begin();
it != mapLoad.end(); ++it) {
if (pTrain->trainNum.strTrainType.find(it->first) !=
std::string::npos) {
pTrain->trainPro.strLoad = it->second;
}
}
// if (pTrain->trainPro.strLoad.size() > 2 && pTrain->trainPro.strLoad[0] != '1') pTrain->trainPro.strLoad = "";
PushData(pTrain); PushData(pTrain);
//最后一节处理后,初始化参数 //最后一节处理后,初始化参数

File diff suppressed because one or more lines are too long

View File

@ -154,6 +154,7 @@ APP_ERROR SaveImgEngine::Process()
Json::Value jvFrameInfo; Json::Value jvFrameInfo;
jvFrameInfo["timeStamp"] = pSaveImgData->i64TimeStamp; jvFrameInfo["timeStamp"] = pSaveImgData->i64TimeStamp;
jvFrameInfo["status"] = iStatus; jvFrameInfo["status"] = iStatus;
jvFrameInfo["moveType"] = pSaveImgData->nMonitorState;
jvFrameInfo["direction"] = pSaveImgData->iDirection; jvFrameInfo["direction"] = pSaveImgData->iDirection;
jvFrameInfo["width"] = iWidth; jvFrameInfo["width"] = iWidth;
jvFrameInfo["height"] = iHeight; jvFrameInfo["height"] = iHeight;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
#include "SocketEngine.h" #include "SocketEngine.h"
@ -313,7 +313,7 @@ void* SocketEngine::heart_handler(void* arg)
++it; ++it;
} }
} }
sleep(3); // 定时三秒 sleep(1); // 定时三秒
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -192,6 +192,8 @@ void MoveEngine::SingleDeviceProcess(std::shared_ptr<ProcessData> pProcessData,
{ {
outputQueMap_[engineName_ + "_" + std::to_string(engineId_) + "_" + std::to_string(*iter)]->push(std::static_pointer_cast<void>(pMoveData)); outputQueMap_[engineName_ + "_" + std::to_string(engineId_) + "_" + std::to_string(*iter)]->push(std::static_pointer_cast<void>(pMoveData));
} }
// LogInfo << "【来车检测】" << pMoveData->iFrameId << " isEnd:" << pProcessData->bIsEnd;
//通知第一步开始识别 //通知第一步开始识别
outputQueMap_[engineName_ + "_" + std::to_string(engineId_) + "_5"]->push(std::static_pointer_cast<void>(pMoveData)); outputQueMap_[engineName_ + "_" + std::to_string(engineId_) + "_5"]->push(std::static_pointer_cast<void>(pMoveData));
} }
@ -211,6 +213,7 @@ void MoveEngine::SingleDeviceProcess(std::shared_ptr<ProcessData> pProcessData,
pSaveImgData->bIsEnd = pProcessData->bIsEnd; pSaveImgData->bIsEnd = pProcessData->bIsEnd;
pSaveImgData->bSaveToFtp = true; pSaveImgData->bSaveToFtp = true;
pSaveImgData->i64TimeStamp = pProcessData->i64TimeStamp; pSaveImgData->i64TimeStamp = pProcessData->i64TimeStamp;
pSaveImgData->nMonitorState = nType;
outputQueMap_[strPort0_]->push(std::static_pointer_cast<void>(pSaveImgData)); outputQueMap_[strPort0_]->push(std::static_pointer_cast<void>(pSaveImgData));
} }
@ -282,16 +285,16 @@ APP_ERROR MoveEngine::Process()
// LogInfo<<"来车当前状态:"<< (nType == 0 ? "有车头" : (nType == 1 ? "无车")); // LogInfo<<"来车当前状态:"<< (nType == 0 ? "有车头" : (nType == 1 ? "无车"));
switch (nType) { switch (nType) {
case 0: case 0:
LogDebug << "来车状态:有车头"; LogDebug << iMoveDataNO_ * dataSourceCfg_.iSkipInterval << "来车状态:有车头";
break; break;
case 1: case 1:
LogDebug << "来车状态:无车"; LogDebug << iMoveDataNO_ * dataSourceCfg_.iSkipInterval << "来车状态:无车";
break; break;
case 2: case 2:
LogDebug << "来车状态:车尾"; LogDebug << iMoveDataNO_ * dataSourceCfg_.iSkipInterval << "来车状态:车尾";
break; break;
case 3: case 3:
LogDebug << "来车状态:有车"; LogDebug << iMoveDataNO_ * dataSourceCfg_.iSkipInterval << "来车状态:有车";
break; break;
} }

View File

@ -194,9 +194,9 @@ void TrainStepOneEngine::FilterInvalidInfo(std::vector<stDetection> &vecRet, std
std::vector<stDetection> vecSpaceInfo; std::vector<stDetection> vecSpaceInfo;
for (auto it = vecRet.begin(); it != vecRet.end();) for (auto it = vecRet.begin(); it != vecRet.end();)
{ {
LogDebug << "frameId:" << pProcessData->iFrameId // LogDebug << "frameId:" << pProcessData->iFrameId
<< " bigclassid:" << it->class_id << " ltx:" << it->bbox[0] << " lty:" << it->bbox[1] // << " bigclassid:" << it->class_id << " ltx:" << it->bbox[0] << " lty:" << it->bbox[1]
<< " rbx:" << it->bbox[2] << " rby:" << it->bbox[3]; // << " rbx:" << it->bbox[2] << " rby:" << it->bbox[3];
// 根据配置文件中 设置的识别范围,过滤掉无效数据 // 根据配置文件中 设置的识别范围,过滤掉无效数据
if (!(it->bbox[0] >= dataSourceCfg.fIdentifyAreasLTX && if (!(it->bbox[0] >= dataSourceCfg.fIdentifyAreasLTX &&
it->bbox[1] >= dataSourceCfg.fIdentifyAreasLTY && it->bbox[1] >= dataSourceCfg.fIdentifyAreasLTY &&
@ -322,6 +322,22 @@ void TrainStepOneEngine::FilterInvalidInfo(std::vector<stDetection> &vecRet, std
continue; continue;
} }
if (it->class_id == K_TRAIN_NUM)
{
int iCenterY = pProcessData->iHeight / 2;
int iHeight0 = it->bbox[1] / 2 + it->bbox[3] / 2;
if (iHeight0 > iCenterY) {
LogWarn << "矿车编号大框在画面Y轴中线以下帧号:"
<< pProcessData->iFrameId
<< " 画面Y轴中心" << iCenterY
<< " 大框Y轴中心" << iHeight0 ;
// << "[" << it->bbox[0] << "," << it->bbox[1] << "]"
// << "[" << it->bbox[2] << "," << it->bbox[3] << "]";
it = vecRet.erase(it);
continue;
}
}
//补连塔的相机比较近,间隔基本在画面底部,因此当间隔比较靠画面上时过滤掉。 //补连塔的相机比较近,间隔基本在画面底部,因此当间隔比较靠画面上时过滤掉。
if ((it->class_id >= 9 && it->class_id <= 17 && it->class_id != 15) || it->class_id == U_TRAIN_SPACE) if ((it->class_id >= 9 && it->class_id <= 17 && it->class_id != 15) || it->class_id == U_TRAIN_SPACE)
{ {
@ -484,10 +500,10 @@ APP_ERROR TrainStepOneEngine::Process()
SetTargetType(postSubData); SetTargetType(postSubData);
pPostData->vecPostSubData.emplace_back(postSubData); pPostData->vecPostSubData.emplace_back(postSubData);
// LogDebug << "数据源:" << pProcessData->iDataSource << " 帧:" << pProcessData->iFrameId LogDebug << "数据源:" << pProcessData->iDataSource << " 帧:" << pProcessData->iFrameId
// << " --iClassId:" << singledata.iClassId << " iLine:" << singledata.iLine << " confidence=" << singledata.fScore << " --iClassId:" << singledata.iClassId << " iLine:" << singledata.iLine << " confidence=" << singledata.fScore
// << " lx=" << singledata.fLTX << " ly=" << singledata.fLTY << " rx=" << singledata.fRBX << " ry=" << singledata.fRBY << " lx=" << singledata.fLTX << " ly=" << singledata.fLTY << " rx=" << singledata.fRBX << " ry=" << singledata.fRBY
// << " clear:" << singledata.fClear; << " clear:" << singledata.fClear;
} }
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -113,8 +113,8 @@ void Inference::doInference(IExecutionContext& context, cudaStream_t& stream, vo
void Inference::doInferenceV2(IExecutionContext& context, cudaStream_t& stream, void **buffers, unsigned int outputIndex, float* output, int outputSize, int batchSize) void Inference::doInferenceV2(IExecutionContext& context, cudaStream_t& stream, void **buffers, unsigned int outputIndex, float* output, int outputSize, int batchSize)
{ {
context.enqueue(batchSize, buffers, stream, nullptr); // context.enqueue(batchSize, buffers, stream, nullptr);
//context.enqueueV2(buffers, stream, nullptr); context.enqueueV2(buffers, stream, nullptr);
CUDA_CHECK(cudaMemcpyAsync(output, buffers[outputIndex], batchSize * outputSize * sizeof(float), cudaMemcpyDeviceToHost, stream)); CUDA_CHECK(cudaMemcpyAsync(output, buffers[outputIndex], batchSize * outputSize * sizeof(float), cudaMemcpyDeviceToHost, stream));
cudaStreamSynchronize(stream); cudaStreamSynchronize(stream);
} }