/ComfyUI_Jags_VectorMagic

a collection of nodes to explore Vector and image manipulation

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

ComfyUI_Jags_VectorMagic

#a collection of nodes to explore Vector and image manipulation

✨🍬Please note the work in this repo is not completed and still in progress and code will break until all things are sorted. Please wait as will announce same in the update here. Thanks for your support. Also note for any issues on the nodes, kindly share your workflow and alos always update comfyUI base including all dependencies.✨🍬

Nodes

x-y tiling K sampler and circular VAE modes for tileable images

Segmentation using Ultralytics Yolov8 models and creating masks with same



You can see more examples of the workflow and proper selection of models for each type of segmentation masks in the VECTOR MAGIC WIKI

Jags-Clipseg Nodes

CLIPSeg adds a minimal decoder on top of a frozen CLIP model for zero- and one-shot image segmentation. The CLIPSeg node generates a binary mask for a given input image and text prompt.

Inputs:

  • image: A torch.Tensor representing the input image.
  • text: A string representing the text prompt.
  • blur: A float value to control the amount of Gaussian blur applied to the mask.
  • threshold: A float value to control the threshold for creating the binary mask.
  • dilation_factor: A float value to control the dilation of the binary mask.

Outputs:

  • tensor_bw: A torch.Tensor representing the binary mask.
  • image_out_hm: A torch.Tensor representing the heatmap overlay on the input image.
  • image_out_bw: A torch.Tensor representing the binary mask overlay on the input image.

JagsCombineSegMasks

The CombineSegMasks node combines two or optionally three masks into a single mask to improve masking of different areas.



Inputs:

  • image: A torch.Tensor representing the input image.
  • mask1: A torch.Tensor representing the first mask.
  • mask2: A torch.Tensor representing the second mask.
  • mask3 (optional): A torch.Tensor representing the third mask. Defaults to None.

Outputs:

  • combined_mask: A torch.Tensor representing the combined mask.
  • image_out_hm: A torch.Tensor representing the heatmap overlay of the combined mask on the input image.
  • image_out_bw: A torch.Tensor representing the binary mask overlay of the combined mask on the input image.

Example Work flow

x-y tiling K sampler and circular VAE modes for tileable images- workflow using SDXL


ComfyUI_Jags_VectorMagic- WIKI

Link to the workflow and explanations : WIKI

Many thanks for a wonderful flower segmentation pipeline from Flower-Instance-Segmentation which is now added to the Yolov8 models repo for exploration.

Dependencies

The python library simpleeval is required to be installed if you wish to use the expression Nodes.

pip install simpleeval

Also can be installed with a simple pip command
'pip install simpleeval'

A single file library for easily adding evaluatable expressions into python projects. Say you want to allow a user to set an alarm volume, which could depend on the time of day, alarm level, how many previous alarms had gone off, and if there is music playing at the time.

check Notes for more information.

Install:

To install, drop the "ComfyUI_Jags_VectorMagic" folder into the "...\ComfyUI\custom_nodes" directory and restart UI.
Ensure all the requirements.txt dependencies are met.
But the best method is to install same from ComfyUI Manager (https://github.com/ltdrdata/ComfyUI-Manager) and search for this name in the Node list and install from there and restart the UI as it takes care of all the dependencies and installs and make it easy for you.

Put all Seg models in comfyUI/models/Yolov8
Download Yolov8 seg detector and other collections from the following resources;* YOLOv8 model collections

Ultralytics Detection models : YOLOv8m

Ultralytics Segmentation models : YOLOv8m-seg,

Ultralytics Pose models : Also available incase you want to explore : POSE MODELS (yolov8n-pose.pt yolov8s-pose.pt yolov8m-pose.pt yolov8l-pose.pt yolov8x-pose.pt yolov8x-pose-p6.pt) Please note teh pose modesl need a seperate type of node to work and cannot be deployed in normal segmentaion mask node.

Installing Clipseg models

ComfyUI node for the [CLIPSeg model] to generate masks for image inpainting tasks based on text prompts.

Download clipseg model and place it in [comfy\models\clipseg] directory for the node to work

Ensure your models directory is having the following structure comfyUI--- models----clipseg; it should have all the files from the huggingface repo inside including config.json to work well. This needs to be checked.

Ensure all the files are copied to your clipseg directory for the clipseg to work properly.

Todo

[ ] Add guidance to notebook

Comfy Resources

ComfyUI_Jags_VectorMagic Linked Repos

Guides:

If you create a cool image with our nodes, please show your result and message us on twitter at @jags111 or @NeuralismAI .

You can join the NEURALISM AI DISCORD or JAGS AI DISCORD Share your work created with this model. Exchange experiences and parameters. And see more interesting custom workflows.

Support us in Patreon for more future models and new versions of AI notebooks.

My buymeacoffee.com pages and links are here and if you feel you are happy with my work just buy me a coffee !

coffee for JAGS AI

Thank you for being awesome!