Skip to content

melMass/comfy_mtb

Repository files navigation

MTB Nodes

embedded test

home

Translated Readme (using DeepTranslate, PRs are welcome):
image 日本語による説明
image 中文说明

Buy Me A Coffee

Install Guide | Examples

There is now a dedicated #mtb-nodes channel on the Banodoco discord:


Welcome to the MTB Nodes project! This codebase is open for you to explore and utilize as you wish. Its primary purpose is to build proof-of-concepts (POCs) for implementation in MLOPs. Many nodes in this project are inspired by existing community contributions or built-in functionalities.

Before proceeding, please be aware of the licenses associated with certain libraries used in this project. For example, the deepbump library is licensed under GPLv3.

Web Extensions

mtb add a few widgets like COLOR

color widget preview

A few nodes have the concept of "dynamic" inputs:
dynamic inputs

Node List

Animation

  • Animation Builder: Convenient way to manage basic animation maths at the core of many of my workflows (both worflows for the following GIFs are in the examples)

    Example lerping two conditions (blue car -> yellow car)

    Example using image transforms a feedback for a fake deforum effect

  • Batch Float: Generates a batch of float values with interpolation.

  • Batch Shape: Generates a batch of 2D shapes with optional shading (experimental).

  • Batch Transform: Transform a batch of images using a batch of keyframes.

  • Export With Ffmpeg: Export with FFmpeg, it used to be export to Proress and is still tailored for YUV

  • Fit Number : Fit the input float using a source and target range, you can also control the interpolation curve from a list of presets (default to linear)

bbox

  • Bounding Box: BBox constructor (custom type),
  • BBox From Mask: From a mask extract the bounding box
  • Crop: Crop image from BBox
  • Uncrop: Uncrop image from BBox

colors

  • Colored Image: Constant color image of given size
  • RGB to HSV: -,
  • HSV to RGB: -,
  • Color Correct: Basic color correction tools

image ops

  • Blur: Blur an image using a Gaussian filter.
  • Deglaze Image: taken from FN16,
  • Denoise: Denoise the input image,
  • Image Compare: Compare two images and return a difference image
  • Image Premultiply: Premultiply image with mask
  • Image Remove Background Rembg: RemBG powered background removal.
  • Image Resize Factor: Extracted mostly from WAS Node Suite, with a few edits (most notably multiple image support) and less features.
  • Mask To Image: Converts a mask (alpha) to an RGB image with a color and background
  • Save Image Grid: Save all the images in the input batch as a grid of images.

latent utils

  • Latent Lerp: Linear interpolation (blend) between two latent

textures

  • Model Patch Seamless: Use the seamless diffusion "hack" to patch any model to infere seamless images, check the examples to see how to use all those textures node together
  • DeepBump: Normal & height maps generation from single pictures
  • Image Tile Offset: Mimics an old photoshop technique to check for seamless textures by offsetting tiles of the image.

misc utils

  • Any To String: Tries to take any input and convert it to a string.
  • Concat Images: Takes two image stream and merge them as a batch of images supported by other Comfy pipelines.
  • Image Resize Factor: Deprecated, I since discovered the builtin image resize.
  • Text To Image: Utils to convert text to image using a font
  • Styles Loader: Load csv files and populate a dropdown from the rows (à la A111)
  • Smart Step: A very basic node to get step percent to use in KSampler advanced,
  • Qr Code: Basic QR Code generator
  • Save Tensors: Debug node that will probably be removed in the future
  • Int to Number: Supplement for WASSuite number nodes
  • Smart Step: A very basic tool to control the steps (start/stop) of the KAdvancedSampler using percentage
  • Load Image From Url: Load an image from the given URL

Optional nodes

These nodes are still bundled in mtb, but moving forward (>0.2.0) they won't be setup by the install script and their dependencies won't install either. The reason is mostly that they all have a better alternatives available and tensorflow on windows was not a fun experience and since Python 3.11 not an experience at all.

For linux and mac users though these nodes didn't cause any issue and I personally still use them, these are the extra requirements needed:

.venv/python -m pip install tensorflow facexlib insightface basicsr

face detection / swapping

Warning Those nodes were among the first to be implemented they do work, but on windows the installation is still not properly handled for everyone
As alternatives you can use reactor for face swap and facerestore for restoration
You can check this video for a tutorial by Ferniclestix using these alternatives

  • Face Swap: Face swap using deepinsight/insightface models (this node used to be called Roop in early versions, it does the same, roop is just an app that uses those model)
  • Load Face Swap Model: Load an insightface model for face swapping
  • Restore Face: Using GFPGan to restore faces, works great in conjunction with Face Swap and supports Comfy native upscalers for the bg_upscaler

image interpolation (animation)

Warning The FILM nodes will be deprecated at some point after 0.2.0, Fannovel16's interpolation nodes implement it and they rely on a pytorch implementation of FILM which solves the issues related to the ones included in mtb. They will probably remain available if your system meet the requirements and ignored otherwise.

Why?

Windows only issue: This requires tensorflow-gpu that is unfortunately not a thing anymore on Windows since 2.10.1 (unless you use a complex WSL passthrough setup but it's still not "Windows")
Using this old version is quite clunky and require some patching that install.py does automatically, but the main issue is that no wheels are available for python > 3.10 Comfy-nightly is already using Python 11 so installing this old tf version won't work there.
You can in any case install the normal up to date tensorflow but that will run on CPU and is much MUCH slower for FILM inference.

  • Load Film Model: Loads a FILM model
  • Film Interpolation: Process input frames using FILM

  • Export to Prores (experimental): Exports the input frames to a ProRes 4444 mov file. This is using ffmpeg stdin to send raw numpy arrays, used with Film Interpolation and very simple for now but could be expanded upon.

Comfy Resources

Misc

Guides:

Extensions and Custom Nodes: