ostris / ai-toolkit

Various AI scripts. Mostly Stable Diffusion stuff.
MIT License
3.37k stars 357 forks source link

Images stretched instead of cropped #135

Open CypherNaught-0x opened 2 months ago

CypherNaught-0x commented 2 months ago

This is for bugs only

Did you already ask in the discord?

Yes/No: No (Link is invalid?)

You verified that this is a bug and not a feature request or question by asking in the discord?

Yes/No: No (Link is invalid?)

Describe the bug

Really enjoying the toolkit and the workflow using the config files.

I had a suspicion that at least some images were not being handled correctly, since many of my training runs showed extreme stretching in resulting images at some steps, usually vertical squashing. Trying to confirm my suspicion, I've tested a few images by dumping the transformation results as images (using img.save in dataloader.mixins.py ~L500). In my limited testing with 19 images, 4 of the images (~20%) were squished instead of cropped. Unless I have a huge misunderstanding of the Flux architecture, I believe this to be a bug in the implementation.

diodiogod commented 2 months ago

I've had some epoch version showing this stretching results as well, specially at higher weight. And there were no stretched images in my the dataset, so I imagine you are correct.

AbstractEyes commented 2 months ago

I also had this bug show up. It's likely causing massive amounts of problems in the higher step counts.

rickrender commented 2 months ago

Same issue here, I thought it was just me, a likeness lora trained on iPhone images. Instead of looking cropped the heads look horizontally squashed. All of my images were in portrait orientation so I'm pretty sure it's a bug.

CypherNaught-0x commented 2 months ago

Just finished a new training run and evaluation using the fix, and it seems to have fixed the issue completely. Training is much more stable now, even at higher steps.