Skip to content

Commit

Permalink
Update Gizmos
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroCabrera committed May 16, 2024
1 parent abf87d3 commit 1f0fd11
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 32 deletions.
7 changes: 5 additions & 2 deletions ModNet/nuke/PC_ModNet/PC_ModNet.gizmo
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Gizmo {
addUserKnob {26 ""}
addUserKnob {26 channelsIn l "Channels In:" T "rgba.red, rgba.green, rgba.blue"}
addUserKnob {4 model M {photographic webcam ""}}
addUserKnob {26 "" +STARTLINE}
addUserKnob {26 _1 l "" +STARTLINE T "<span><b>Original Model </b> - <a href=\"https://github.com/ZHKKKe/MODNet\" style=\"color:#666;text-decoration: none;\">MODNet</a></span>"}
addUserKnob {26 _2 l "" +STARTLINE T "<span><b>Ported to cattery by </b> - <a href=\"https://www.linkedin.com/in/pcpedrocabrera/\" style=\"color:#666;text-decoration: none;\">Pedro Cabrera</a></span> \n<span><b>Part of the collection </b> - <a href=\"https://github.com/pedroCabrera/CatteryNodes\" style=\"color:#666;text-decoration: none;\">CatteryNodes</a></span>"}
}
Input {
inputs 0
Expand Down Expand Up @@ -39,7 +42,7 @@ Gizmo {
xpos -237
ypos -328
}
set Nb5e0b400 [stack 0]
set N491eac00 [stack 0]
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all modnet_webcam_portrait_matting.cat] *.cat]"
Expand All @@ -49,7 +52,7 @@ set Nb5e0b400 [stack 0]
xpos -209
ypos -255
}
push $Nb5e0b400
push $N491eac00
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all modnet_photographic_portrait_matting.cat] *.cat]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,36 @@ Gizmo {
addUserKnob {4 model M {rvm_mobilenetv3 rvm_resnet50}}
addUserKnob {7 downsampleRatio l "Downsample Ratio" R 0.1 1}
downsampleRatio 0.25
addUserKnob {26 "" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {20 DOC n 1}
addUserKnob {26 text l "" +STARTLINE T "The reset Parameter controls if recurrent states are reused or not, the model is suposed to reuse previous states to improve the mate.\nIf the reset is off, the previous frames are not taken into acount\nIf is on, previous computed frame state is used for computing new frame, its suposed to be keyed at first frame ON and then at second frame OFF.\nTake in to acount that the previous computed frame might not be the previous frame in the sequence if you are jumping in the timeline and can get undesired results if reset is off.\nAlso, if you change the input ( diferent plate, resolution, etc ) , make sure to check the reset, and then check/uncheck based on your preferences ( normally keying first frame as mentioned ), you will get a error otherwise.\n\nThe table provides a general guideline. Please adjust based on your video content.\n\n\n Resolution ----- Portrait ---- Full-Body\n<=512x512 ---- 1 ---- 1 \n 1280x720 ---- 0.375 ---- 0.6 \n1920x1080 ---- 0.25 ---- 0.4 \n3840x2160 ---- 0.125 ---- 0.2\n\n\nInternally, the model resizes dowan the input for stage 1. Then, it refines at high-resolution for stage 2.\n\nSet downsample_ratio so that the downsampled resolution is between 256 and 512.\n\nFor example, for 1920x1080 input with downsample_ratio=0.25, the resized resolution 480x270 is between 256 and 512.\n\nAdjust downsample_ratio base on the video content. If the shot is portrait, a lower downsample_ratio is sufficient. If the shot contains the full human body, use high downsample_ratio.\n\nNote that higher downsample_ratio is not always better."}
addUserKnob {20 endGroup n -1}
addUserKnob {20 endGroup n -1}
addUserKnob {26 "" +STARTLINE}
addUserKnob {26 _1 l "" +STARTLINE T "<span><b>Original Model </b> - <a href=\"https://github.com/PeterL1n/RobustVideoMatting\" style=\"color:#666;text-decoration: none;\">RobustVideoMatting</a></span>"}
addUserKnob {26 _2 l "" +STARTLINE T "<span><b>Ported to cattery by </b> - <a href=\"https://www.linkedin.com/in/pcpedrocabrera/\" style=\"color:#666;text-decoration: none;\">Pedro Cabrera</a></span> \n<span><b>Part of the collection </b> - <a href=\"https://github.com/pedroCabrera/CatteryNodes\" style=\"color:#666;text-decoration: none;\">CatteryNodes</a></span>"}
}
Input {
inputs 0
name Input1
xpos -256
ypos -297
}
set Ne7d89800 [stack 0]
set N43581c00 [stack 0]
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all rvm_resnet50.cat] *.cat]"
halfPrecision {{parent.halfPrecision}}
serialiseKnob {downsample_ratio:{parent.downsampleRatio};reset:{parent.reset};}
halfPrecision {{parent.halfPrecision}}
serialiseKnob {}
name Inference2
xpos -162
ypos -204
}
push $Ne7d89800
push $N43581c00
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all rvm_mobilenetv3.cat] *.cat]"
halfPrecision {{parent.halfPrecision}}
serialiseKnob {downsample_ratio:{parent.downsampleRatio};reset:{parent.reset};}
halfPrecision {{parent.halfPrecision}}
serialiseKnob {reset:{parent.reset};downsample_ratio:{parent.downsampleRatio};}
name Inference1
selected true
xpos -317
Expand All @@ -59,4 +62,4 @@ push $Ne7d89800
xpos -250
ypos -10
}
end_group
end_group
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#! C:/Program Files/Nuke14.0v5/nuke-14.0.5.dll -nx
version 14.0 v5
Gizmo {
onCreate "import sys\nthis = nuke.thisNode()\ninference = nuke.toNode(f\"\{this.name()\}.Inference1\")\nthis\[\"gpuName\"].setValue(inference\[\"gpuName\"].value())\nthis\[\"channelsIn\"].setValue(\"rgba.red, rgba.green, rgba.blue\")\ninference.forceValidate()\nis_enabled = inference\[\"modelFile\"].enabled()\nif (sys.platform.lower() == \"darwin\") and (not inference\[\"useGPUIfAvailable\"].enabled()): this\[\"useGPUIfAvailable\"].setValue(False), this\[\"useGPUIfAvailable\"].setEnabled(False)\nif not is_enabled:\n for k in this.knobs(): this\[k].setEnabled(False)\nthis\[\"halfPrecision\"].setVisible(this\[\"useGPUIfAvailable\"].enabled())"
onDestroy "nuke.thisNode()\[\"knobChanged\"].setValue(\"\")"
Expand All @@ -14,15 +12,17 @@ Gizmo {
addUserKnob {26 channelsIn l "Channels In:" T "rgba.red, rgba.green, rgba.blue"}
addUserKnob {26 ""}
addUserKnob {26 "" l " "}
addUserKnob {26 _1 l "" +STARTLINE T "<span><b>Original Model </b> - <a href=\"https://github.com/cxgincsu/SemanticGuidedHumanMatting\" style=\"color:#666;text-decoration: none;\">Semantic Guided human Matting</a></span>\n"}
addUserKnob {26 _2 l "" +STARTLINE T "<span><b>Ported to cattery by </b> - <a href=\"https://www.linkedin.com/in/pcpedrocabrera/\" style=\"color:#666;text-decoration: none;\">Pedro Cabrera</a></span> \n\n<span><b>Part of the collection </b> - <a href=\"https://github.com/pedroCabrera/CatteryNodes\" style=\"color:#666;text-decoration: none;\">CatteryNodes</a></span>"}
}
Input {
inputs 0
name Input1
xpos -150
ypos 67
}
set Nc05c6000 [stack 0]
push $Nc05c6000
set Nb115400 [stack 0]
push $Nb115400
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all SGHM-ResNet50.cat] *.cat]"
Expand Down
24 changes: 13 additions & 11 deletions segment-anything/nuke/PC_Segment_anything/PC_Segment_anything.gizmo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Gizmo {
addUserKnob {4 modelSize l "Model Size" M {Base Large}}
modelSize Large
addUserKnob {20 positive_prompts n 1}
positive_prompts 0
addUserKnob {12 prompt1}
prompt1 {512 512}
addUserKnob {12 prompt2}
Expand All @@ -26,6 +27,7 @@ Gizmo {
prompt5 {-500 0}
addUserKnob {20 endGroup n -1}
addUserKnob {20 negative_prompts n 1}
negative_prompts 0
addUserKnob {12 negative1}
negative1 {-100 100}
addUserKnob {12 negative2}
Expand All @@ -37,36 +39,36 @@ Gizmo {
addUserKnob {12 negative5}
negative5 {-500 100}
addUserKnob {20 endGroup_1 n -1}
addUserKnob {26 "" +STARTLINE}
addUserKnob {20 DOC n 1}
addUserKnob {26 _3 l "" +STARTLINE T "Move positive and negative prompts to positive values to make them have an effect.\nIf they are negative they will not be taken into account"}
addUserKnob {20 endGroup_2 n -1}
addUserKnob {26 "" +STARTLINE}
addUserKnob {26 _1 l "" +STARTLINE T "<span><b>Original Model </b> - <a href=\"https://github.com/facebookresearch/segment-anything\" style=\"color:#666;text-decoration: none;\">Segment Anything</a></span>"}
addUserKnob {26 _2 l "" +STARTLINE T "<span><b>Ported to cattery by </b> - <a href=\"https://www.linkedin.com/in/pcpedrocabrera/\" style=\"color:#666;text-decoration: none;\">Pedro Cabrera</a></span> \n<span><b>Part of the collection </b> - <a href=\"https://github.com/pedroCabrera/CatteryNodes\" style=\"color:#666;text-decoration: none;\">CatteryNodes</a></span>"}
}
Input {
inputs 0
name Input1
xpos -148
ypos 59
}
set Nbe719400 [stack 0]
set N35225800 [stack 0]
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all sam_vit_l.cat] *.cat]"
halfPrecision {{parent.halfPrecision}}
serialiseKnob {p1:{parent.prompt1} {parent.prompt1};p2:{parent.prompt2} {parent.prompt2};p3:{parent.prompt3} {parent.prompt3};
p4:{parent.prompt4} {parent.prompt4};p5:{parent.prompt5} {parent.prompt5};
n1:{parent.negative1} {parent.negative1};n2:{parent.negative2} {parent.negative2};n3:{parent.negative3} {parent.negative3};
n4:{parent.negative4} {parent.negative4};n5:{parent.negative5} {parent.negative5}}
serialiseKnob {}
name Inference2
xpos -61
ypos 205
}
push $Nbe719400
push $N35225800
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all sam_vit_b.cat] *.cat]"
halfPrecision {{parent.halfPrecision}}
serialiseKnob {p1:{parent.prompt1} {parent.prompt1};p2:{parent.prompt2} {parent.prompt2};p3:{parent.prompt3} {parent.prompt3};
p4:{parent.prompt4} {parent.prompt4};p5:{parent.prompt5} {parent.prompt5};
n1:{parent.negative1} {parent.negative1};n2:{parent.negative2} {parent.negative2};n3:{parent.negative3} {parent.negative3};
n4:{parent.negative4} {parent.negative4};n5:{parent.negative5} {parent.negative5}}

serialiseKnob {p1:{parent.prompt1} 100;p2:{parent.prompt2} -200;p3:{parent.prompt3} -300;p4:-400 -400;p5:{parent.prompt5} -500;n1:-100 -100;n2:{parent.negative2} -200;n3:{parent.negative3} -300;n4:-400 -400;n5:-500 -500;}
name Inference1
xpos -242
ypos 206
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version 13.1 v1
Gizmo {
onCreate "import sys\nthis = nuke.thisNode()\ninference = nuke.toNode(f\"\{this.name()\}.Inference1\")\nthis\[\"gpuName\"].setValue(inference\[\"gpuName\"].value())\nthis\[\"channelsIn\"].setValue(\"rgba.red, rgba.green, rgba.blue\")\ninference.forceValidate()\nis_enabled = inference\[\"modelFile\"].enabled()\nif (sys.platform.lower() == \"darwin\") and (not inference\[\"useGPUIfAvailable\"].enabled()): this\[\"useGPUIfAvailable\"].setValue(False), this\[\"useGPUIfAvailable\"].setEnabled(False)\nif not is_enabled:\n for k in this.knobs(): this\[k].setEnabled(False)\nthis\[\"halfPrecision\"].setVisible(this\[\"useGPUIfAvailable\"].enabled())"
onDestroy "nuke.thisNode()\[\"knobChanged\"].setValue(\"\")"
Expand All @@ -14,16 +13,19 @@ Gizmo {
addUserKnob {26 ""}
addUserKnob {41 optimize_speed l Fast T Inference1.optimize_speed}
addUserKnob {41 L l "Ressize Computation" T Inference1.L}
addUserKnob {26 "" l " "}
addUserKnob {26 "" l " "}
addUserKnob {26 "" +STARTLINE}
addUserKnob {26 _1 l "" +STARTLINE T "<span><b>Original Model </b> - <a href=\"https://github.com/hkchengrex/CascadePSP\" style=\"color:#666;text-decoration: none;\">CascadePSP</a></span>"}
addUserKnob {26 _2 l "" +STARTLINE T "<span><b>Ported to cattery by </b> - <a href=\"https://www.linkedin.com/in/pcpedrocabrera/\" style=\"color:#666;text-decoration: none;\">Pedro Cabrera</a></span> \n<span><b>Part of the collection </b> - <a href=\"https://github.com/pedroCabrera/CatteryNodes\" style=\"color:#666;text-decoration: none;\">CatteryNodes</a></span>"}
}
Input {
inputs 0
name Input1
xpos -150
ypos 67
}
set Nf4a2f800 [stack 0]
push $Nf4a2f800
set N109e6400 [stack 0]
push $N109e6400
Inference {
useGPUIfAvailable {{parent.useGPUIfAvailable}}
modelFile "\[lsearch -inline \[plugins -all cascade_psp.cat] *.cat]"
Expand All @@ -32,7 +34,7 @@ push $Nf4a2f800
name Inference1
selected true
xpos -150
ypos 254
ypos 253
}
Output {
name Output1
Expand Down

0 comments on commit 1f0fd11

Please sign in to comment.