mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-06 19:46:54 +03:00
add example UI
This commit is contained in:
@@ -37,6 +37,23 @@ ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNTy
|
|||||||
imagesRetention = 5;
|
imagesRetention = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, std::string _cnn_name) : ClassFlowImage(NULL, TAG)
|
||||||
|
{
|
||||||
|
string cnnmodelfile = "";
|
||||||
|
modelxsize = 1;
|
||||||
|
modelysize = 1;
|
||||||
|
CNNGoodThreshold = 0.0;
|
||||||
|
ListFlowControll = NULL;
|
||||||
|
previousElement = NULL;
|
||||||
|
SaveAllFiles = false;
|
||||||
|
disabled = false;
|
||||||
|
isLogImageSelect = false;
|
||||||
|
CNNType = AutoDetect;
|
||||||
|
flowpostalignment = _flowalign;
|
||||||
|
imagesRetention = 5;
|
||||||
|
cnn_name = _cnn_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float analogDigitalTransitionStart)
|
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float analogDigitalTransitionStart)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ protected:
|
|||||||
t_CNNType CNNType;
|
t_CNNType CNNType;
|
||||||
std::vector<general*> GENERAL;
|
std::vector<general*> GENERAL;
|
||||||
float CNNGoodThreshold;
|
float CNNGoodThreshold;
|
||||||
|
std::string cnn_name = "ClassFlowCNNGeneral";
|
||||||
|
|
||||||
//moved to define.h
|
//moved to define.h
|
||||||
//float Analog_error = 3.0;
|
//float Analog_error = 3.0;
|
||||||
@@ -56,6 +57,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype = AutoDetect);
|
ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype = AutoDetect);
|
||||||
|
ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, std::string _cnn_name);
|
||||||
|
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
@@ -81,7 +83,7 @@ public:
|
|||||||
|
|
||||||
t_CNNType getCNNType(){return CNNType;};
|
t_CNNType getCNNType(){return CNNType;};
|
||||||
|
|
||||||
string name(){return "ClassFlowCNNGeneral";};
|
string name(){return "ClassFlowCNNGeneral " + cnn_name;};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -86,8 +86,10 @@ std::string ClassFlowControll::TranslateAktstatus(std::string _input)
|
|||||||
return ("Take Image");
|
return ("Take Image");
|
||||||
if (_input.compare("ClassFlowAlignment") == 0)
|
if (_input.compare("ClassFlowAlignment") == 0)
|
||||||
return ("Aligning");
|
return ("Aligning");
|
||||||
if (_input.compare("ClassFlowCNNGeneral") == 0)
|
if (_input.compare("ClassFlowCNNGeneral Digital") == 0)
|
||||||
return ("Digitalization of ROIs");
|
return ("Digitalization of Digital ROIs");
|
||||||
|
if (_input.compare("ClassFlowCNNGeneral Analog") == 0)
|
||||||
|
return ("Digitalization of Analog ROIs");
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
if (_input.compare("ClassFlowMQTT") == 0)
|
if (_input.compare("ClassFlowMQTT") == 0)
|
||||||
return ("Sending MQTT");
|
return ("Sending MQTT");
|
||||||
@@ -101,7 +103,7 @@ std::string ClassFlowControll::TranslateAktstatus(std::string _input)
|
|||||||
if (_input.compare("ClassFlowPostProcessing") == 0)
|
if (_input.compare("ClassFlowPostProcessing") == 0)
|
||||||
return ("Post-Processing");
|
return ("Post-Processing");
|
||||||
|
|
||||||
return "Unkown Status";
|
return "Unkown Status: " + _input +"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -223,12 +225,12 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
|||||||
}
|
}
|
||||||
if (toUpper(_type).compare("[ANALOG]") == 0)
|
if (toUpper(_type).compare("[ANALOG]") == 0)
|
||||||
{
|
{
|
||||||
cfc = new ClassFlowCNNGeneral(flowalignment);
|
cfc = new ClassFlowCNNGeneral(flowalignment, std::string("Analog"));
|
||||||
flowanalog = (ClassFlowCNNGeneral*) cfc;
|
flowanalog = (ClassFlowCNNGeneral*) cfc;
|
||||||
}
|
}
|
||||||
if (toUpper(_type).compare(0, 7, "[DIGITS") == 0)
|
if (toUpper(_type).compare(0, 7, "[DIGITS") == 0)
|
||||||
{
|
{
|
||||||
cfc = new ClassFlowCNNGeneral(flowalignment);
|
cfc = new ClassFlowCNNGeneral(flowalignment, std::string("Digital"));
|
||||||
flowdigit = (ClassFlowCNNGeneral*) cfc;
|
flowdigit = (ClassFlowCNNGeneral*) cfc;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
|
|||||||
@@ -10,7 +10,11 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="rx"></div>
|
<div id="state">State: Please wait...</div>
|
||||||
|
<hr>
|
||||||
|
<div id="img">Image: Please wait...</div>
|
||||||
|
<hr>
|
||||||
|
<div id="rx">Events:<br></div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -46,6 +50,13 @@
|
|||||||
function onMessage(event) {
|
function onMessage(event) {
|
||||||
console.log(event);
|
console.log(event);
|
||||||
addToLog(event.data);
|
addToLog(event.data);
|
||||||
|
|
||||||
|
data = JSON.parse(event.data)
|
||||||
|
|
||||||
|
// State
|
||||||
|
if (data.hasOwnProperty("state")) {
|
||||||
|
processStateChange(data.state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +71,20 @@
|
|||||||
window.scrollBy(0,document.body.scrollHeight);
|
window.scrollBy(0,document.body.scrollHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processStateChange(state) {
|
||||||
|
document.getElementById('state').innerHTML = "State: <b>" + data.state + "</b>";
|
||||||
|
|
||||||
|
// TODO only reload image for those steps where it changed...
|
||||||
|
var d = new Date();
|
||||||
|
var timestamp = d.getTime();
|
||||||
|
document.getElementById('img').innerHTML = 'Image: <br><img src=' + getDomainname() + '/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'" height=200px;"></img>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateImage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user