tillo13/Instant_id

Exploration of the instant_id endpoints

0

stars

1

commits

Python

primary language

Feb 16, 2024

updated

README

Enhanced Batch Processing for InstantID with Comprehensive Logging

Introduction

The original InstantID tool is currently limited to processing a single image per execution. The preprocess.py module overcomes this limitation, enabling batch image processing. This enhancement allows for the continuous generation of stylized images by hijacking the initial loader function to preprocess and manage multiple images in sequence.

Batch Processing Unlocked

The heart of this upgrade lies in the ability to loop through an entire folder of images (sample_images), applying a diverse set of styles and parameters to each image. With this ability, users can maximize the utility of InstantID by processing large datasets without manual intervention.

Configurable Ranges and Styles

Users can define and experiment with ranges of values for various parameters to discover the optimal settings:

  • IdentityNet Strength Ratio Range
  • Adapter Strength Ratio Range
  • Number of Inference Steps Range
  • Guidance Scale Range

This structured variety helps find the sweet spot for each image, allowing for you to find the right customization:

IDENTITYNET_STRENGTH_RATIO_RANGE = (1.0, 1.5)
ADAPTER_STRENGTH_RATIO_RANGE = (0.7, 1.0)
NUM_INFERENCE_STEPS_RANGE = (40, 60)
GUIDANCE_SCALE_RANGE = (7.0, 12.0)
...

Additionally, the script can loop through predefined or random styles, applying each to the set of images to generate a rich array of results.

Automated Image Preparation

Efficient image preparation is vital for achieving consistent results. The preprocess.py module employs resize_and_pad_image to standardize all images to the same dimensions, ensuring uniformity across the batch, ready for further processing by InstantID.

Randomized Image Selection

The module randomly selects images from the sample_images directory, ensuring an unbiased and varied selection for processing. This feature is particularly useful when dealing with large collections of images.

Detailed CSV Logging

Each processed image's configuration and outcomes are meticulously logged in a CSV file (default generation_log.csv). This log includes key details like identity and adapter strength ratios, the number of inference steps, guidance scale, and any error messages.

Real-Time Feedback

As the batch processing unfolds, preprocess.py provides real-time feedback in the console, displaying time remaining, progress of values, and overall statistics. This immediate insight into the batch progress is crucial for efficient workflow management.

Gradio Integration

After batch processing, users can opt to open up Gradio for fine-tuned, one-off image processing. This flexibility marries the robustness of batch processing with the refinement of individual image customization.

from preprocess import initial_image, generate_image
initial_image(generate_image)

Conclusion

preprocess.py transforms the InstantID tool into a powerhouse of batch image processing. By extending the original script to handle multiple images, providing detailed logs, and integrating with Gradio for one-off customizations, this module unlocks the full potential of the InstantID pipeline for users and researchers alike.


For more details on InstantID, refer to the official project page and associated research paper:

Contributors

tillo13

1 commits

tillo13/Instant_id

Exploration of the instant_id endpoints

0

stars

1

commits

Python

primary language

Feb 16, 2024

updated

README

Enhanced Batch Processing for InstantID with Comprehensive Logging

Introduction

The original InstantID tool is currently limited to processing a single image per execution. The preprocess.py module overcomes this limitation, enabling batch image processing. This enhancement allows for the continuous generation of stylized images by hijacking the initial loader function to preprocess and manage multiple images in sequence.

Batch Processing Unlocked

The heart of this upgrade lies in the ability to loop through an entire folder of images (sample_images), applying a diverse set of styles and parameters to each image. With this ability, users can maximize the utility of InstantID by processing large datasets without manual intervention.

Configurable Ranges and Styles

Users can define and experiment with ranges of values for various parameters to discover the optimal settings:

  • IdentityNet Strength Ratio Range
  • Adapter Strength Ratio Range
  • Number of Inference Steps Range
  • Guidance Scale Range

This structured variety helps find the sweet spot for each image, allowing for you to find the right customization:

IDENTITYNET_STRENGTH_RATIO_RANGE = (1.0, 1.5)
ADAPTER_STRENGTH_RATIO_RANGE = (0.7, 1.0)
NUM_INFERENCE_STEPS_RANGE = (40, 60)
GUIDANCE_SCALE_RANGE = (7.0, 12.0)
...

Additionally, the script can loop through predefined or random styles, applying each to the set of images to generate a rich array of results.

Automated Image Preparation

Efficient image preparation is vital for achieving consistent results. The preprocess.py module employs resize_and_pad_image to standardize all images to the same dimensions, ensuring uniformity across the batch, ready for further processing by InstantID.

Randomized Image Selection

The module randomly selects images from the sample_images directory, ensuring an unbiased and varied selection for processing. This feature is particularly useful when dealing with large collections of images.

Detailed CSV Logging

Each processed image's configuration and outcomes are meticulously logged in a CSV file (default generation_log.csv). This log includes key details like identity and adapter strength ratios, the number of inference steps, guidance scale, and any error messages.

Real-Time Feedback

As the batch processing unfolds, preprocess.py provides real-time feedback in the console, displaying time remaining, progress of values, and overall statistics. This immediate insight into the batch progress is crucial for efficient workflow management.

Gradio Integration

After batch processing, users can opt to open up Gradio for fine-tuned, one-off image processing. This flexibility marries the robustness of batch processing with the refinement of individual image customization.

from preprocess import initial_image, generate_image
initial_image(generate_image)

Conclusion

preprocess.py transforms the InstantID tool into a powerhouse of batch image processing. By extending the original script to handle multiple images, providing detailed logs, and integrating with Gradio for one-off customizations, this module unlocks the full potential of the InstantID pipeline for users and researchers alike.


For more details on InstantID, refer to the official project page and associated research paper:

Contributors

tillo13

1 commits

Languages

Python

99.3%