Photo Background - 2d Compositing|写真背景・二次元合成
Trained on 2d illustrations composited on a photo background.
This is a small LoRA I thought would be interesting to see how models trained on illustrations or real world images/video can produce the composite, mixed reality effect.
ℹ️ LoRA work best when applied to the base models on which they are trained. Please read the About This Version on the appropriate base models and workflow/training information.
Metadata is included in all uploaded files, you can drag the generated videos into ComfyUI to use the embedded workflows.
Description
Trained with https://github.com/tdrussell/diffusion-pipe
Training data consists of:
37 images as a combination of
Images used from other versions this model card
Images extracted as keyframes from several videos
23 video clips ~70 frames each
70 frames was too long for the 368 resolution for videos (exceeded 24gb vram)
Training configs:
dataset.toml
# Aspect ratio bucketing settings
enable_ar_bucket = true
min_ar = 0.5
max_ar = 2.0
num_ar_buckets = 7
# Frame buckets (1 is for images)
frame_buckets = [1]
[[directory]]
# Set this to where your dataset is
path = '/mnt/d/huanvideo/training_data/images'
# Reduce as necessary
num_repeats = 5
[[directory]] # IMAGES
# Path to the directory containing images and their corresponding caption files.
path = '/mnt/d/huanvideo/training_data/images'
num_repeats = 5
resolutions = [1024]
frame_buckets = [1] # Use 1 frame for images.
[[directory]] # VIDEOS
# Path to the directory containing videos and their corresponding caption files.
path = '/mnt/d/huanvideo/training_data/videos'
num_repeats = 5
resolutions = [368]
frame_buckets = [33, 49, 81] # Define frame buckets for videos.config.toml
# Dataset config file.
output_dir = '/mnt/d/huanvideo/training_output'
dataset = 'dataset.toml'
# Training settings
epochs = 50
micro_batch_size_per_gpu = 1
pipeline_stages = 1
gradient_accumulation_steps = 4
gradient_clipping = 1.0
warmup_steps = 100
# eval settings
eval_every_n_epochs = 5
eval_before_first_step = true
eval_micro_batch_size_per_gpu = 1
eval_gradient_accumulation_steps = 1
# misc settings
save_every_n_epochs = 15
checkpoint_every_n_minutes = 30
activation_checkpointing = true
partition_method = 'parameters'
save_dtype = 'bfloat16'
caching_batch_size = 1
steps_per_print = 1
video_clip_mode = 'single_middle'
[model]
type = 'hunyuan-video'
transformer_path = '/mnt/d/huanvideo/models/diffusion_models/hunyuan_video_720_cfgdistill_fp8_e4m3fn.safetensors'
vae_path = '/mnt/d/huanvideo/models/vae/hunyuan_video_vae_bf16.safetensors'
llm_path = '/mnt/d/huanvideo/models/llm'
clip_path = '/mnt/d/huanvideo/models/clip'
dtype = 'bfloat16'
transformer_dtype = 'float8'
timestep_sample_method = 'logit_normal'
[adapter]
type = 'lora'
rank = 32
dtype = 'bfloat16'
[optimizer]
type = 'adamw_optimi'
lr = 5e-5
betas = [0.9, 0.99]
weight_decay = 0.02
eps = 1e-8FAQ
Comments (8)
This is one of the best Lora I have tried for Hunyuan, I will stay tuned for more 👀
請問用什麼工具結合2D人物與真實場景?
(翻译)我可能误解了你的问题,但 lora 已经从图像和视频中学习并创建了效果。没有后期处理。
@motimalu Sorry, because I've been training 2D or 3D character lora, but the backgrounds don't look very realistic. So I wanted to ask how I should prepare materials
@ioritree I see, in this case I am not editing the images used for training - it is a collection of images that are already of 2D characters composited on real life backgrounds
@motimalu So if I manually remove the background from a 2D image and combine it with a realistic background before using it for training, will the effect be worse than using 2D images that already have realistic backgrounds
@ioritree Possibly it will be worse than existing images yes, but it depends on how you create the images - there are techniques involved in the creation of this effect like rotoscoping and re-lighting which make a more convincing image or animation.
It would still be better than using plain white backgrounds in my opinion. Theoretically you could use something like this to solve the lighting issue: https://github.com/lllyasviel/IC-Light
insanely good