v1.4.t3
Fixed a few bugs in the stat output strings so they should output to the stat file as expected.
This commit is contained in:
parent
7ab51226b2
commit
4f33c280ce
|
@ -224,8 +224,7 @@ bool rdConf(shared_t *share)
|
||||||
share->vidExt = "mp4";
|
share->vidExt = "mp4";
|
||||||
share->recLoopWait = false;
|
share->recLoopWait = false;
|
||||||
share->skipCmd = false;
|
share->skipCmd = false;
|
||||||
share->statData = string();
|
share->stat = string();
|
||||||
share->stat = stringstream(share->statData);
|
|
||||||
share->network = dnn::readNet("/etc/mow/yolov5s.onnx");
|
share->network = dnn::readNet("/etc/mow/yolov5s.onnx");
|
||||||
share->classNames = loadClassList();
|
share->classNames = loadClassList();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <sstream>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include <opencv4/opencv2/opencv.hpp>
|
#include <opencv4/opencv2/opencv.hpp>
|
||||||
|
@ -36,14 +35,13 @@ using namespace std;
|
||||||
using namespace std::filesystem;
|
using namespace std::filesystem;
|
||||||
|
|
||||||
#define BUF_SZ 10
|
#define BUF_SZ 10
|
||||||
#define APP_VER "1.4.t2"
|
#define APP_VER "1.4.t3"
|
||||||
|
|
||||||
struct shared_t
|
struct shared_t
|
||||||
{
|
{
|
||||||
stringstream stat;
|
|
||||||
vector<string> classNames;
|
vector<string> classNames;
|
||||||
dnn::Net network;
|
dnn::Net network;
|
||||||
string statData;
|
string stat;
|
||||||
string recordUrl;
|
string recordUrl;
|
||||||
string outDir;
|
string outDir;
|
||||||
string postCmd;
|
string postCmd;
|
||||||
|
|
|
@ -74,7 +74,7 @@ void recLoop(shared_t *share)
|
||||||
|
|
||||||
ofstream file(string(cleanDir(share->buffDir) + "/stat").c_str());
|
ofstream file(string(cleanDir(share->buffDir) + "/stat").c_str());
|
||||||
|
|
||||||
file << share->statData;
|
file << share->stat;
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
|
|
@ -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
|
// out of all of the results returned form the threads, pick
|
||||||
// the block with the highest amount of pixDiff.
|
// 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))
|
if ((results[i].pixDiff >= share->blockThresh) && (results[i].pixDiff > maxPixDiff))
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,8 @@ bool objectInImage(const Mat &src, const Rect &area, shared_t *share)
|
||||||
|
|
||||||
float *data = (float *)outputs[0].data;
|
float *data = (float *)outputs[0].data;
|
||||||
|
|
||||||
share->stat << "object_detection---" << endl;
|
share->stat += "object_detection---\n";
|
||||||
share->stat << " outputs_size=" << outputs.size() << " looking_for_objects..." << endl;
|
share->stat += " outputs_size=" + to_string(outputs.size()) + " looking_for_objects...\n";
|
||||||
|
|
||||||
for (int i = 0; i < 25200; ++i)
|
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);
|
minMaxLoc(scores, 0, &maxClassScore, 0, &classId);
|
||||||
|
|
||||||
share->stat << " potential_object[confidence_level]=" << data[4] << endl;
|
share->stat += " potential_object[confidence_level]=" + to_string(data[4]) + "\n";
|
||||||
share->stat << " potential_object[class_score]=" << maxClassScore << endl;
|
share->stat += " potential_object[class_score]=" + to_string(maxClassScore) + "\n";
|
||||||
|
|
||||||
if (maxClassScore > 0.2)
|
if (maxClassScore > 0.2)
|
||||||
{
|
{
|
||||||
share->stat << " object_confirmed" << endl;
|
share->stat += " object_confirmed\n";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ bool objectInImage(const Mat &src, const Rect &area, shared_t *share)
|
||||||
data += 85;
|
data += 85;
|
||||||
}
|
}
|
||||||
|
|
||||||
share->stat << " no_objects_found" << endl;
|
share->stat += " no_objects_found\n";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user