rbbrdckybk / dream-factory

Multi-threaded GUI manager for mass creation of AI-generated art with support for multiple GPUs.
MIT License
497 stars 57 forks source link

ADetailer not functioning correctly #55

Open Koneko349 opened 10 months ago

Koneko349 commented 10 months ago

When using the ADetailer, the system outputs the main image but then outputs a second low quality image, similar in composition but a different image. The ADetailer does not inpaint the main image and appears to have no impact on its generation.

rbbrdckybk commented 10 months ago

That's odd, I must have introduced an issue at some point. I haven't used ADetailer for txt2img in standard .prompts files since implementation so I'm actually not even 100% sure it ever worked properly, now that I think about it (I do all of my ADetailer work in batch via process .prompts files). Will look into it, but it may take a bit as I'm currently traveling!

In the meantime, if you generate images normally without ADetailer, and then set aside images that need ADetailer face/hand/whatever replacement, you can use something like this .prompts file to process them all at once (this should definitely work for you as I've been using ADetailer via process files several times a week):

[config]

!MODE = process
!ADETAILER_USE = yes

# change these to suit your needs
!ADETAILER_STRENGTH = 0.50
!ADETAILER_SAMPLER = Heun
!ADETAILER_STEPS = 60
!ADETAILER_SCALE = 7
!ADETAILER_MODEL = face_yolov8n.pt

# change these to suit your needs
!ADETAILER_NEG_PROMPT = (hands), cartoon, cgi, render, illustration, painting, drawing
!ADETAILER_PROMPT = photo portrait of a man, very detailed skin, studio photography, masterpiece

# change to whatever model(s) you want to use
!ADETAILER_CKPT_FILE = deliberate
!OVERRIDE_CKPT_FILE = deliberate

!INPUT_IMAGE = # put the directory containing input images here
!OUTPUT_DIR = # put your output directory here

# output filename will be original name plus ADetailer strength specified above
!FILENAME = <input-img>-<ad-strength>

# uncomment & put the name of another .prompts file here to execute it automatically when finished
#!NEXT_PROMPT_FILE = 

[prompts]

go
rbbrdckybk commented 9 months ago

Had a chance to play with this today, and while ADetailer is definitely working, there is a strange bug with txt2img requests in the ADetailer extension itself. Any txt2img job that utilizes ADetailer executed via the API from Dream Factory will actually get executed twice - unfortunately this needs to be fixed by the people maintaining the ADetailer extension; the API request from Dream Factory is correct.

My test .prompts file is below - I generate a standard txt2img image without ADetailer, and then ask for the same image with ADetailer enabled to replace the face (from a young woman's face to an old one). I end up with 3 images from Dream Factory, when I should obviously only get 2.

I'm running the latest version of everything (Dream Factory, Auto1111, and the ADetailer extension).

Dream Factory output from the .prompts file below:

Standard txt2img image: txt2img-20240205-214624

1st ADetailer image (this matches what I get if I run this job directly via the Auto1111 UI): adetailer-20240205-214655-0

2nd ADetailer image (appears to be the same ADetailer job run against the image above): adetailer-20240205-214655

My .prompts file:

[config]

!MODE = standard
!REPEAT = no

!WIDTH = 512
!HEIGHT = 512

!SAMPLER = DPM++ 2M Karras
!STEPS = 20
!SCALE = 7.5
!CLIP_SKIP = 1
!HIGHRES_FIX = no

!CKPT_FILE = deliberate_v3
!ADETAILER_STRENGTH = 0.50
!ADETAILER_MODEL = face_yolov8n.pt

!NEG_PROMPT = (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, tattoo, watermark, text, anime, illustration, sketch, 3d, vector art, cartoon, painting

!SEED = 42

[prompts]

!ADETAILER_USE = no
!FILENAME = txt2img-<date>-<time>
portrait of a young woman wizard, magical robes, holding staff, fantasy character artwork, dnd character, action lines

!ADETAILER_USE = yes
!ADETAILER_PROMPT = photo portrait of an old woman, very detailed skin, studio photography, masterpiece
!FILENAME = adetailer-<date>-<time>
portrait of a young woman wizard, magical robes, holding staff, fantasy character artwork, dnd character, action lines