Closed alexatnv closed 5 months ago
The first question:
I'm sorry, I don't know what to do, but it works better when the default parameters are fully used, and if outpaint_distance is specified, the dividing line looks pretty obvious. The second question: You can view the complete changeable parameters at http://127.0.0.1:8888/docs#/GenerateV2/img_inpaint_or_outpaint_v2_generation_image_inpaint_outpaint_post
For question no.1 - Sometimes using the inpainting version of the model (if there is one) helps. But the lines are a classic problem with outpainting and always were in every UI. The usual workflow is to do outpaint and then img2img where the visible seams or blurring is fixed. You can then combine the img2img result with the original photo for the best outcome.
Thanks for the answers everyone. Ill try an inpainting model. where do i place it? I placed juggernautXL_v9rdphoto2Inpaint.safetensors and ran it but seems to return an error with every "inpaint" versions of models
Sorry for the late reply and the wrong info. It really seems like Fooocus does not accept these inpaint models as other UIs do. Instead, you can try to play with the inpaint_engine
in advanced params. It can have quite different results for outpainting depending on the used model. Other than that the mentioned workflow is probably still the best bet
Thanks @davefojtik !
Curious how many 'versions' of the inpaint engine there are? 2.6 is the default. Would be great to know the range of versions that are available. And also - does high version necessarily mean it's 'newer' and therefore 'better'?
['None', 'v1', 'v2.5', 'v2.6']
It indeed means 'newer' but not necessarily 'better'. From my observations, it depends on the used model and other things. Worth experimenting a bit and finding the best one for your use case.
you are the best @davefojtik thank you for your time
Quesion #1: Using real photos of people who are usually cropped around the shoulders, sometimes closer like the head, and outpainting them in all directions to extend the crop. I noticed some visible lines on some of the output images.
import requests import json import base64 import argparse import os
Define the host for Fooocus API
host = "http://127.0.0.1:8888"
def inpaint_outpaint(input_image: bytes, positive_prompt: str, negative_prompt: str, performance_selection: str, guidance_scale: float, inpaint_strength: float, steps: int, base_model_name: str) -> dict: params = { "input_image": base64.b64encode(input_image).decode('utf-8'), "input_mask": None, "outpaint_selections": ["Left", "Right", "Bottom", "Top"], "outpaint_distance_left": 750, # Define the amount to outpaint to the left "outpaint_distance_right": 750, # Define the amount to outpaint to the right "outpaint_distance_top": 150, # Define the amount to outpaint to the top "outpaint_distance_bottom": 750, # Define the amount to outpaint to the bottom "positive_prompt": positive_prompt, "negative_prompt": negative_prompt, "performance_selection": performance_selection, "style_selections": ["Ads Corporate", "Misc Minimalist"], "async_process": False, "base_model_name": base_model_name, "advanced_params": { "guidance_scale": guidance_scale, "inpaint_strength": inpaint_strength, "overwrite_step": steps # Define the number of steps } } response = requests.post( url=f"{host}/v2/generation/image-inpaint-outpaint", data=json.dumps(params), headers={"Content-Type": "application/json"} ) return response.json()
def main(image_path):
Load the image
if name == "main": parser = argparse.ArgumentParser(description="Process an image for outpainting") parser.add_argument('--image', required=True, help='Path to the image to be processed') args = parser.parse_args()
How do i remove these lines? Right now it outpaints all directions at once, should I do one at a time?
Question #2: In my code above I have guidance strength and inpaint strength, im not really sure what each one does, but I noticed in my console some other parameters came up that I didn't see in the API - things like CFG,ControlNet Softness, Adapative CFG. Are these also changeable values?
[2024-05-23 08:32:01] INFO [Task Queue] Waiting for task finished, job_id=35ad05b3-8638-4694-84a6-90c5a3ba4a15 [2024-05-23 08:32:01] INFO [Task Queue] Task queue start task, job_id=35ad05b3-8638-4694-84a6-90c5a3ba4a15 [2024-05-23 08:32:01] INFO [Parameters] Adaptive CFG = 7.0 [2024-05-23 08:32:01] INFO [Parameters] Sharpness = 2.0 [2024-05-23 08:32:01] INFO [Parameters] ControlNet Softness = 0.25 [2024-05-23 08:32:01] INFO [Parameters] ADM Scale = 1.5 : 0.8 : 0.3 [2024-05-23 08:32:01] INFO [Parameters] CFG = 4.0 [2024-05-23 08:32:01] INFO [Parameters] Seed = 1014433614765127678 [2024-05-23 08:32:01] INFO [Fooocus] Downloading upscale models ... [2024-05-23 08:32:01] INFO [Fooocus] Downloading inpainter ...