Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple variant mechanism #71

Merged
merged 6 commits into from
Aug 24, 2022
Merged

Add simple variant mechanism #71

merged 6 commits into from
Aug 24, 2022

Conversation

Oceanswave
Copy link
Contributor

@Oceanswave Oceanswave commented Aug 24, 2022

This pr adds the following:

  • Introduces a new flag, [-v, --variants] that accepts an int and pipes generated images back through the img2img pipeline in order to have a simple 'variants' method. This obvi has some limitations: works solely on strength, and uses the original prompt, but provides some interesting results
  • Fixes the warning that LANCZOS is deprecated introduced by a different PR
  • Hopefully better resolves the device issue for folks running on different device types in the ddim and plms samplers

@morganavr
Copy link

morganavr commented Aug 24, 2022

This is a prompt I provided:

dream> "photo dog labrador park" --init_img=./init-images/dog.png --strength=0.75 -s50 -n1 -v 5

Created variants images are very different from each other. If I remove "-v 5" parameter and run this prompt instead:

dream> "photo dog labrador park" --init_img=./init-images/dog.png --strength=0.75 -s50 -n 5

then script creates images of the same quality. Is it an expected behavior of this PR?

Below are photos from your PR with "-v 5" argument:
000004 2471322587
000005 687997972

@lstein
Copy link
Collaborator

lstein commented Aug 24, 2022

Thanks for this. Is there a reason that you created an unused variants argument in the calls to img2img() and text2img()? Is this just to avoid python complaining about an unexpected argument?

@Oceanswave
Copy link
Contributor Author

Oceanswave commented Aug 24, 2022

@morganavr the strength of how closely img2img follows the image is controlled by the -f or --strength flag. 1 is completely different, 0 is completely the same. the default is 0.75 which is fairly different, but you'll notice that certain features are kept in the same place, such as the nose, eyes. tweaking the strength to -f 0.5 or lower makes it closer and closer to the original image

@lstein sheepishly yes - open to a better way, delete the property prior to pass?

@lstein
Copy link
Collaborator

lstein commented Aug 24, 2022

@Oceanswave I'm inclined to leave it be. I just got a little confused because I was looking for the variation-generating code in the simplet2i (which ain't simple any longer) and thought you'd forgotten something. The code is seriously in need of refactoring anyway, and I'm likely going to be changing how arguments are passed to the two routines.

@lstein lstein merged commit 1eec6b7 into invoke-ai:main Aug 24, 2022
@morganavr
Copy link

morganavr commented Aug 24, 2022

@Oceanswave
my concern with that PR is that even without --variants argument script produces the images of the same variation similarity.
I thought that --variants will produce almost identical images that differ only slightly from each other.

Can you provide a usage example with correct parameters?
Also I think that README should be updated because how users are supposed to know about this new feature? :)

@Oceanswave
Copy link
Contributor Author

@morganavr Sure -

Snap a dog wearing swim goggles and a funny hat at the park -n1 -f0.4 -v5

000393 487749487
000394 2164969678
000395 3171752827
000396 3005182383
000397 1457683666
000398 1061717353

@Oceanswave
Copy link
Contributor Author

@morganavr since this is pretty fun.. here's another

Snap a rocket ship made of cheese -n1 -f0.6 -v5

000423 2942464694
000424 1587318822
000425 401204029
000426 1892625275
000427 1439315593
000428 3120839592

@Oceanswave
Copy link
Contributor Author

@morganavr

Snap pancakes that have the outline of a gorilla -n1 -f0.6 -v5

burning the pancake to get the effect is... pretty clever..

000439 617891079
000440 3001330001
000441 2622437235
000442 3215496261
000443 2666305284
000444 2627140063

I like the smiling one with the hand

@Oceanswave
Copy link
Contributor Author

@morganavr

Snap a butterfly with stained glass wings -n1 -f0.6 -v5

000451 2111948800
000452 356855707
000453 2534382919
000454 111758583
000455 829957504
000456 3654036121

@Oceanswave
Copy link
Contributor Author

okok, one more.

A painting of a beach at night, stars flicker and reflect in the waves, in the style of Thomas Kinkade, ultra realistic -n1 -f0.6 -C 13 -v5

000493 877713857

000494 1610365310
000495 3908619535
000496 677054376
000497 3559683726
000498 3996828818

@Oceanswave
Copy link
Contributor Author

Oceanswave commented Aug 25, 2022

Reducing the -f or --strength reduces the variation

Snap a man wearing a pineapple hat. -n1 -f0.2 -C 13 -v5

ezgif-5-917734c1cf

Huh.. I just thought of another feature... :)

@Oceanswave
Copy link
Contributor Author

And it's possible to supply your own initial image as well -- just using one that is in the repo

a photo of a dog sitting on a bench -Idata/inpainting_examples/overture-creations-5sI6fQgYIuo.png -f0.2 -C17.0 -v 5

ezgif-2-f3e96ab25d

@vekst
Copy link

vekst commented Aug 25, 2022

This'll be fun to use, nice one. Somewhat related, but this gives me an idea for something similar but for normal, non img2img generations. A variant command that changes the CFG Scale of a generation which is using a seed. Would be kinda fun.

edit: disregard, just noticed something similars been thought of in the Issues of the main project.

@morganavr
Copy link

Thanks for all these examples @Oceanswave
It seems that I used wrong parameters and your feature works as intended!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants