diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7892d98..2aac23c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,30 @@
# Changelog
All notable changes to this project will be documented in this file.
+## Release 5.0.0
+
+### New features
+- Supports FlowConfig feature to set images to process / provide results
+- Provide version of module via 'OnNewStatusModuleVersion'
+- Function 'getParameters' to provide PersistentData parameters
+- Check if features of module can be used on device and provide this via 'OnNewStatusModuleIsActive' event / 'getStatusModuleActive' function
+- Function to 'resetModule' to default setup
+
+### Improvements
+- New UI design available (e.g. selectable via CSK_Module_PersistentData v4.1.0 or higher), see 'OnNewStatusCSKStyle'
+- check if instance exists if selected
+- check if models exist in selected folder
+- 'loadParameters' returns its success
+- 'sendParameters' can control if sent data should be saved directly by CSK_Module_PersistentData
+- Changed log level of some messages from 'info' to 'fine'
+- Sample images converted to JPG
+- Added UI icon and browser tab information
+
+### Bugfix
+- Never deregistered from events
+- Error if module is not active but 'getInstancesAmount' was called
+- processImageNUM did not work after deregistering from event to process images
+
## Release 4.1.0
### New features
diff --git a/CSK_Module_MultiDeepLearning/pages/assets/CSK_Module_MultiDeepLearning/UI_sample.png b/CSK_Module_MultiDeepLearning/pages/assets/CSK_Module_MultiDeepLearning/UI_sample.png
new file mode 100644
index 0000000..24e3524
Binary files /dev/null and b/CSK_Module_MultiDeepLearning/pages/assets/CSK_Module_MultiDeepLearning/UI_sample.png differ
diff --git a/CSK_Module_MultiDeepLearning/pages/assets/legacy/settings.json b/CSK_Module_MultiDeepLearning/pages/assets/legacy/settings.json
index 939ec2a..a845df1 100644
--- a/CSK_Module_MultiDeepLearning/pages/assets/legacy/settings.json
+++ b/CSK_Module_MultiDeepLearning/pages/assets/legacy/settings.json
@@ -1,3 +1,9 @@
{
-"showLoginButton": false
+ "canChangeLanguage": true,
+ "showLoginButton": false,
+ "defaultLanguage": "en",
+ "disableEditMode": true,
+ "showPageHistory": true,
+ "compactMode": false,
+ "canChangeCompactMode": false
}
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.css b/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.css
index 14fc6df..6d3a758 100644
--- a/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.css
+++ b/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.css
@@ -1,15 +1,117 @@
.myViewer_CSK_Module_MultiDeepLearning > div > div {
- max-height: 800px;
- min-height: 800px;
+ max-height: 600px;
+ min-height: 600px;
+}
+
+.myCustomSpacerVert10_CSK_Module_MultiDeepLearning {
+ min-height: 10px;
+}
+
+.myCustomSpacerVert20_CSK_Module_MultiDeepLearning {
+ min-height: 20px;
+}
+
+.myCustomFrameLabel_CSK_Module_MultiDeepLearning {
+ background: white;
+ position:relative;
+ top: calc(-1.2rem);
+ left: calc(1rem);
+ font-size: medium;
+}
+
+.myCustomMargin99Percent_CSK_Module_MultiDeepLearning {
+ margin: calc(1rem);
+ margin-top: 20px;
+}
+
+.myCustomMarginFirstRow_CSK_Module_MultiDeepLearning {
+ margin-top: -49px;
+}
+
+.myCustomMarginLeft30PX_CSK_Module_MultiDeepLearning {
+ margin-left:30px;
+}
+
+.myCustomMarginLeft-30PX_CSK_Module_MultiDeepLearning {
+ margin-left:-30px;
+}
+
+.myCustomMarginLeft7PX_CSK_Module_MultiDeepLearning {
+ margin-left: -7px;
+}
+
+.myCustomMarginLeft15PX_CSK_Module_MultiDeepLearning {
+ margin-left: 15px;
+}
+
+.myCustomMarginInline1Rem_CSK_Module_MultiDeepLearning {
+ margin-inline: calc(1rem);
+}
+
+.myCustomPersistentDataMargin_CSK_Module_MultiDeepLearning {
+ margin-top: -53px;
+ margin-left: 130px;
+}
+
+.myCustomPersistentDataMarginBack_CSK_Module_MultiDeepLearning {
+ margin-left: -127px;
+}
+
+.myCustomBorderBottom_CSK_Module_MultiDeepLearning {
+ border-bottom: 1px solid lightgray;
+ margin-inline: calc(1rem);
+}
+
+.myCustomBorderLeft_CSK_Module_MultiDeepLearning {
+ border-left: 1px solid lightgray;
+}
+
+.myCustomTabFrame_CSK_Module_MultiDeepLearning {
+ width: 98%;
+ align-self: center;
+}
+
+.myCustomLabel_CSK_Module_MultiDeepLearning {
+ font-size:30px;
+ color: grey;
+ margin-top: 10px;
+}
+
+.myCustomFrameNoColor_CSK_Module_MultiDeepLearning {
+ margin: 6px;
+ border-radius: 10px;
+ border-style: solid;
+ border-width: 0px;
+ border-color: 007CC1;
+ background-color: #FFFFFF;
}
.myCustomFrame_CSK_Module_MultiDeepLearning {
+ margin: 6px;
+ border-radius: 10px;
border-style: solid;
border-width: 1px;
- border-color: grey;
+ border-color: #007CC1;
+ background-color: white;
+}
+
+.myCustomFrameNoColor_CSK_Module_MultiDeepLearning {
margin: 6px;
+ border-radius: 10px;
+ border-style: solid;
+ border-width: 0px;
+ border-color: 007CC1;
+ background-color: white;
}
-.myCustomSpacerVert10_CSK_Module_MultiDeepLearning {
- min-height: 10px;
+.myCustomMarginTop7PX_CSK_Module_MultiDeepLearning {
+ margin-top: 7px;
+}
+
+.myCustomBackground_CSK_Module_MultiDeepLearning {
+}
+
+.myCustomButton_CSK_Module_MultiDeepLearning {
+ border-radius: 30px;
+ padding-right: 0px;
}
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.html b/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.html
index b3d4b20..3ac9528 100644
--- a/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.html
+++ b/CSK_Module_MultiDeepLearning/pages/pages/CSK_Module_MultiDeepLearning/CSK_Module_MultiDeepLearning.html
@@ -1,59 +1,402 @@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-
-
-
-
-
-
- Load on reboot
-
-
-
-
-
-
-
-
-
-
- Load Config
-
-
-
-
-
-
-
-
- Save Config
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Please login with user level Maintenance to see this page.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Please login with user level Maintenance to see this page.
+
+
+
+
+
+
+
+
+
+
+
+
+ Module is not supported on this device...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/pages/src/converter.ts b/CSK_Module_MultiDeepLearning/pages/src/converter.ts
index 68ba704..dd7090f 100644
--- a/CSK_Module_MultiDeepLearning/pages/src/converter.ts
+++ b/CSK_Module_MultiDeepLearning/pages/src/converter.ts
@@ -7,4 +7,65 @@ export function changeID(id) {
viewerElement.setAttribute('viewer-id', id);
viewerElement.triggerResume();
return id;
+}
+
+export function changeStyle(theme) {
+ const style: HTMLStyleElement = document.createElement('style');
+ style.id ='blub'
+ if (theme == 'CSK_Style'){
+ var headerToolbar = `.sopasjs-ui-header-toolbar-wrapper { background-color: #FFFFFF; }`
+ var uiHeader = `.sopasjs-ui-header>.app-logo { margin-right:0px; }`
+ var appLogo = `.app-logo { background-color:#FFFFFF; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAtCAIAAACmg/d8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAArZSURBVHhe7Zp7bFtXHccH6+i6AauYBu1AQgzGYLAJCQSiQMVLPIQE2garxiRAG0IM/iggjWpTmzZNX3k1aV5O4rycd7O8mrZJmjRJ7fgRO+80dhzHTvyIHdt52I7jt3PL17mue+z41ZJKm+Ovfn9Y9/zO8fX5nHN+v9+9fuROUgmtJOAEVxJwgisJOMGVBJzgSgJOcCUBJ7iSgBNcScAJriTgBFcScILrQwTYuOEe01nrJw0wgdqyYnP7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E37NuC1H4leRtlI0v+BkJqs/PotTnSDdY8vbyrsq1ogAOyubwoWsIa/XZhu7A4Vu3ugKGmijKtWBAYR7ZsF2osPJWZvWDGB6nRFmlwCBUaeRv0vwBChJ2K6oh0gyGI4Ov8HrtAcQFO6qOrJOAEVxJwgisJOMGVBJzgSgJOcCUBJ7iSgBNcScAJrTt3/gfzR65/IHLpiAAAAABJRU5ErkJggg==) }`
+ var uiNavbar =`.sopasjs-ui-navbar-wrapper { background-color: #737F85; }`
+ var navbarMenuLiActive = `.sopasjs-navbar-menu>li.active { background-color: #283c45; }`
+ var navbarMenuLiActiveA = `.sopasjs-navbar-menu>li.active>a { background-color: #283c45; }`
+ var navbarMeluLi = `.sopasjs-navbar-menu>li { color: #FFFFFF; }`
+ var navbarMeluLiA = `.sopasjs-navbar-menu>li>a { color: #FFFFFF; }`
+ var headerToolbarButtonHighlight = `.sopasjs-ui-header-toolbar-button.sopasjs-ui-navigation-navbutton>a.highlight { background-color: #737F85; }`
+ var toolbarButton = `.sopasjs-ui-header-toolbar-button>a { color: #283c45; }`
+
+ var customBackground = `.CSK_Module_MultiDeepLearning .myCustomBackground_CSK_Module_MultiDeepLearning { background-color: #737F8522; }` // font-family: "Open Sans"; }`
+
+ style.innerHTML = headerToolbar;
+ style.innerHTML += uiHeader;
+ style.innerHTML += appLogo;
+ style.innerHTML += uiNavbar;
+ style.innerHTML += navbarMenuLiActive;
+ style.innerHTML += navbarMenuLiActiveA;
+ style.innerHTML += navbarMeluLi;
+ style.innerHTML += navbarMeluLiA;
+ style.innerHTML += headerToolbarButtonHighlight;
+ style.innerHTML += toolbarButton;
+
+ style.innerHTML += customBackground;
+ }
+ else if (theme == 'None'){
+ var headerToolbar = `.sopasjs-ui-header-toolbar-wrapper { background-color: #007fc3; }`
+ var uiHeader = `.sopasjs-ui-header>.app-logo { margin-right:10px; }`
+ var appLogo = `.app-logo { background-color:#007fc3; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAAB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/Gkntd6RVY/FuvzW8EFPbKCKLlZYCPm/Xd14DrkhQx0AtG4v4UGzr8C7+kaD2l2rVWHQMWMMHg9U2zGTR6QLoK1zJuRCo/Y60bixiI18PLcIbpdYvNWvZWPQsWDM3qG2YyGID/MGdBfyHWL+aUIVfEcl3KH5Izy/Fx+mjsUa4KJD36XhTtjS8G176faStG2tdsMb1DKUs9oDfZcBpl5WNOH/GL6lI76hb8d2lixpXgtMvXIHBqRiujODSoG+A+Qn4GfBV4AJBfoms+h4vC3XsOTVuOvy8ZcFlT2q8iSyGaq7Tx5xEFkPwksUQvGQxBC9ZDMFLFkPwksUQvGQxBC9ZDMFLFkPwksUQvGQxBC9ZDMFLFkPwksUQvGQxBC9ZDMFnata/dLDegR+YrlcAAAAASUVORK5CYII=') }`
+ var uiNavbar =`.sopasjs-ui-navbar-wrapper { background-color: #f6f8f9; }`
+ var navbarMenuLiActive = `.sopasjs-navbar-menu>li.active { background-color: #007fc3; }`
+ var navbarMenuLiActiveA = `.sopasjs-navbar-menu>li.active>a { background-color: #007fc3; }`
+ var navbarMeluLi = `.sopasjs-navbar-menu>li { color: #697987; }`
+ var navbarMeluLiA = `.sopasjs-navbar-menu>li>a { color: #505f6b; }`
+ var headerToolbarButtonHighlight = `.sopasjs-ui-header-toolbar-button.sopasjs-ui-navigation-navbutton>a.highlight { background-color: #006093; }`
+ var toolbarButton = `.sopasjs-ui-header-toolbar-button>a { color: #cce5f3; }`
+
+ var customBackground = `.CSK_Module_MultiDeepLearning .myCustomBackground_CSK_Module_MultiDeepLearning { background-color: #fff; }` // font-family: "sans-serif"; }`
+
+ style.innerHTML = headerToolbar;
+ style.innerHTML += uiHeader;
+ style.innerHTML += appLogo;
+ style.innerHTML += uiNavbar;
+ style.innerHTML += navbarMenuLiActive;
+ style.innerHTML += navbarMenuLiActiveA;
+ style.innerHTML += navbarMeluLi;
+ style.innerHTML += navbarMeluLiA;
+ style.innerHTML += headerToolbarButtonHighlight;
+ style.innerHTML += toolbarButton;
+
+ style.innerHTML += customBackground;
+ }
+ document.head.append(style);
+ return theme
}
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/pages/src/index.ts b/CSK_Module_MultiDeepLearning/pages/src/index.ts
index e69de29..3143acc 100644
--- a/CSK_Module_MultiDeepLearning/pages/src/index.ts
+++ b/CSK_Module_MultiDeepLearning/pages/src/index.ts
@@ -0,0 +1,17 @@
+document.addEventListener('sopasjs-ready', () => {
+ const page_1 = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(3) > a > i');
+ page_1.classList.remove('fa-file');
+ page_1.classList.add('fa-eye');
+
+ const page_FirstLabel = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(2)');
+ const page_App = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(4)');
+ const page_Setup = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(5) > a');
+
+ page_FirstLabel.remove();
+ page_App.remove();
+ page_Setup.remove();
+
+ setTimeout(() => {
+ document.title = 'CSK_Module_MultiDeepLearning'
+ }, 500);
+})
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/project.mf.xml b/CSK_Module_MultiDeepLearning/project.mf.xml
index b9638d1..ecc14e0 100644
--- a/CSK_Module_MultiDeepLearning/project.mf.xml
+++ b/CSK_Module_MultiDeepLearning/project.mf.xml
@@ -21,7 +21,7 @@ Typically to configure this module to work with other modules you should do this
- Notify currently selected DNN model.
+ Notify currently selected Deep Neural Network (DNN) model.
@@ -45,7 +45,7 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific
- Example of dynamically created event to notify measured result of instance. +
+ Example of dynamically created event to notify result if the class for this instance was determined with the necessary score. +
NUM will be replaced by the number of instance (e.g. "OnNewResult1"). +
INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific instance exists.
@@ -168,6 +168,22 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific
Notify if the processing result should be sorted by class index instead of highest score.
+
+ Notify if FlowConfig should have priority for FlowConfig relevant configurations.
+
+
+
+ Notify UI style to use for CSK modules.
+
+
+
+ Notify version of module.
+
+
+
+ Notify if module can be used on device.
+
+ Function to register "OnResume" of the module UI (only as helper function).
@@ -177,7 +193,7 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific
- Set DNN model to use.
+ Set Deep Neural Network (DNN) model to use.
@@ -193,7 +209,7 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event of sepecific
- Example of dynamically served function to process DNN on an image. +
+ Example of dynamically served function to execute Deep Neural Network (DNN) on an image. +
NUM will be replaced by the number of instance (e.g. "processImage1"). +
INFO: Other modules can check via "Script.isServedAsFunction" if function of sepecific instance exists. +
Needs then to be called via "Script.callFunction()" (INFO: By using this, the first return value is just the "success" of this callFunction(), see AppEngine docu) +
@@ -204,14 +220,12 @@ Needs then to be called via "Script.callFunction()" (INFO: By using this, the fi
Send parameters to CSK_PersistentData module if possible to save them.
+
Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.
-
- Load parameters for this module from the CSK_PersistentData module if possible and use them.
- Set event to listen for incoming images to process. Will be set for currently selected instance (see "setInstance").
@@ -248,10 +262,107 @@ IMPORTANT: As instances start their own threads, the module needs to be restarte
Function to set if the processing result should be sorted by class index instead of highest score.
+
+ Function to configure if FlowConfig should have priority for FlowConfig relevant configuration.
+
+
+
+ Function to clear FlowConfig relevant configurations.
+
+
+ Function to get status if module is active.
+
+
+
+ Load parameters for this module from the CSK_PersistentData module if possible and use them.
+
+
+
+ released
+ Function to get all parameters of the client in JSON format.
+
+
+
+
+ Function to reset main configuration of module.
+
+
+ released
+ Crown to provide CSK_FlowConfig relevant features.
+
+ Types of results to provide.
+ CLASS
+ CLASS_VALID
+
+
+
+ Set source of images to process.
+
+
+ Internally used CSK_FlowConfig create function.
+
+
+
+
+ data-flow
+ Set source of images to process.
+
+
+
+
+
+
+ released
+ Provide result of classification.
+
+
+ data-flow
+ Provide result of classification.
+
+
+
+
+ released
+ Internally used CSK_FlowConfig create function.
+
+
+
+
+
+ released
+ Internally used CSK_FlowConfig register function.
+
+
+
+
+
+
+
+
+ released
+ Set source of images to process and provide classification result.
+
+
+ released
+ Internally used CSK_FlowConfig create function.
+
+
+
+
+
+ data-flow
+ Set source of images to process and provide classification result.
+
+
+
+
+
+
+
SICK AG
- 4.1.0
+ 5.0.0
low
false
false
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_1.bmp b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_1.bmp
deleted file mode 100644
index 2b969b5..0000000
Binary files a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_1.bmp and /dev/null differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_1.jpg b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_1.jpg
new file mode 100644
index 0000000..fe89be5
Binary files /dev/null and b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_1.jpg differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_2.bmp b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_2.bmp
deleted file mode 100644
index bf05f17..0000000
Binary files a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_2.bmp and /dev/null differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_2.jpg b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_2.jpg
new file mode 100644
index 0000000..a5c84b8
Binary files /dev/null and b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/NOK_2.jpg differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_1.bmp b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_1.bmp
deleted file mode 100644
index 04a5807..0000000
Binary files a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_1.bmp and /dev/null differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_1.jpg b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_1.jpg
new file mode 100644
index 0000000..84c52cb
Binary files /dev/null and b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_1.jpg differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_2.bmp b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_2.bmp
deleted file mode 100644
index 775e5d0..0000000
Binary files a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_2.bmp and /dev/null differ
diff --git a/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_2.jpg b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_2.jpg
new file mode 100644
index 0000000..841fa74
Binary files /dev/null and b/CSK_Module_MultiDeepLearning/resources/CSK_Module_MultiDeepLearningSampleData/OK_2.jpg differ
diff --git a/CSK_Module_MultiDeepLearning/scripts/CSK_Module_MultiDeepLearning.lua b/CSK_Module_MultiDeepLearning/scripts/CSK_Module_MultiDeepLearning.lua
index c9a230e..34f84af 100644
--- a/CSK_Module_MultiDeepLearning/scripts/CSK_Module_MultiDeepLearning.lua
+++ b/CSK_Module_MultiDeepLearning/scripts/CSK_Module_MultiDeepLearning.lua
@@ -51,12 +51,13 @@ local multiDeepLearning_Instances = {} -- Handle all instances
-- Check / edit this script to see/edit functions which communicate with the UI
local multiDeepLearningController = require('ImageProcessing/MultiDeepLearning/MultiDeepLearning_Controller')
-if availableAPIs.specific then
- _G.logger:info("MachineLearning API Support = true")
+if _G.availableAPIs.default and _G.availableAPIs.specific then
+ local setInstanceHandle = require('ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_FlowConfig')
table.insert(multiDeepLearning_Instances, multiDeepLearning_Model.create(1)) -- create(deepLearningInstanceNo:int)
multiDeepLearningController.setMultiDeepLearning_Instances_Handle(multiDeepLearning_Instances) -- share handle of instances
+ setInstanceHandle(multiDeepLearning_Instances)
else
- _G.logger:warning("CSK_MultiDeepLearning: Features of this module are not supported on this device. Missing APIs.")
+ _G.logger:warning("CSK_MultiDeepLearning: Relevant CROWN(s) not available on device. Module is not supported...")
end
--**************************************************************************
@@ -120,7 +121,9 @@ local function main()
----------------------------------------------------------------------------------------
--startProcessing() --> see above
- CSK_MultiDeepLearning.setInstance(1)
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ CSK_MultiDeepLearning.setInstance(1)
+ end
CSK_MultiDeepLearning.pageCalled() -- Update UI
end
Script.register("Engine.OnStarted", main)
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_FlowConfig.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_FlowConfig.lua
new file mode 100644
index 0000000..c40d137
--- /dev/null
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_FlowConfig.lua
@@ -0,0 +1,32 @@
+--*****************************************************************
+-- Here you will find all the required content to provide specific
+-- features of this module via the 'CSK FlowConfig'.
+--*****************************************************************
+
+require('ImageProcessing.MultiDeepLearning.FlowConfig.MultiDeepLearning_ImageSource')
+require('ImageProcessing.MultiDeepLearning.FlowConfig.MultiDeepLearning_OnNewResult')
+require('ImageProcessing.MultiDeepLearning.FlowConfig.MultiDeepLearning_Process')
+
+-- Reference to the multiImageFilter_Instances handle
+local multiDeepLearning_Instances
+
+--- Function to react if FlowConfig was updated
+local function handleOnClearOldFlow()
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ for i = 1, #multiDeepLearning_Instances do
+ if multiDeepLearning_Instances[i].parameters.flowConfigPriority then
+ CSK_MultiDeepLearning.clearFlowConfigRelevantConfiguration()
+ break
+ end
+ end
+ end
+end
+Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
+
+--- Function to get access to the multiDeepLearning_Instances
+---@param handle handle Handle of multiDeepLearning_Instances object
+local function setMultiDeepLearning_Instances_Handle(handle)
+ multiDeepLearning_Instances = handle
+end
+
+return setMultiDeepLearning_Instances_Handle
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_ImageSource.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_ImageSource.lua
new file mode 100644
index 0000000..28dc067
--- /dev/null
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_ImageSource.lua
@@ -0,0 +1,55 @@
+-- Block namespace
+local BLOCK_NAMESPACE = 'MultiDeepLearning_FC.ImageSource'
+local nameOfModule = 'CSK_MultiDeepLearning'
+
+--*************************************************************
+--*************************************************************
+
+-- Required to keep track of already allocated resource
+local instanceTable = {}
+
+local function setImageSource(handle, imageSource)
+
+ local instance = Container.get(handle, 'Instance')
+
+ -- Check if amount of instances is valid
+ -- if not: add multiple additional instances
+ while true do
+ local amount = CSK_MultiDeepLearning.getInstancesAmount()
+ if amount < instance then
+ CSK_MultiDeepLearning.addInstance()
+ else
+ CSK_MultiDeepLearning.setInstance(instance)
+ CSK_MultiDeepLearning.setRegisterEvent(imageSource)
+ break
+ end
+ end
+end
+Script.serveFunction(BLOCK_NAMESPACE .. '.imageSource', setImageSource)
+
+--*************************************************************
+--*************************************************************
+
+local function create(instance)
+
+ -- Check if same instance is already configured
+ if instance < 1 or nil ~= instanceTable[instance] then
+ _G.logger:warning(nameOfModule .. ': Instance invalid or already in use, please choose another one')
+ return nil
+ else
+ -- Otherwise create handle and store the restriced resource
+ local handle = Container.create()
+ instanceTable[instance] = instance
+ Container.add(handle, 'Instance', instance)
+ return handle
+ end
+end
+Script.serveFunction(BLOCK_NAMESPACE .. '.create', create)
+
+--- Function to reset instances if FlowConfig was cleared
+-- Function to clear instances
+local function handleOnClearOldFlow()
+ Script.releaseObject(instanceTable)
+ instanceTable = {}
+end
+Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_OnNewResult.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_OnNewResult.lua
new file mode 100644
index 0000000..0fe9e27
--- /dev/null
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_OnNewResult.lua
@@ -0,0 +1,80 @@
+-- Block namespace
+local BLOCK_NAMESPACE = "MultiDeepLearning_FC.OnNewResult"
+local nameOfModule = 'CSK_MultiDeepLearning'
+
+--*************************************************************
+--*************************************************************
+
+-- Required to keep track of already allocated resource
+local instanceTable = {}
+
+local function register(handle, _ , callback)
+
+ Container.remove(handle, "CB_Function")
+ Container.add(handle, "CB_Function", callback)
+
+ local instance = Container.get(handle, 'Instance')
+
+ -- Check if amount of instances is valid
+ -- if not: add multiple additional instances
+ while true do
+ local amount = CSK_MultiDeepLearning.getInstancesAmount()
+ if amount < instance then
+ CSK_MultiDeepLearning.addInstance()
+ else
+ break
+ end
+ end
+
+ local function localCallback()
+ local mode = Container.get(handle, 'Mode')
+ local cbFunction = Container.get(handle,"CB_Function")
+
+ if cbFunction ~= nil then
+
+ -- Check what mode should be used
+ if mode == 'CLASS_VALID' then
+ Script.callFunction(cbFunction, 'CSK_MultiDeepLearning.OnNewResult' .. tostring(instance))
+ else
+ Script.callFunction(cbFunction, 'CSK_MultiDeepLearning.OnNewMeasuredClass' .. tostring(instance))
+ end
+
+ else
+ _G.logger:warning(nameOfModule .. ": " .. BLOCK_NAMESPACE .. ".CB_Function missing!")
+ end
+ end
+ Script.register('CSK_FlowConfig.OnNewFlowConfig', localCallback)
+
+ return true
+end
+Script.serveFunction(BLOCK_NAMESPACE ..".register", register)
+
+--*************************************************************
+--*************************************************************
+
+local function create(instance, mode)
+
+ local fullInstanceName = tostring(instance) .. tostring(mode)
+
+ -- Check if same instance is already configured
+ if instance < 1 or nil ~= instanceTable[fullInstanceName] then
+ _G.logger:warning(nameOfModule .. 'Instance invalid or already in use, please choose another one')
+ return nil
+ else
+ -- Otherwise create handle and store the restriced resource
+ local handle = Container.create()
+ instanceTable[fullInstanceName] = fullInstanceName
+ Container.add(handle, 'Instance', instance)
+ Container.add(handle, 'Mode', mode)
+ Container.add(handle, "CB_Function", "")
+ return handle
+ end
+end
+Script.serveFunction(BLOCK_NAMESPACE .. ".create", create)
+
+--- Function to reset instances if FlowConfig was cleared
+local function handleOnClearOldFlow()
+ Script.releaseObject(instanceTable)
+ instanceTable = {}
+end
+Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
\ No newline at end of file
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_Process.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_Process.lua
new file mode 100644
index 0000000..863a742
--- /dev/null
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/FlowConfig/MultiDeepLearning_Process.lua
@@ -0,0 +1,66 @@
+-- Block namespace
+local BLOCK_NAMESPACE = 'MultiDeepLearning_FC.Process'
+local nameOfModule = 'CSK_MultiDeepLearning'
+
+--*************************************************************
+--*************************************************************
+
+-- Required to keep track of already allocated resource
+local instanceTable = {}
+
+local function process(handle, imageSource)
+
+ local instance = Container.get(handle, 'Instance')
+
+ -- Check if amount of instances is valid
+ -- if not: add multiple additional instances
+ while true do
+ local amount = CSK_MultiDeepLearning.getInstancesAmount()
+ if amount < instance then
+ CSK_MultiDeepLearning.addInstance()
+ else
+ CSK_MultiDeepLearning.setInstance(instance)
+ CSK_MultiDeepLearning.setRegisterEvent(imageSource)
+ break
+ end
+ end
+
+ local mode = Container.get(handle, 'Mode')
+ if mode == 'CLASS_VALID' then
+ return 'CSK_MultiDeepLearning.OnNewResult' .. tostring(instance)
+ else
+ return 'CSK_MultiDeepLearning.OnNewMeasuredClass' .. tostring(instance)
+ end
+
+end
+Script.serveFunction(BLOCK_NAMESPACE .. '.process', process)
+
+--*************************************************************
+--*************************************************************
+
+local function create(instance, mode)
+
+ local fullInstanceName = tostring(instance) .. tostring(mode)
+
+ -- Check if same instance is already configured
+ if instance < 1 or instanceTable[fullInstanceName] ~= nil then
+ _G.logger:warning(nameOfModule .. "Instance invalid or already in use, please choose another one")
+ return nil
+ else
+ -- Otherwise create handle and store the restriced resource
+ local handle = Container.create()
+ instanceTable[fullInstanceName] = fullInstanceName
+ Container.add(handle, 'Instance', instance)
+ Container.add(handle, 'Mode', mode)
+ Container.add(handle, "CB_Function", "")
+ return handle
+ end
+end
+Script.serveFunction(BLOCK_NAMESPACE .. '.create', create)
+
+--- Function to reset instances if FlowConfig was cleared
+local function handleOnClearOldFlow()
+ Script.releaseObject(instanceTable)
+ instanceTable = {}
+end
+Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Controller.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Controller.lua
index 6f5680a..cf04405 100644
--- a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Controller.lua
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Controller.lua
@@ -28,7 +28,6 @@ local helperFuncs = require('ImageProcessing/MultiDeepLearning/helper/funcs') --
local function emptyFunction()
end
Script.serveFunction("CSK_MultiDeepLearning.processImageNUM", emptyFunction)
-Script.serveFunction("CSK_MultiDeepLearning.processImageWithScoresNUM", emptyFunction)
Script.serveEvent("CSK_MultiDeepLearning.OnNewMeasuredClassNUM", "MultiDeepLearning_OnNewMeasuredClassNUM")
Script.serveEvent("CSK_MultiDeepLearning.OnNewMeasuredScoreNUM", "MultiDeepLearning_OnNewMeasuredScoreNUM")
@@ -41,6 +40,10 @@ Script.serveEvent("CSK_MultiDeepLearning.TestImage", "TestImage") --> Create eve
-- Real events
--------------------------------------------------
+Script.serveEvent('CSK_MultiDeepLearning.OnNewStatusModuleVersion', 'MultiDeepLearning_OnNewStatusModuleVersion')
+Script.serveEvent('CSK_MultiDeepLearning.OnNewStatusCSKStyle', 'MultiDeepLearning_OnNewStatusCSKStyle')
+Script.serveEvent('CSK_MultiDeepLearning.OnNewStatusModuleIsActive', 'MultiDeepLearning_OnNewStatusModuleIsActive')
+
Script.serveEvent("CSK_MultiDeepLearning.OnNewImageProcessingParameter", "MultiDeepLearning_OnNewImageProcessingParameter")
Script.serveEvent("CSK_MultiDeepLearning.OnNewModelList", "MultiDeepLearning_OnNewModelList")
Script.serveEvent("CSK_MultiDeepLearning.OnNewInstanceList", "MultiDeepLearning_OnNewInstanceList")
@@ -56,6 +59,8 @@ Script.serveEvent("CSK_MultiDeepLearning.OnNewMeasuredScore", "MultiDeepLearning
Script.serveEvent("CSK_MultiDeepLearning.OnNewMeasuredClass", "MultiDeepLearning_OnNewMeasuredClass")
Script.serveEvent("CSK_MultiDeepLearning.OnNewResult", "MultiDeepLearning_OnNewResult")
Script.serveEvent('CSK_MultiDeepLearning.OnNewStatusForwardImage', 'MultiDeepLearning_OnNewStatusForwardImage')
+
+Script.serveEvent('CSK_MultiDeepLearning.OnNewStatusFlowConfigPriority', 'MultiDeepLearning_OnNewStatusFlowConfigPriority')
Script.serveEvent("CSK_MultiDeepLearning.OnNewParameterName", "MultiDeepLearning_OnNewParameterName")
Script.serveEvent("CSK_MultiDeepLearning.OnPersistentDataModuleAvailable", "MultiDeepLearning_OnPersistentDataModuleAvailable")
Script.serveEvent("CSK_MultiDeepLearning.OnNewStatusLoadParameterOnReboot", "MultiDeepLearning_OnNewStatusLoadParameterOnReboot")
@@ -156,64 +161,79 @@ end
--- Function to send all relevant values to UI on resume
local function handleOnExpiredTmrMultiDeepLearning()
- updateUserLevel()
+ Script.notifyEvent('MultiDeepLearning_OnNewStatusModuleVersion', 'v' .. multiDeepLearning_Model.version)
+ Script.notifyEvent('MultiDeepLearning_OnNewStatusCSKStyle', multiDeepLearning_Model.styleForUI)
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusModuleIsActive", _G.availableAPIs.default and _G.availableAPIs.specific)
- Script.notifyEvent('MultiDeepLearning_OnNewSelectedInstance', selectedInstance)
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
- Script.notifyEvent('MultiDeepLearning_OnNewParameterName', multiDeepLearning_Instances[selectedInstance].parametersName)
- Script.notifyEvent('MultiDeepLearning_OnPersistentDataModuleAvailable', multiDeepLearning_Instances[selectedInstance].persistentModuleAvailable)
- Script.notifyEvent('MultiDeepLearning_OnNewStatusLoadParameterOnReboot', multiDeepLearning_Instances[selectedInstance].parameterLoadOnReboot)
+ updateUserLevel()
- Script.notifyEvent("MultiDeepLearning_OnNewStatusRegisteredEvent", multiDeepLearning_Instances[selectedInstance].parameters.registeredEvent)
- Script.notifyEvent("MultiDeepLearning_OnNewModelList", multiDeepLearning_Instances[selectedInstance].modelList)
+ Script.notifyEvent('MultiDeepLearning_OnNewSelectedInstance', selectedInstance)
- Script.notifyEvent("MultiDeepLearning_OnNewInstanceList", helperFuncs.createStringListBySize(#multiDeepLearning_Instances))
- Script.notifyEvent("MultiDeepLearning_OnNewSelectedModel", multiDeepLearning_Instances[selectedInstance].parameters.modelName)
- Script.notifyEvent("MultiDeepLearning_OnNewModelFilename", multiDeepLearning_Instances[selectedInstance].parameters.modelPath .. multiDeepLearning_Instances[selectedInstance].parameters.modelName)
- if multiDeepLearning_Instances[selectedInstance].currentModel then
- Script.notifyEvent('MultiDeepLearning_OnNewModelLabels', table.concat(MachineLearning.DeepNeuralNetwork.Model.getOutputNodeLabels(multiDeepLearning_Instances[selectedInstance].currentModel), ','))
- else
- Script.notifyEvent('MultiDeepLearning_OnNewModelLabels', '-')
- end
- Script.notifyEvent("MultiDeepLearning_OnNewMeasuredClass", '-')
- Script.notifyEvent("MultiDeepLearning_OnNewMeasuredScore", '-')
- Script.notifyEvent("MultiDeepLearning_OnNewValidScore", multiDeepLearning_Instances[selectedInstance].parameters.validScore)
- Script.notifyEvent("MultiDeepLearning_OnNewResult", false)
- Script.notifyEvent("MultiDeepLearning_OnNewStatusShowImage", multiDeepLearning_Instances[selectedInstance].parameters.showImage)
- Script.notifyEvent("MultiDeepLearning_OnNewViewerID", 'multiDeepLearningViewer' .. tostring(selectedInstance))
- Script.notifyEvent("MultiDeepLearning_OnNewStatusForwardImage", multiDeepLearning_Instances[selectedInstance].parameters.forwardResultWithImage)
- Script.notifyEvent("MultiDeepLearning_OnNewStatusProcessWithScores", multiDeepLearning_Instances[selectedInstance].parameters.processWithScores)
- Script.notifyEvent("MultiDeepLearning_OnNewStatusSortResultByIndex", multiDeepLearning_Instances[selectedInstance].parameters.sortResultByIndex)
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusFlowConfigPriority", multiDeepLearning_Instances[selectedInstance].parameters.flowConfigPriority)
+ Script.notifyEvent('MultiDeepLearning_OnNewParameterName', multiDeepLearning_Instances[selectedInstance].parametersName)
+ Script.notifyEvent('MultiDeepLearning_OnPersistentDataModuleAvailable', multiDeepLearning_Instances[selectedInstance].persistentModuleAvailable)
+ Script.notifyEvent('MultiDeepLearning_OnNewStatusLoadParameterOnReboot', multiDeepLearning_Instances[selectedInstance].parameterLoadOnReboot)
- Script.notifyEvent("MultiDeepLearning_OnNewValidScore", multiDeepLearning_Instances[selectedInstance].parameters.validScore)
- Script.notifyEvent("MultiDeepLearning_OnNewUploadPath", multiDeepLearning_Instances[selectedInstance].parameters.modelPath)
- Script.notifyEvent("MultiDeepLearning_OnNewNumberOfInstances", tostring(#multiDeepLearning_Instances))
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusRegisteredEvent", multiDeepLearning_Instances[selectedInstance].parameters.registeredEvent)
+ Script.notifyEvent("MultiDeepLearning_OnNewModelList", multiDeepLearning_Instances[selectedInstance].modelList)
+ Script.notifyEvent("MultiDeepLearning_OnNewInstanceList", helperFuncs.createStringListBySize(#multiDeepLearning_Instances))
+ Script.notifyEvent("MultiDeepLearning_OnNewSelectedModel", multiDeepLearning_Instances[selectedInstance].parameters.modelName)
+ Script.notifyEvent("MultiDeepLearning_OnNewModelFilename", multiDeepLearning_Instances[selectedInstance].parameters.modelPath .. multiDeepLearning_Instances[selectedInstance].parameters.modelName)
+ if multiDeepLearning_Instances[selectedInstance].currentModel then
+ Script.notifyEvent('MultiDeepLearning_OnNewModelLabels', table.concat(MachineLearning.DeepNeuralNetwork.Model.getOutputNodeLabels(multiDeepLearning_Instances[selectedInstance].currentModel), ','))
+ else
+ Script.notifyEvent('MultiDeepLearning_OnNewModelLabels', '-')
+ end
+ Script.notifyEvent("MultiDeepLearning_OnNewMeasuredClass", '-')
+ Script.notifyEvent("MultiDeepLearning_OnNewMeasuredScore", '-')
+ Script.notifyEvent("MultiDeepLearning_OnNewValidScore", multiDeepLearning_Instances[selectedInstance].parameters.validScore)
+ Script.notifyEvent("MultiDeepLearning_OnNewResult", false)
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusShowImage", multiDeepLearning_Instances[selectedInstance].parameters.showImage)
+ Script.notifyEvent("MultiDeepLearning_OnNewViewerID", 'multiDeepLearningViewer' .. tostring(selectedInstance))
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusForwardImage", multiDeepLearning_Instances[selectedInstance].parameters.forwardResultWithImage)
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusProcessWithScores", multiDeepLearning_Instances[selectedInstance].parameters.processWithScores)
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusSortResultByIndex", multiDeepLearning_Instances[selectedInstance].parameters.sortResultByIndex)
+
+ Script.notifyEvent("MultiDeepLearning_OnNewValidScore", multiDeepLearning_Instances[selectedInstance].parameters.validScore)
+ Script.notifyEvent("MultiDeepLearning_OnNewUploadPath", multiDeepLearning_Instances[selectedInstance].parameters.modelPath)
+ Script.notifyEvent("MultiDeepLearning_OnNewNumberOfInstances", tostring(#multiDeepLearning_Instances))
+ end
end
Timer.register(tmrMultiDeepLearning, "OnExpired", handleOnExpiredTmrMultiDeepLearning)
-- ********************* UI Setting / Submit Functions Start ********************
local function pageCalled()
- if _G.availableAPIs.specific then
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
updateUserLevel() -- try to hide user specific content asap
- tmrMultiDeepLearning:start()
end
+ tmrMultiDeepLearning:start()
return ''
end
Script.serveFunction("CSK_MultiDeepLearning.pageCalled", pageCalled)
local function setInstance(dnnInstance)
- selectedInstance = dnnInstance
- _G.logger:fine(nameOfModule .. ": New selected instance = " .. tostring(selectedInstance))
- multiDeepLearning_Instances[selectedInstance].activeInUI = true
- Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'activeInUI', true)
- pageCalled()
+ if #multiDeepLearning_Instances >= dnnInstance then
+ selectedInstance = dnnInstance
+ _G.logger:fine(nameOfModule .. ": New selected instance = " .. tostring(selectedInstance))
+ multiDeepLearning_Instances[selectedInstance].activeInUI = true
+ Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'activeInUI', true)
+ pageCalled()
+ else
+ _G.logger:warning(nameOfModule .. ": Selected instance does not exist.")
+ end
end
Script.serveFunction("CSK_MultiDeepLearning.setInstance", setInstance)
local function getInstancesAmount ()
- return #multiDeepLearning_Instances
+ if multiDeepLearning_Instances then
+ return #multiDeepLearning_Instances
+ else
+ return 0
+ end
end
Script.serveFunction("CSK_MultiDeepLearning.getInstancesAmount", getInstancesAmount)
@@ -227,7 +247,7 @@ end
Script.serveFunction('CSK_MultiDeepLearning.addInstance', addInstance)
local function resetInstances()
- _G.logger:fine(nameOfModule .. ": Reset instances.")
+ _G.logger:info(nameOfModule .. ": Reset instances.")
setInstance(1)
local totalAmount = #multiDeepLearning_Instances
while totalAmount > 1 do
@@ -262,7 +282,7 @@ Script.serveFunction("CSK_MultiDeepLearning.setModelByName", setModelByName)
local function uploadFinished(status)
if status == true then
- _G.logger:fine(nameOfModule .. ': New model was uploaded to the device.')
+ _G.logger:info(nameOfModule .. ': New model was uploaded to the device.')
local fileList = File.list(multiDeepLearning_Instances[selectedInstance].parameters.modelPath)
if fileList ~= nil and #fileList ~= 0 then
multiDeepLearning_Instances[selectedInstance].modelList = fileList
@@ -341,24 +361,47 @@ Script.serveFunction('CSK_MultiDeepLearning.setSortResultByIndex', setSortResult
local function updateProcessingParameters()
Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'showImage', multiDeepLearning_Instances[selectedInstance].parameters.showImage)
Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'validScore', multiDeepLearning_Instances[selectedInstance].parameters.validScore)
- Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'fullModelPath', multiDeepLearning_Instances[selectedInstance].parameters.modelPath .. multiDeepLearning_Instances[selectedInstance].parameters.modelName)
+ setModelByName(multiDeepLearning_Instances[selectedInstance].parameters.modelName)
Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'registeredEvent', multiDeepLearning_Instances[selectedInstance].parameters.registeredEvent)
Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'forwardResultWithImage', multiDeepLearning_Instances[selectedInstance].parameters.forwardResultWithImage)
setProcessWithScores(multiDeepLearning_Instances[selectedInstance].parameters.processWithScores)
Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', selectedInstance, 'sortResultByIndex', multiDeepLearning_Instances[selectedInstance].parameters.sortResultByIndex)
end
+local function getStatusModuleActive()
+ return _G.availableAPIs.default and _G.availableAPIs.specific
+end
+Script.serveFunction('CSK_MultiDeepLearning.getStatusModuleActive', getStatusModuleActive)
+
+local function clearFlowConfigRelevantConfiguration()
+ for i = 1, #multiDeepLearning_Instances do
+ multiDeepLearning_Instances[i].parameters.registeredEvent = ''
+ Script.notifyEvent('MultiDeepLearning_OnNewImageProcessingParameter', i, 'deregisterFromEvent', '')
+ Script.notifyEvent('MultiDeepLearning_OnNewStatusRegisteredEvent', '')
+ end
+end
+Script.serveFunction('CSK_MultiDeepLearning.clearFlowConfigRelevantConfiguration', clearFlowConfigRelevantConfiguration)
+
+local function getParameters(instanceNo)
+ if instanceNo <= #multiDeepLearning_Instances then
+ return helperFuncs.json.encode(multiDeepLearning_Instances[instanceNo].parameters)
+ else
+ return ''
+ end
+end
+Script.serveFunction('CSK_MultiDeepLearning.getParameters', getParameters)
+
-- *****************************************************************
-- Following function can be adapted for CSK_PersistentData module usage
-- *****************************************************************
local function setParameterName(name)
- _G.logger:info(nameOfModule .. ": Set parameter name = " .. tostring(name))
+ _G.logger:fine(nameOfModule .. ": Set parameter name = " .. tostring(name))
multiDeepLearning_Instances[selectedInstance].parametersName = name
end
Script.serveFunction("CSK_MultiDeepLearning.setParameterName", setParameterName)
-local function sendParameters()
+local function sendParameters(noDataSave)
if multiDeepLearning_Instances[selectedInstance].persistentModuleAvailable then
CSK_PersistentData.addParameter(helperFuncs.convertTable2Container(multiDeepLearning_Instances[selectedInstance].parameters), multiDeepLearning_Instances[selectedInstance].parametersName)
@@ -369,8 +412,10 @@ local function sendParameters()
CSK_PersistentData.setModuleParameterName(nameOfModule, multiDeepLearning_Instances[selectedInstance].parametersName, multiDeepLearning_Instances[selectedInstance].parameterLoadOnReboot, tostring(selectedInstance))
end
- _G.logger:info(nameOfModule .. ": Send DeepLearning parameters with name '" .. multiDeepLearning_Instances[selectedInstance].parametersName .. "' to CSK_PersistentData module.")
- CSK_PersistentData.saveData()
+ _G.logger:fine(nameOfModule .. ": Send DeepLearning parameters with name '" .. multiDeepLearning_Instances[selectedInstance].parametersName .. "' to CSK_PersistentData module.")
+ if not noDataSave then
+ CSK_PersistentData.saveData()
+ end
else
_G.logger:warning(nameOfModule .. ": CSK_PersistentData module not available.")
end
@@ -384,70 +429,97 @@ local function loadParameters()
_G.logger:info(nameOfModule .. ": Loaded parameters for deepLearningInstance " .. tostring(selectedInstance) .. " from CSK_PersistentData module.")
multiDeepLearning_Instances[selectedInstance].parameters = helperFuncs.convertContainer2Table(data)
updateProcessingParameters()
+ pageCalled()
+ return true
else
_G.logger:warning(nameOfModule .. ": Loading parameters from CSK_PersistentData module did not work.")
+ pageCalled()
+ return false
end
else
_G.logger:warning(nameOfModule .. ": CSK_PersistentData module not available.")
+ pageCalled()
+ return false
end
- pageCalled()
end
Script.serveFunction("CSK_MultiDeepLearning.loadParameters", loadParameters)
local function setLoadOnReboot(status)
multiDeepLearning_Instances[selectedInstance].parameterLoadOnReboot = status
- _G.logger:info(nameOfModule .. ": Set new status to load setting on reboot: " .. tostring(status))
+ _G.logger:fine(nameOfModule .. ": Set new status to load setting on reboot: " .. tostring(status))
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusLoadParameterOnReboot", status)
end
Script.serveFunction("CSK_MultiDeepLearning.setLoadOnReboot", setLoadOnReboot)
+local function setFlowConfigPriority(status)
+ multiDeepLearning_Instances[selectedInstance].parameters.flowConfigPriority = status
+ _G.logger:fine(nameOfModule .. ": Set new status of FlowConfig priority: " .. tostring(status))
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusFlowConfigPriority", multiDeepLearning_Instances[selectedInstance].parameters.flowConfigPriority)
+end
+Script.serveFunction('CSK_MultiDeepLearning.setFlowConfigPriority', setFlowConfigPriority)
+
--- Function to react on initial load of persistent parameters
local function handleOnInitialDataLoaded()
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ _G.logger:fine(nameOfModule .. ': Try to initially load parameter from CSK_PersistentData module.')
+ -- Check if CSK_PersistentData version is > 1.x.x
+ if string.sub(CSK_PersistentData.getVersion(), 1, 1) == '1' then
- _G.logger:info(nameOfModule .. ': Try to initially load parameter from CSK_PersistentData module.')
- -- Check if CSK_PersistentData version is > 1.x.x
- if string.sub(CSK_PersistentData.getVersion(), 1, 1) == '1' then
+ _G.logger:warning(nameOfModule .. ': CSK_PersistentData module is too old and will not work. Please update CSK_PersistentData module.')
- _G.logger:warning(nameOfModule .. ': CSK_PersistentData module is too old and will not work. Please update CSK_PersistentData module.')
-
- for j = 1, #multiDeepLearning_Instances do
- multiDeepLearning_Instances[j].persistentModuleAvailable = false
- end
- else
- -- Check if CSK_PersistentData version is >= 3.0.0
- if tonumber(string.sub(CSK_PersistentData.getVersion(), 1, 1)) >= 3 then
- local parameterName, loadOnReboot, totalInstances = CSK_PersistentData.getModuleParameterName(nameOfModule, '1')
- -- Check for amount if instances to create
- if totalInstances then
- local c = 2
- while c <= totalInstances do
- addInstance()
- c = c+1
+ for j = 1, #multiDeepLearning_Instances do
+ multiDeepLearning_Instances[j].persistentModuleAvailable = false
+ end
+ else
+ -- Check if CSK_PersistentData version is >= 3.0.0
+ if tonumber(string.sub(CSK_PersistentData.getVersion(), 1, 1)) >= 3 then
+ local parameterName, loadOnReboot, totalInstances = CSK_PersistentData.getModuleParameterName(nameOfModule, '1')
+ -- Check for amount if instances to create
+ if totalInstances then
+ local c = 2
+ while c <= totalInstances do
+ addInstance()
+ c = c+1
+ end
end
end
- end
- for i = 1, #multiDeepLearning_Instances do
- local parameterName, loadOnReboot = CSK_PersistentData.getModuleParameterName(nameOfModule, tostring(i))
-
- if parameterName then
- multiDeepLearning_Instances[i].parametersName = parameterName
- multiDeepLearning_Instances[i].parameterLoadOnReboot = loadOnReboot
+ if not multiDeepLearning_Instances then
+ return
end
- if multiDeepLearning_Instances[i].parameterLoadOnReboot then
- setInstance(i)
- loadParameters()
- if multiDeepLearning_Instances[i].parameters.modelName ~= '-' then
- _G.logger:info(nameOfModule .. ": Instantly setting a network for deepLearning object " .. tostring(i) .. " = " .. multiDeepLearning_Instances[i].parameters.modelName)
- setModelByName(multiDeepLearning_Instances[i].parameters.modelName)
+ for i = 1, #multiDeepLearning_Instances do
+ local parameterName, loadOnReboot = CSK_PersistentData.getModuleParameterName(nameOfModule, tostring(i))
+
+ if parameterName then
+ multiDeepLearning_Instances[i].parametersName = parameterName
+ multiDeepLearning_Instances[i].parameterLoadOnReboot = loadOnReboot
+ end
+
+ if multiDeepLearning_Instances[i].parameterLoadOnReboot then
+ setInstance(i)
+ loadParameters()
+ if multiDeepLearning_Instances[i].parameters.modelName ~= '-' then
+ _G.logger:fine(nameOfModule .. ": Instantly setting a network for deepLearning object " .. tostring(i) .. " = " .. multiDeepLearning_Instances[i].parameters.modelName)
+ setModelByName(multiDeepLearning_Instances[i].parameters.modelName)
+ end
end
end
+ Script.notifyEvent('MultiDeepLearning_OnDataLoadedOnReboot')
end
- Script.notifyEvent('MultiDeepLearning_OnDataLoadedOnReboot')
end
end
Script.register("CSK_PersistentData.OnInitialDataLoaded", handleOnInitialDataLoaded)
+local function resetModule()
+ if _G.availableAPIs.default and _G.availableAPIs.specific then
+ clearFlowConfigRelevantConfiguration()
+ pageCalled()
+ end
+end
+Script.serveFunction('CSK_MultiDeepLearning.resetModule', resetModule)
+Script.register("CSK_PersistentData.OnResetAllModules", resetModule)
+
-- *************************************************
-- END of functions for CSK_PersistentData module usage
-- *************************************************
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Model.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Model.lua
index ab56964..bd22049 100644
--- a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Model.lua
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/MultiDeepLearning_Model.lua
@@ -13,12 +13,22 @@ local nameOfModule = 'CSK_MultiDeepLearning'
local multiDeepLearning = {}
multiDeepLearning.__index = multiDeepLearning
+multiDeepLearning.styleForUI = 'None' -- Optional parameter to set UI style
+multiDeepLearning.version = Engine.getCurrentAppVersion() -- Version of module
+
--**************************************************************************
--********************** End Global Scope **********************************
--**************************************************************************
--**********************Start Function Scope *******************************
--**************************************************************************
+--- Function to react on UI style change
+local function handleOnStyleChanged(theme)
+ multiDeepLearning.styleForUI = theme
+ Script.notifyEvent("MultiDeepLearning_OnNewStatusCSKStyle", multiDeepLearning.styleForUI)
+end
+Script.register('CSK_PersistentData.OnNewStatusCSKStyle', handleOnStyleChanged)
+
-- Function to create new instance
---@param deepLearningInstanceNo int Number of instance
---@return table[] self Instance of multiDeepLearning
@@ -50,8 +60,8 @@ function multiDeepLearning.create(deepLearningInstanceNo)
-- Parameters to be saved permanently
self.parameters = {}
- --self.parameters.eventName = '-' -- Event to register to get images to process
- self.parameters.modelPath = '/public/models/' -- Path to search for DNN models
+ self.parameters.flowConfigPriority = CSK_FlowConfig ~= nil or false -- Status if FlowConfig should have priority for FlowConfig relevant configurations
+ self.parameters.modelPath = '/public/CSK_DeepLearning_Models/' -- Path to search for DNN models
self.parameters.modelName = '-' -- Name of selected model
self.parameters.validScore = 80 -- Score to decide if image is from a class
self.parameters.showImage = false -- Show image on UI
@@ -80,14 +90,20 @@ function multiDeepLearning.create(deepLearningInstanceNo)
_G.logger:fine(nameOfModule .. ': Found available models on device.')
self.modelList = fileList
else
- _G.logger:fine(nameOfModule .. ': No models available on device.')
+ _G.logger:fine(nameOfModule .. ': Add Cornflakes sample to folder.')
+ File.copy('/resources/CSK_Module_MultiDeepLearningSampleData/Cornflakes.json', self.parameters.modelPath .. '/Cornflakes.json')
+ fileList = File.list(self.parameters.modelPath)
+ self.modelList = fileList
end
else
local suc = File.mkdir(self.parameters.modelPath)
if suc then
- _G.logger:fine(nameOfModule .. ': Created path "' .. self.parameters.modelPath .. '" on the device to store DNN models.')
+ File.copy('/resources/CSK_Module_MultiDeepLearningSampleData/Cornflakes.json', self.parameters.modelPath .. '/Cornflakes.json')
+ _G.logger:fine(nameOfModule .. ': Created path "' .. self.parameters.modelPath .. '" on the device to store DNN models and added Cornflakes sample.')
+ fileList = File.list(self.parameters.modelPath)
+ self.modelList = fileList
else
- _G.logger:fine(nameOfModule .. ': Creation of path "' .. self.parameters.modelPath .. '" on the device to store DNN models was not possible.')
+ _G.logger:info(nameOfModule .. ': Creation of path "' .. self.parameters.modelPath .. '" on the device to store DNN models was not possible.')
end
end
diff --git a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/helper/checkAPIs.lua b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/helper/checkAPIs.lua
index d683815..83c02eb 100644
--- a/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/helper/checkAPIs.lua
+++ b/CSK_Module_MultiDeepLearning/scripts/ImageProcessing/MultiDeepLearning/helper/checkAPIs.lua
@@ -5,6 +5,7 @@
local availableAPIs = {}
+-- Function to load all default APIs
local function loadAPIs()
CSK_MultiDeepLearning = require 'API.CSK_MultiDeepLearning'
@@ -17,7 +18,6 @@ local function loadAPIs()
Log.SharedLogger = require 'API.Log.SharedLogger'
Object = require 'API.Object'
Timer = require 'API.Timer'
- View = require 'API.View'
-- Check if related CSK modules are available to be used
local appList = Engine.listApps()
@@ -26,12 +26,16 @@ local function loadAPIs()
CSK_PersistentData = require 'API.CSK_PersistentData'
elseif appList[i] == 'CSK_Module_UserManagement' then
CSK_UserManagement = require 'API.CSK_UserManagement'
+ elseif appList[i] == 'CSK_Module_FlowConfig' then
+ CSK_FlowConfig = require 'API.CSK_FlowConfig'
end
end
end
+-- Function to load specific APIs
local function loadSpecificAPIs()
-- If you want to check for specific APIs/functions supported on the device the module is running, place relevant APIs here
+ View = require 'API.View'
MachineLearning = {}
MachineLearning.DeepNeuralNetwork = require 'API.MachineLearning.DeepNeuralNetwork'
MachineLearning.DeepNeuralNetwork.Model = require 'API.MachineLearning.DeepNeuralNetwork.Model'
diff --git a/CSK_Module_MultiDeepLearning/scripts/MultiDeepLearning_Processing.lua b/CSK_Module_MultiDeepLearning/scripts/MultiDeepLearning_Processing.lua
index 5427140..94a02c7 100644
--- a/CSK_Module_MultiDeepLearning/scripts/MultiDeepLearning_Processing.lua
+++ b/CSK_Module_MultiDeepLearning/scripts/MultiDeepLearning_Processing.lua
@@ -50,7 +50,7 @@ end
--- Function to process incoming images with DNN
local function handleOnNewImageProcessing(image)
-
+
_G.logger:fine(nameOfModule .. ": Check DeepLearning image on instance No." .. deepLearningInstanceNumberString)
if imageProcessingParams.showImage and imageProcessingParams.activeInUI then
viewer:addImage(image)
@@ -139,12 +139,19 @@ local function handleOnNewImageProcessing(image)
if imageProcessingParams.activeInUI then
Script.notifyEvent('MultiDeepLearning_OnNewValueToForward' .. deepLearningInstanceNumberString, 'MultiDeepLearning_OnNewResult', false)
end
- _G.logger:info(nameOfModule .. ": No results available")
+ _G.logger:fine(nameOfModule .. ": No results available")
return false, nil, nil
end
end
Script.serveFunction("CSK_MultiDeepLearning.processImage"..deepLearningInstanceNumberString, handleOnNewImageProcessing, 'object:1:Image', 'bool:?,float:[?*],string:[?*]')
+--- Function only used to forward the content from events to the served function.
+--- This is only needed, as deregistering from the event would internally release the served function and would make it uncallable from external.
+---@param image Image Image to process
+local function tempHandleOnNewImageProcessing(image)
+ handleOnNewImageProcessing(image)
+end
+
--- Function to handle updates of processing parameters from Controller
---@param deepLearningNo int Number of instance to update
---@param parameter string Parameter to update
@@ -157,18 +164,28 @@ local function handleOnNewImageProcessingParameter(deepLearningNo, parameter, va
if parameter == 'registeredEvent' then
_G.logger:fine(nameOfModule .. ": Register DNN instance " .. deepLearningInstanceNumberString .. " on event " .. value)
if imageProcessingParams.registeredEvent ~= '' then
- Script.deregister(imageProcessingParams.registeredEvent, handleOnNewImageProcessing)
+ Script.deregister(imageProcessingParams.registeredEvent, tempHandleOnNewImageProcessing)
end
imageProcessingParams.registeredEvent = value
- Script.register(value, handleOnNewImageProcessing)
+ Script.register(value, tempHandleOnNewImageProcessing)
+
+ elseif parameter == 'deregisterFromEvent' then
+ _G.logger:fine(nameOfModule .. ": Deregister instance " .. deepLearningInstanceNumberString .. " from event.")
+ Script.deregister(imageProcessingParams.registeredEvent, tempHandleOnNewImageProcessing)
+ imageProcessingParams.registeredEvent = ''
elseif parameter == 'fullModelPath' then
-- Setting new model for DNN
imageProcessingParams.fullModelPath = value
- local model = Object.load(imageProcessingParams.fullModelPath)
- local suc = dnn:setModel(model)
- _G.logger:fine(nameOfModule .. ": Success of setting new model = " .. tostring(suc))
+ local checkFile = File.exists(imageProcessingParams.fullModelPath)
+ if checkFile then
+ local model = Object.load(imageProcessingParams.fullModelPath)
+ local suc = dnn:setModel(model)
+ _G.logger:fine(nameOfModule .. ": Success of setting new model = " .. tostring(suc))
+ else
+ _G.logger:info(nameOfModule .. ": No model to load.")
+ end
else
imageProcessingParams[parameter] = value
diff --git a/README.md b/README.md
index c739435..7a97e77 100644
--- a/README.md
+++ b/README.md
@@ -15,12 +15,14 @@ For further information check out the [documentation](https://raw.githack.com/SI
## Information
-Tested on
+Tested on
-|Device|Firmware|Module version
+|Device|Firmware|Module version|
|--|--|--|
+|SICK AppEngine|V1.7.0|V5.0.0|
|SICK AppEngine|V1.5.0|V4.1.0|
-|SIM 1012|V2.2.0|V4.1.0|
+|SIM1012|V2.4.2|V5.0.0|
+|SIM1012|V2.2.0|V4.1.0|
This module is part of the SICK AppSpace Coding Starter Kit developing approach.
It is programmed in an object oriented way. Some of these modules use kind of "classes" in Lua to make it possible to reuse code / classes in other projects.
diff --git a/docu/CSK_Module_MultiDeepLearning.html b/docu/CSK_Module_MultiDeepLearning.html
index 41293a3..7d37068 100644
--- a/docu/CSK_Module_MultiDeepLearning.html
+++ b/docu/CSK_Module_MultiDeepLearning.html
@@ -6,7 +6,7 @@
-