ComfyUI Automation: Load ALL images from Folder | Image List vs Batch

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome back to data leveling in today's video we'll be exploring how we can upload multiple images from a directory yes I know this sounds simple and it is ridiculous that this is not a building feature so how we normally load patch images is something like this where we load an image then we create a batch note and then we load another image and so on this does not make sense if we are dealing with a large amount of images another example is if you want to try a lot of different posers in control net we have to keep loading each image manually it's like confy UI is a workflow based design user interface but if we have to manually load every image ourselves every time we want to use an image to image workflow that will consume a lot of time and there is no automation there at all now how we can solve this is by using a function from Inspire pack go to your confy UI manager search for inspire and install Inspire pack another recommended download that I found useful is creas tools that shows your Hardware utilization metrics search for Cris and install cras tools reload confy UI and let's get started there are two kinds of notes that we can use here load image list from directory and load image batch from directory let's start with load image badge from notes go to image and select load image badge from directory the one indicated with Inspire is the one we want to use for the directory we will give the PA to the folder containing the images you want to use for image load cap it means how many image you want to load from that folder start index is from which position in the folder do we start counting the images you want and remember that in programming we start with zero for the first index if the image load cap is zero it will run all the images in the folder so if let's say you want to load six images and start from the third one what we can do is something like this one key thing to take note of is that generally when we use batch in anything related to AI every image in the batch must be kept at the same size if your image is not resized prior to putting it into a batch most function uses the first image as a reference size and resize the others according to it this might lead to some issues based on the way the down scaling is performed for example in this function this image looks weird so I went to look at the source code to see what is running on the back end I found that this batch image node uses this way of down scrolling the image according to the first reference image size if we want to maintain the original image Dimension we will use the image list node from noes go to image then select load image list from directory the one indicat with Inspire is the one we want to use the variables we can change here are identical to the load badge node we will do the same where we set the image load cap and the starting index now if we see the results we can see that the original image dimensions are kept but of course we do not use things blindly we have to understand how it works so that things won't go wrong think of it like this this is a model that accepts image as an input and most models are exported to accept batches of images when we send a list of images what happens is that each image will be considered as a batch size of one and send to the model this also means that the number of times we'll run the model is the number of images in the list as each image now represents one batch now if you send a batch of images to the model what happens is that those images will be processed all at once together with the condition that the images are all at the same size so if let's say you have 10 images and once to have a b size of five the model will then run twice we will also explore the differences in terms of performance this is where the crease tools start to shine you can select the settings option to choose what metrix you want to display the main one we need to monitor is the GPU Ram I'll will be using the automate upscaling function to demonstrate this in my folder I have a lot of blurry images that needs to be upscaled and they are all in the same size of 512 by 768 pixels when we use image list these images are processed iteratively meaning each image will be processed individually if we look at the console we can see that the upscaling process is done separately for each image this means that my vram or virtual Ram will be lesser but the trade-off is that the speed is slower as well now if we use image badge all images in that batch are processed concurrently this will increase the vram but the amount of time taken is much faster now one issue that may arise is that we may run into a memory overload and we do not want that especially if let's say we are running things overnight and one error destroys the entire process so how we can find a sweet spot to not run run out of memory while making things run fast is through a simple experiment we first need to find out how much vram is our process running before it reaches the maximum capacity since all the images in the batch are of the same size we can assume that the memory usage for each batch will be somewhat similar with a little bit of overflow let's try incrementing it until we reaches about 70 to 80% and that's where we know how much our GPU can handle for this workflow it is important to note that different workflows require different amount of vram so so make sure to test out the maximum limit for each workflow that you are using now that we know our maximum batch size is around 25 what we can do from here is to use a rebatch image node so there are 100 images in my folder and when it is loaded with this load image batch from directory node it puts all 100 image into a single batch what the rebatch image note does is split these 100 images from a single batch into four batches with each batch containing 25 images since there are four batches our model model will also run four times as the number of times the model will run is the number of batches you send to the model this is a controller example where we want to process a total of 12 images with a batch size of four a few things to take note is that we have to update the empty latent image bat size with the batch size we are using otherwise it will only render the first image another thing is to not confuse the batch count from the menu with the batch you're using this batch count from the menu refers to the number of times you want to click on QBE prom and run the whole workflow let's quickly go through some use cases for both nodes for image Leist we want to use it in cases where the final outputs aspect ratio or image size is important and needs to be the same as the original image one example is if we are trying to upscale a amount of stock images where it comes in different sizes and want to just leave it there running overnight for image batch we want to use it in cases like videos where even if you split into frames per second all the image size will be identical and perform transformation in batches before reforming the video again if you learn something from this video do help to leave a like And subscribe for more content like this it will really help the channel grows and serves as motivation for me as well if you face any difficulties following the videos do also leave a comment and I will try my best to help you and remember don't stop leveling up
Info
Channel: Data Leveling
Views: 6,159
Rating: undefined out of 5
Keywords: Crystools, IMG2IMG, DIR, imagebatch, ai art, stable diffusion tutorial, comfyui tutorial
Id: kS3TkRbg9jk
Channel Id: undefined
Length: 7min 20sec (440 seconds)
Published: Tue Jan 30 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.