Fixed a few bugs in the stat output strings so they should output to the
stat file as expected.
This commit is contained in:
Maurice ONeal 2022-09-29 14:52:42 -04:00
parent 7ab51226b2
commit 4f33c280ce
5 changed files with 15 additions and 14 deletions

View File

@ -224,8 +224,7 @@ bool rdConf(shared_t *share)
share->vidExt = "mp4";
share->recLoopWait = false;
share->skipCmd = false;
share->statData = string();
share->stat = stringstream(share->statData);
share->stat = string();
share->network = dnn::readNet("/etc/mow/yolov5s.onnx");
share->classNames = loadClassList();

View File

@ -25,7 +25,6 @@
#include <thread>
#include <dirent.h>
#include <filesystem>
#include <sstream>
#include <mutex>
#include <opencv4/opencv2/opencv.hpp>
@ -36,14 +35,13 @@ using namespace std;
using namespace std::filesystem;
#define BUF_SZ 10
#define APP_VER "1.4.t2"
#define APP_VER "1.4.t3"
struct shared_t
{
stringstream stat;
vector<string> classNames;
dnn::Net network;
string statData;
string stat;
string recordUrl;
string outDir;
string postCmd;

View File

@ -74,7 +74,7 @@ void recLoop(shared_t *share)
ofstream file(string(cleanDir(share->buffDir) + "/stat").c_str());
file << share->statData;
file << share->stat;
file.close();

View File

@ -90,7 +90,11 @@ bool imgDiff(Mat prev, Mat next, Rect *block, shared_t *share)
{
// out of all of the results returned form the threads, pick
// the block with the highest amount of pixDiff.
share->stat << "block_thread:" << " x=" << results[i].x << " y=" << results[i].y << " pixdiff=" << results[i].pixDiff << endl;
auto x = results[i].x;
auto y = results[i].y;
auto diff = results[i].pixDiff;
share->stat += "block_thread:" + string(" x=") + to_string(x) + " y=" + to_string(y) + " pixdiff=" + to_string(diff) + "\n";
if ((results[i].pixDiff >= share->blockThresh) && (results[i].pixDiff > maxPixDiff))
{

View File

@ -28,8 +28,8 @@ bool objectInImage(const Mat &src, const Rect &area, shared_t *share)
float *data = (float *)outputs[0].data;
share->stat << "object_detection---" << endl;
share->stat << " outputs_size=" << outputs.size() << " looking_for_objects..." << endl;
share->stat += "object_detection---\n";
share->stat += " outputs_size=" + to_string(outputs.size()) + " looking_for_objects...\n";
for (int i = 0; i < 25200; ++i)
{
@ -44,12 +44,12 @@ bool objectInImage(const Mat &src, const Rect &area, shared_t *share)
minMaxLoc(scores, 0, &maxClassScore, 0, &classId);
share->stat << " potential_object[confidence_level]=" << data[4] << endl;
share->stat << " potential_object[class_score]=" << maxClassScore << endl;
share->stat += " potential_object[confidence_level]=" + to_string(data[4]) + "\n";
share->stat += " potential_object[class_score]=" + to_string(maxClassScore) + "\n";
if (maxClassScore > 0.2)
{
share->stat << " object_confirmed" << endl;
share->stat += " object_confirmed\n";
return true;
}
@ -58,7 +58,7 @@ bool objectInImage(const Mat &src, const Rect &area, shared_t *share)
data += 85;
}
share->stat << " no_objects_found" << endl;
share->stat += " no_objects_found\n";
return false;
}