From 21649fb0b1e2048dec35d9da32fc801af1921ac5 Mon Sep 17 00:00:00 2001 From: bruefire Date: Sun, 22 Sep 2024 04:47:44 +0900 Subject: [PATCH] added a new sample workflow for faceswap. --- pyproject.toml | 2 +- readme.md | 4 +- .../cat2dog_with_animatediff.json | 0 sample_workflows/faceswap_masking_helper.json | 694 ++++++++++++++++++ 4 files changed, 697 insertions(+), 3 deletions(-) rename dogcat-workflow.json => sample_workflows/cat2dog_with_animatediff.json (100%) create mode 100644 sample_workflows/faceswap_masking_helper.json diff --git a/pyproject.toml b/pyproject.toml index 1216e12..a372b22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-seqimageloader" description = "This is an extension node for ComfyUI that allows you to load frames from a video in bulk and perform masking and sketching on each frame through a GUI." -version = "1.0.1" +version = "1.0.2" license = "LICENSE" [project.urls] diff --git a/readme.md b/readme.md index 8578eab..8e7fc0a 100644 --- a/readme.md +++ b/readme.md @@ -46,8 +46,8 @@ Otherwise, it is the same as the SequentialImageLoader Node. ## Example With AnimateDiff ![iamge](docs/dogcat.gif) -[Workflow](dogcat-workflow.json) (It's depend on [ComfyUI-AnimateDiff-Evolved](https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved)) +[Workflow](sample_workflows/cat2dog_with_animatediff.json) (It's depend on [ComfyUI-AnimateDiff-Evolved](https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved)) [Video source](https://www.pexels.com/video/a-pet-cat-standing-on-the-brick-floor-of-a-garden-3009091/) ## Other -Temporary frame data accumulates in the input/ directory, so please delete data that is no longer needed at an appropriate time. \ No newline at end of file +Temporary frame data accumulates in the input/ directory, so please delete data that is no longer needed at an appropriate time. diff --git a/dogcat-workflow.json b/sample_workflows/cat2dog_with_animatediff.json similarity index 100% rename from dogcat-workflow.json rename to sample_workflows/cat2dog_with_animatediff.json diff --git a/sample_workflows/faceswap_masking_helper.json b/sample_workflows/faceswap_masking_helper.json new file mode 100644 index 0000000..540f97c --- /dev/null +++ b/sample_workflows/faceswap_masking_helper.json @@ -0,0 +1,694 @@ +{ + "last_node_id": 33, + "last_link_id": 42, + "nodes": [ + { + "id": 24, + "type": "ImpactImageBatchToImageList", + "pos": [ + -443, + -440 + ], + "size": { + "0": 210, + "1": 26 + }, + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 27 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 28, + 29 + ], + "shape": 6, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImpactImageBatchToImageList" + } + }, + { + "id": 27, + "type": "ImageToMask", + "pos": [ + -414, + 104 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": { + "collapsed": false + }, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 33 + } + ], + "outputs": [ + { + "name": "MASK", + "type": "MASK", + "links": [ + 34 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageToMask" + }, + "widgets_values": [ + "red" + ] + }, + { + "id": 32, + "type": "ImageListToImageBatch", + "pos": [ + 355, + 113 + ], + "size": { + "0": 210, + "1": 26 + }, + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 39 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 40 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageListToImageBatch" + } + }, + { + "id": 28, + "type": "VHS_VideoCombine", + "pos": [ + 1285, + -449 + ], + "size": [ + 320, + 789.5555555555555 + ], + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 38 + }, + { + "name": "audio", + "type": "VHS_AUDIO", + "link": null + } + ], + "outputs": [ + { + "name": "Filenames", + "type": "VHS_FILENAMES", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "VHS_VideoCombine" + }, + "widgets_values": { + "frame_rate": 30, + "loop_count": 0, + "filename_prefix": "fs", + "format": "video/h265-mp4", + "pix_fmt": "yuv420p10le", + "crf": 22, + "save_metadata": true, + "pingpong": false, + "save_output": true, + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "fs_00009.mp4", + "subfolder": "", + "type": "output", + "format": "video/h265-mp4" + } + } + } + }, + { + "id": 31, + "type": "ImageListToImageBatch", + "pos": [ + 859, + -440 + ], + "size": { + "0": 210, + "1": 26 + }, + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 37 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 38 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageListToImageBatch" + } + }, + { + "id": 16, + "type": "ReActorMaskHelper", + "pos": [ + 333, + -436 + ], + "size": { + "0": 330, + "1": 454 + }, + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 28 + }, + { + "name": "swapped_image", + "type": "IMAGE", + "link": 18 + }, + { + "name": "mask_optional", + "type": "MASK", + "link": 42 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 37 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + }, + { + "name": "MASK_PREVIEW", + "type": "IMAGE", + "links": [ + 41 + ], + "shape": 3, + "slot_index": 2 + }, + { + "name": "SWAPPED_FACE", + "type": "IMAGE", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ReActorMaskHelper" + }, + "widgets_values": [ + "bbox/face_yolov8m.pt", + 0.5, + 10, + 3, + 10, + "sam_vit_b_01ec64.pth", + 0, + 0.93, + 0, + 0.7, + "False", + "dilate", + 0, + 9, + 1 + ] + }, + { + "id": 10, + "type": "ReActorFaceSwap", + "pos": [ + -175, + -340 + ], + "size": { + "0": 315, + "1": 358 + }, + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "input_image", + "type": "IMAGE", + "link": 29 + }, + { + "name": "source_image", + "type": "IMAGE", + "link": 11 + }, + { + "name": "face_model", + "type": "FACE_MODEL", + "link": null, + "slot_index": 2 + }, + { + "name": "face_boost", + "type": "FACE_BOOST", + "link": null, + "slot_index": 3 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 18, + 39 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "FACE_MODEL", + "type": "FACE_MODEL", + "links": null, + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "ReActorFaceSwap" + }, + "widgets_values": [ + true, + "inswapper_128.onnx", + "retinaface_resnet50", + "none", + 1, + 0.5, + "no", + "no", + "0", + "0", + 1 + ] + }, + { + "id": 22, + "type": "MasksToMaskList", + "pos": [ + -42, + 105 + ], + "size": { + "0": 210, + "1": 26 + }, + "flags": { + "collapsed": false + }, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "masks", + "type": "MASK", + "link": 34 + } + ], + "outputs": [ + { + "name": "MASK", + "type": "MASK", + "links": [ + 42 + ], + "shape": 6, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "MasksToMaskList" + } + }, + { + "id": 29, + "type": "VHS_VideoCombine", + "pos": [ + 796, + 33 + ], + "size": [ + 320, + 789.5555555555555 + ], + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 40 + }, + { + "name": "audio", + "type": "VHS_AUDIO", + "link": null + } + ], + "outputs": [ + { + "name": "Filenames", + "type": "VHS_FILENAMES", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "VHS_VideoCombine" + }, + "widgets_values": { + "frame_rate": 30, + "loop_count": 0, + "filename_prefix": "fs", + "format": "video/h265-mp4", + "pix_fmt": "yuv420p10le", + "crf": 22, + "save_metadata": true, + "pingpong": false, + "save_output": true, + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "fs_00008.mp4", + "subfolder": "", + "type": "output", + "format": "video/h265-mp4" + } + } + } + }, + { + "id": 33, + "type": "PreviewImage", + "pos": [ + 852, + -328 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 41 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 12, + "type": "LoadImage", + "pos": [ + -814, + 17 + ], + "size": { + "0": 315, + "1": 314 + }, + "flags": {}, + "order": 0, + "mode": 0, + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 11 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "keanu-reeves-the-matrix-1200x802.jpg", + "image" + ] + }, + { + "id": 23, + "type": "Video Loader With Mask Editor", + "pos": [ + -816, + -440 + ], + "size": { + "0": 315, + "1": 382 + }, + "flags": {}, + "order": 1, + "mode": 0, + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [ + 27 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "mask_images", + "type": "IMAGE", + "links": [ + 33 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "image_count", + "type": "INT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "Video Loader With Mask Editor" + }, + "widgets_values": [ + "", + "image", + 0, + 103 + ] + } + ], + "links": [ + [ + 11, + 12, + 0, + 10, + 1, + "IMAGE" + ], + [ + 18, + 10, + 0, + 16, + 1, + "IMAGE" + ], + [ + 27, + 23, + 0, + 24, + 0, + "IMAGE" + ], + [ + 28, + 24, + 0, + 16, + 0, + "IMAGE" + ], + [ + 29, + 24, + 0, + 10, + 0, + "IMAGE" + ], + [ + 33, + 23, + 1, + 27, + 0, + "IMAGE" + ], + [ + 34, + 27, + 0, + 22, + 0, + "MASK" + ], + [ + 37, + 16, + 0, + 31, + 0, + "IMAGE" + ], + [ + 38, + 31, + 0, + 28, + 0, + "IMAGE" + ], + [ + 39, + 10, + 0, + 32, + 0, + "IMAGE" + ], + [ + 40, + 32, + 0, + 29, + 0, + "IMAGE" + ], + [ + 41, + 16, + 2, + 33, + 0, + "IMAGE" + ], + [ + 42, + 22, + 0, + 16, + 2, + "MASK" + ] + ], + "groups": [], + "config": {}, + "extra": {}, + "version": 0.4 +} \ No newline at end of file