From b7db90fc84a314bb691bae4e0fab88b02af8b0db Mon Sep 17 00:00:00 2001 From: mcDandy Date: Fri, 28 Aug 2026 14:00:50 +0200 Subject: [PATCH] add workflow --- workflow/basics.json | 650 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 650 insertions(+) create mode 100644 workflow/basics.json diff --git a/workflow/basics.json b/workflow/basics.json new file mode 100644 index 0000000..7003b4e --- /dev/null +++ b/workflow/basics.json @@ -0,0 +1,650 @@ +{ + "id": "87ca90f8-993b-412e-90d2-f0941ffe631c", + "revision": 0, + "last_node_id": 14, + "last_link_id": 15, + "nodes": [ + { + "id": 1, + "type": "LoadImage", + "pos": [ + -566.236395023825, + -181.17811585678794 + ], + "size": [ + 282.796875, + 326 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 1 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "example.png", + "image" + ], + "widgets_values_named": { + "image": "example.png", + "upload": "image" + } + }, + { + "id": 2, + "type": "mrmth_ag_ImageMathNode", + "pos": [ + -46.932410999359035, + -557.8859354338251 + ], + "size": [ + 275.78125, + 286 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "label": "V0", + "name": "V.V0", + "type": "IMAGE", + "link": 1 + }, + { + "name": "V.V1", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "label": "F0", + "name": "F.F0", + "shape": 7, + "type": "FLOAT", + "link": 4 + }, + { + "name": "F.F1", + "shape": 7, + "type": "FLOAT", + "link": null + }, + { + "name": "stack", + "shape": 7, + "type": "STACK", + "link": null + }, + { + "name": "Expression", + "type": "STRING,SYNTAX_TREE", + "widget": { + "name": "Expression" + }, + "link": 3 + } + ], + "outputs": [ + { + "name": "IMAGE", + "shape": 6, + "type": "IMAGE", + "links": [ + 2 + ] + }, + { + "name": "STACK", + "type": "STACK", + "links": null + } + ], + "properties": { + "Node name for S&R": "mrmth_ag_ImageMathNode" + }, + "widgets_values": [ + "I0*(1-F0)+I1*F0", + "error", + 0, + false, + true + ], + "widgets_values_named": { + "Expression": "I0*(1-F0)+I1*F0", + "length_mismatch": "error", + "batching": 0, + "remember_stack": false, + "use_compute_device": true + } + }, + { + "id": 3, + "type": "PreviewImage", + "pos": [ + 333.54110997002033, + -524.1730918036271 + ], + "size": [ + 225, + 266 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 2 + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [ + 5 + ] + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 4, + "type": "mrmth_ScriptInput", + "pos": [ + -674.3592541286675, + -986.2711865463397 + ], + "size": [ + 541, + 332.703125 + ], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "SYNTAX_TREE", + "type": "SYNTAX_TREE", + "links": [ + 3 + ] + } + ], + "properties": { + "Node name for S&R": "mrmth_ScriptInput" + }, + "widgets_values": [ + "#You do not need to use script input node. It however has some +es. For example faster repeated execution of workflow since transformations needed for code to run happen only once, not for each change of math node input.\n#Also you get line numbers so searching for error is easier\n# there are some input variables- V... for value input F... for float input. \n# Semicolon is used to separate commands. This line inverts image we sent to V0 since F0 = 1.\nt = F0-V0;\n# last expression determines output of the node. It does not have to be just variable as here. Ve could just put the F0-V0 as the only line\nt\n\n# If you see ValueError: Syntax error in expression at line 6, col 0: no viable alternative at input 't=F0-V0t' or something simillar, you forgot a semicolon" + ], + "widgets_values_named": { + "script": "#You do not need to use script input node. It however has some +es. For example faster repeated execution of workflow since transformations needed for code to run happen only once, not for each change of math node input.\n#Also you get line numbers so searching for error is easier\n# there are some input variables- V... for value input F... for float input. \n# Semicolon is used to separate commands. This line inverts image we sent to V0 since F0 = 1.\nt = F0-V0;\n# last expression determines output of the node. It does not have to be just variable as here. Ve could just put the F0-V0 as the only line\nt\n\n# If you see ValueError: Syntax error in expression at line 6, col 0: no viable alternative at input 't=F0-V0t' or something simillar, you forgot a semicolon" + } + }, + { + "id": 5, + "type": "PrimitiveFloat", + "pos": [ + -505.0102447083432, + -607.6632805955495 + ], + "size": [ + 270, + 62 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "FLOAT", + "type": "FLOAT", + "links": [ + 4 + ] + } + ], + "properties": { + "Node name for S&R": "PrimitiveFloat" + }, + "widgets_values": [ + 1 + ], + "widgets_values_named": { + "value": 1 + } + }, + { + "id": 6, + "type": "mrmth_ag_ImageMathNode", + "pos": [ + 702.0265120520136, + -596.9531495971897 + ], + "size": [ + 275.78125, + 286 + ], + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "label": "V0", + "name": "V.V0", + "type": "IMAGE", + "link": 5 + }, + { + "name": "V.V1", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "label": "F0", + "name": "F.F0", + "shape": 7, + "type": "FLOAT", + "link": null + }, + { + "label": "F1", + "name": "F.F1", + "shape": 7, + "type": "FLOAT", + "link": null + }, + { + "name": "stack", + "shape": 7, + "type": "STACK", + "link": null + }, + { + "name": "Expression", + "type": "STRING,SYNTAX_TREE", + "widget": { + "name": "Expression" + }, + "link": 6 + } + ], + "outputs": [ + { + "name": "IMAGE", + "shape": 6, + "type": "IMAGE", + "links": [ + 7 + ] + }, + { + "name": "STACK", + "type": "STACK", + "links": null + } + ], + "properties": { + "Node name for S&R": "mrmth_ag_ImageMathNode" + }, + "widgets_values": [ + "V0", + "error", + 0, + false, + true + ], + "widgets_values_named": { + "Expression": "V0", + "length_mismatch": "error", + "batching": 0, + "remember_stack": false, + "use_compute_device": true + } + }, + { + "id": 7, + "type": "mrmth_ScriptInput", + "pos": [ + 245.83464612997133, + -973.977520420764 + ], + "size": [ + 430.21875, + 303.515625 + ], + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "SYNTAX_TREE", + "type": "SYNTAX_TREE", + "links": [ + 6 + ] + } + ], + "properties": { + "Node name for S&R": "mrmth_ScriptInput" + }, + "widgets_values": [ + "/*\nThere is a lot defined functions. Here I will overlay image and inverse of it. I will flip the inverse of inverse so it does not end up grey. There is overlay function but that is overkill here\n*/\ntrue_color = 1-V0;\nflipped = flip(true_color,1); # image is [batch, height, width, color plane]\nprint(\"Max of compound image: \"+smax(V0+flipped)); # We print the maximum value to console (smax() reduces dimensions, tmax() goes value-by-value)\nV0+flipped\n# Normally we should divide it by 2 to not blow out everything to white but here we do not do that" + ], + "widgets_values_named": { + "script": "/*\nThere is a lot defined functions. Here I will overlay image and inverse of it. I will flip the inverse of inverse so it does not end up grey. There is overlay function but that is overkill here\n*/\ntrue_color = 1-V0;\nflipped = flip(true_color,1); # image is [batch, height, width, color plane]\nprint(\"Max of compound image: \"+smax(V0+flipped)); # We print the maximum value to console (smax() reduces dimensions, tmax() goes value-by-value)\nV0+flipped\n# Normally we should divide it by 2 to not blow out everything to white but here we do not do that" + } + }, + { + "id": 8, + "type": "PreviewImage", + "pos": [ + 1126.5241666030067, + -569.5599217854525 + ], + "size": [ + 225, + 266 + ], + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 7 + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [ + 8 + ] + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 9, + "type": "mrmth_ag_ImageMathNode", + "pos": [ + 1514.7190838016345, + -631.2528394138291 + ], + "size": [ + 275.78125, + 286 + ], + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "label": "V0", + "name": "V.V0", + "type": "IMAGE", + "link": 8 + }, + { + "name": "V.V1", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "label": "F0", + "name": "F.F0", + "shape": 7, + "type": "FLOAT", + "link": null + }, + { + "label": "F1", + "name": "F.F1", + "shape": 7, + "type": "FLOAT", + "link": null + }, + { + "name": "stack", + "shape": 7, + "type": "STACK", + "link": null + }, + { + "name": "Expression", + "type": "STRING,SYNTAX_TREE", + "widget": { + "name": "Expression" + }, + "link": 9 + } + ], + "outputs": [ + { + "name": "IMAGE", + "shape": 6, + "type": "IMAGE", + "links": [ + 10 + ] + }, + { + "name": "STACK", + "type": "STACK", + "links": null + } + ], + "properties": { + "Node name for S&R": "mrmth_ag_ImageMathNode" + }, + "widgets_values": [ + "I0*(1-F0)+I1*F0", + "error", + 0, + false, + true + ], + "widgets_values_named": { + "Expression": "I0*(1-F0)+I1*F0", + "length_mismatch": "error", + "batching": 0, + "remember_stack": false, + "use_compute_device": true + } + }, + { + "id": 10, + "type": "mrmth_ScriptInput", + "pos": [ + 1007.4251948116264, + -1000.0912158867388 + ], + "size": [ + 430.21875, + 303.515625 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "SYNTAX_TREE", + "type": "SYNTAX_TREE", + "links": [ + 9 + ] + } + ], + "properties": { + "Node name for S&R": "mrmth_ScriptInput" + }, + "widgets_values": [ + "# You can also define custom functions. You need to use return keyword on function exit if you will use it's output (forgot what happens when you do not)\ndivide(val1,val2) -> {\n# variables created in function cannot be seen outside but outside variables can be seen and manipulated inside\n# function can call themselves. BE CAREFULL! NOTHING LIKE STACK OVERFLOW EXCEPTION EXIST HERE. I got to recursion depth of 800k before getting bored. If you use a variable outside of a function and then define it in header of a function the outside variable will be shadowed by the one from function definition\nreturn val1/val2;\n};\ndivide(V0,2)\n# Notice that the colors are more saturated. That means previous code returned image with values > 1 and preview image clamped it for the viewport" + ], + "widgets_values_named": { + "script": "# You can also define custom functions. You need to use return keyword on function exit if you will use it's output (forgot what happens when you do not)\ndivide(val1,val2) -> {\n# variables created in function cannot be seen outside but outside variables can be seen and manipulated inside\n# function can call themselves. BE CAREFULL! NOTHING LIKE STACK OVERFLOW EXCEPTION EXIST HERE. I got to recursion depth of 800k before getting bored. If you use a variable outside of a function and then define it in header of a function the outside variable will be shadowed by the one from function definition\nreturn val1/val2;\n};\ndivide(V0,2)\n# Notice that the colors are more saturated. That means previous code returned image with values > 1 and preview image clamped it for the viewport" + } + }, + { + "id": 11, + "type": "PreviewImage", + "pos": [ + 1898.2780174068466, + -559.902744593401 + ], + "size": [ + 225, + 266 + ], + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 10 + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [] + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + } + ], + "links": [ + [ + 1, + 1, + 0, + 2, + 0, + "IMAGE" + ], + [ + 2, + 2, + 0, + 3, + 0, + "IMAGE" + ], + [ + 3, + 4, + 0, + 2, + 5, + "SYNTAX_TREE" + ], + [ + 4, + 5, + 0, + 2, + 2, + "FLOAT" + ], + [ + 5, + 3, + 0, + 6, + 0, + "IMAGE" + ], + [ + 6, + 7, + 0, + 6, + 5, + "SYNTAX_TREE" + ], + [ + 7, + 6, + 0, + 8, + 0, + "IMAGE" + ], + [ + 8, + 8, + 0, + 9, + 0, + "IMAGE" + ], + [ + 9, + 10, + 0, + 9, + 5, + "SYNTAX_TREE" + ], + [ + 10, + 9, + 0, + 11, + 0, + "IMAGE" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 1.38181758000008, + "offset": [ + -501.73049714905824, + 1005.8121011714313 + ] + }, + "frontendVersion": "1.51.9", + "VHS_latentpreview": false, + "VHS_latentpreviewrate": 0, + "VHS_MetadataImage": true, + "VHS_KeepIntermediate": true + }, + "version": 0.4 +} \ No newline at end of file