SweetBrothers / sweetbrothers

이어드림 스쿨 스윗한형제들 이미지 생성 프로젝트
MIT License
1 stars 6 forks source link

Item 1 추론 코드 작성 -1) T2I & I2I BASE #28

Closed ahfmrptEkd closed 10 months ago

ahfmrptEkd commented 10 months ago

기능 구현을 위한 issue

할 일(Tasks)

base code

Extensions - 추가 기능

선택 조건 구현

ahfmrptEkd commented 10 months ago

T2I, I2I base code 작성 완료. (11/23)

base code 작성 완료

ahfmrptEkd commented 10 months ago

Adetailer code 작성 완료 (11/23)

ahfmrptEkd commented 10 months ago

Upscale code 작성 완료 (11/24)

image

참조

참조1 참조2

ahfmrptEkd commented 10 months ago

ControlNet code 작성 완료 (11/24)

참조

참조 1 참저 2

ahfmrptEkd commented 10 months ago

Reactor code 작성 완료 (11/25)

image

참조

참조

ahfmrptEkd commented 10 months ago

Embedding 의 경우에는 "negative_prompt"에 같이 추가하여 가중치를 적용하면 쓸 수 있음.

ahfmrptEkd commented 10 months ago

Override_setting code + dreambooth model & VAE & LoRA useage 작성완료 (11/25)

override_settings 와 alwayson_scripts 의 차이를 알아봐야 할 듯함. 지금 알아본 바로는

web ui WIKI 와 관련 git 참조함.

model:str='PastelMix.safetensors'
vae:str="vae-ft-ema-560000-ema-pruned.safetensors"
override_settings= {
    'sd_model_checkpoint': model,
    "sd_vae": vae,

override_payload = {
    "override_settings": override_settings
}

payload.update(override_payload)
}

위 코드를 사용해서 모델과 VAE 추가 하여 load 가능

model:str='PastelMix.safetensors'
vae:str="vae-ft-ema-560000-ema-pruned.safetensors"

paylod = {
        'sd_model_checkpoint': model,
       "sd_vae": vae,
}
  1. LoRA는 "prompt" 단에 추가하여 씀.
  2. embedding 은 "negative_prompt" 단에 추가하여 trigger_word를 적음.

git disscusion 을 참조하여 LoRA 적용 & embedding 코드 적용

참조

참조 1 참조 2 참조 3 참조 4

ahfmrptEkd commented 10 months ago

Prompt 단에서 제어할 것들

  1. 성별 (남성 / 여성)
  2. picture의 Tone (warm / cool) :-> LoRA 로 적용 가능.

ControlNet에서 제어할 것들

  1. 사진 포즈 (1~4) 예정 . 기본 Portrait (prompt 설정)
  2. 빛의 구도 -> 2번째 controlNet 단에서 예정.

필요한 준비물

사진 포즈가 될 참조 input image 빛의 구도를 해줄 가이드 input image

ahfmrptEkd commented 10 months ago

base code 작성완료 (11/29)

ahfmrptEkd commented 10 months ago

빛 구도 (11/30)

ahfmrptEkd commented 10 months ago

촬영 포즈

ahfmrptEkd commented 10 months ago

Piture tone (11/30)

ahfmrptEkd commented 10 months ago

ContorlNet issue 발생

ControlNet - WARNING - [dw_openpose_full.processor_res] Invalid value(-1), using default value 512.
# for i in r['images']:
#     image = Image.open(io.BytesIO(base64.b64decode(i.split(",",1)[0])))

#     png_payload = {
#         "image": "data:image/png;base64," + i
#     }
#     response2 = requests.post(url=f'{url}/sdapi/v1/png-info', json=png_payload)

#     pnginfo = PngImagePlugin.PngInfo()
#     pnginfo.add_text("parameters", response2.json().get("info"))
#     image.save(f'{output}.png', pnginfo=pnginfo)

참고

controlnet official git을 통해 base code에서의 파라미터 조정함. 참고

ahfmrptEkd commented 10 months ago
  1. openpose_full image

  2. dw openpose image

차이가 많이 나옴

ahfmrptEkd commented 10 months ago

ControlNet Parameter

resize 의 경우는 생성하는 이미지의 크기와 포즈의 크기가 달라 꾸겨지는 현상이 보임. 그래서 just resize 해서 크기, Envelope은 큰 차원을 맞춤 == 비율 유지됨. 2가 좀 더 비율이 괜찮은 것 같음.

ahfmrptEkd commented 10 months ago

Base.py(i2i) final updated