From 7bdad82abf98f7e5568e9c424e108d2b97783698 Mon Sep 17 00:00:00 2001 From: leondavi Date: Fri, 10 Nov 2023 19:07:18 +0200 Subject: [PATCH] [NERLPLANNER] Add CNN support --- src_py/nerlPlanner/WinWorkerDialog.py | 12 ++++++++---- src_py/nerlPlanner/WinWorkerDialogDefnitions.py | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src_py/nerlPlanner/WinWorkerDialog.py b/src_py/nerlPlanner/WinWorkerDialog.py index 2aed7c54..b80cc864 100644 --- a/src_py/nerlPlanner/WinWorkerDialog.py +++ b/src_py/nerlPlanner/WinWorkerDialog.py @@ -32,13 +32,13 @@ def WinWorkerDialog(): [sg.Text("*.json file name"),sg.InputText(key=KEY_JSON_FILE_NAME, enable_events=True),sg.Button("Export",key=KEY_BUTTON_EXPORT_WORKER), sg.Checkbox('with documentation', default=True, key=KEY_CHECKBOX_WORKER_WITH_DOCUMENTATION, enable_events=True)]] WorkerFileFrame = sg.Frame("File",WorkerFileLayout) - WorkerDefinitionsLayout = [[sg.Text("Model Type: "), sg.Combo(list(ModelTypeMapping.keys()),enable_events=True, key=KEY_MODEL_TYPE_LIST_BOX), sg.Button("LSTM Opts",disabled=True), sg.Button("CNN Opts", disabled=True)], + WorkerDefinitionsLayout = [[sg.Text("Model Type: "), sg.Combo(list(ModelTypeMapping.keys()),enable_events=True, key=KEY_MODEL_TYPE_LIST_BOX), sg.Button("LSTM Opts",disabled=True), sg.Button("CNN Opts", enable_events=True, key=KEY_LAYER_CNN_OPT_HELP_BUTTON )], [sg.Text("Layers Sizes: Comma separated list, # of neurons in a layer, E.g, 100,80,40,5,1")], - [sg.InputText(key=KEY_LAYER_SIZES_INPUT,enable_events=True), sg.Text("(0)",key=KEY_NUM_OF_LAYERS_SIZES)], + [sg.InputText(key=KEY_LAYER_SIZES_INPUT,enable_events=True, expand_x=True), sg.Text("(0)",key=KEY_NUM_OF_LAYERS_SIZES)], [sg.Text("List of layers types:"), sg.Combo(list(LayerTypeMap.keys()),key=KEY_LAYER_TYPE_SELECTION), sg.Button("Add",key=KEY_LAYER_TYPE_SELECTION_ADD), sg.Button("Help",key=KEY_LAYER_TYPE_HELP),sg.Button("Clear",key=KEY_LAYER_TYPE_SELECTION_CLEAR)], - [sg.InputText(key=KEY_LAYER_TYPE_CODES_INPUT,enable_events=True), sg.Text("(0)",key=KEY_NUM_OF_LAYERS_TYPES,enable_events=True)], + [sg.InputText(key=KEY_LAYER_TYPE_CODES_INPUT,enable_events=True, expand_x=True), sg.Text("(0)",key=KEY_NUM_OF_LAYERS_TYPES,enable_events=True)], [sg.Text("Layers Functionality-Codes"),sg.Button("Select Layer Method", enable_events=True, key=KEY_LAYER_METHODS_BUTTON_SELECT), sg.Button("Help",key="-ACTIVATION-LAYER-HELP-"), sg.Button("Clear",key=KEY_LAYER_FUNCTIONS_SELECTION_CLEAR)], - [sg.InputText(key=KEY_LAYER_FUNCTIONS_CODES_INPUT,enable_events=True), sg.Text("(0)",key=KEY_LAYERS_FUNCTIONS_CODES,enable_events=True), sg.Text("",enable_events=True, key=KEY_LAYER_METHODS_TEXT_SELECTION)]] + [sg.InputText(key=KEY_LAYER_FUNCTIONS_CODES_INPUT,enable_events=True, expand_x=True), sg.Text("(0)",key=KEY_LAYERS_FUNCTIONS_CODES,enable_events=True)]] WorkerDefinitionsFrame = sg.Frame("Model Definitions",layout=WorkerDefinitionsLayout, expand_x=True) OptimizerDefinitionsLayout = [[sg.Text("Learning Rate: "), sg.InputText(key=KEY_LEARNING_RATE_INPUT, size=(15), enable_events=True)], @@ -99,6 +99,10 @@ def ui_update_all_values(WorkerWindow): ModelTypeStr = values[event] ModelType = ModelTypeMapping[ModelTypeStr] + if event == KEY_LAYER_CNN_OPT_HELP_BUTTON: + sg.popup_ok(f"{LAYER_CNN_OPTS_HELP_POPUP_STR}", keep_on_top=True, title="CNN Options Help") + + # Layers Sizes List if event == KEY_LAYER_SIZES_INPUT: LayersSizesList = values[event] diff --git a/src_py/nerlPlanner/WinWorkerDialogDefnitions.py b/src_py/nerlPlanner/WinWorkerDialogDefnitions.py index b45bc804..3f81c2ee 100644 --- a/src_py/nerlPlanner/WinWorkerDialogDefnitions.py +++ b/src_py/nerlPlanner/WinWorkerDialogDefnitions.py @@ -7,13 +7,13 @@ KEY_NUM_OF_LAYERS_SIZES = '-NUM-OF-LAYERS-SIZES-' KEY_LAYER_TYPE_SELECTION = '-LAYER-TYPE-SELECTION-' KEY_LAYER_TYPE_SELECTION_ADD = '-LAYER-TYPE-SELECTION-ADD-' +KEY_LAYER_CNN_OPT_HELP_BUTTON = '-KEY-LAYER-CNN-OPT-HELP-BUTTON-' KEY_LAYER_TYPE_HELP = '-LAYER-TYPE-HELP-' KEY_LAYER_TYPE_SELECTION_CLEAR = '-LAYER-TYPE-SELECTION-CLEAR-' KEY_LAYER_TYPE_CODES_INPUT = '-LAYER-TYPE-CODES-INPUT-' KEY_NUM_OF_LAYERS_TYPES = '-NUM-OF-LAYERS-TYPES-' KEY_LAYER_METHODS_BUTTON_SELECT = '-LAYER-METHODS-BUTTON-SELECT-' -KEY_LAYER_METHODS_TEXT_SELECTION = '-LAYER-METHODS-TEXT-SELECTION-' KEY_ACTIVATION_LAYER_SELECTION = '-ACTIVATION-LAYER-SELECTION-' KEY_ACTIVATION_LAYER_SELECTION_ADD = '-ACTIVATION-LAYER-SELECTION-ADD-' @@ -45,4 +45,6 @@ KEY_LAYER_METHOD_SELECTION_DIALOG_LISTBOX_SCALER = '-LAYER-METHOD-SELECTION-DIALOG-LISTBOX-SCALER-' KEY_LAYER_METHOD_SELECTION_DIALOG_LISTBOX_PROBABILISTIC = '-LAYER-METHOD-SELECTION-DIALOG-LISTBOX-PROBABILISTIC-' KEY_LAYER_METHOD_SELECTION_TEXT = '-LAYER-METHOD-SELECTION-TEXT-' -KEY_LAYER_METHOD_SELECTION_BUTTON = '-LAYER-METHOD-SELECTION-BUTTON-' \ No newline at end of file +KEY_LAYER_METHOD_SELECTION_BUTTON = '-LAYER-METHOD-SELECTION-BUTTON-' + +LAYER_CNN_OPTS_HELP_POPUP_STR = 'CNN Layer definition: xks\n\nShould be defined only with CNN layer type code\nW - Width\nH - Height\nK - Kernel size x\nS - Stride\n\nExample:\n128x128k3s2 represents a CNN layer\ninput size is 128x128\nkernel size 3x3 and stride of 2' \ No newline at end of file