인공지능

Prompt-to-prompt : Stable Diffusion 이미지 생성 정밀 제어

몽상꼴레 2022. 11. 14. 14:39

 

Stable Diffusion 이 무료로 공개된 이후 Dall-E2, MidJoruney와 같은 기존 서비스에 인공지능 이미지 생성분야에서 르네상스가 일어나고 있다.

 

다만, Stable Diffusion은 random noise로부터 시작하기 때문에 같은 문장(prompt)을 던져도 매번 다른 그림을 생성해 낸다.

같은 seed 값을 쓰더라도 동일한 그림이 만들어지지는 않는다.

 

그래서 만들어진 이미지를 델타 조정하기 위해 inpaint 를 사용하기도 한다.

하지만,  inpaint는 선택된 부분의 객체를 지우는 것이 목적이지.. 사용자의 의도가 반영된 이미지를 생성해 주는 것이 목적이 아니기 때문에 원하는 내용을 만들어 주지 못한다. 대개 실패한다.

그러니까~ inpaint도 답이 아니다.

 


 

 

그래서!

 

최근 구글에서 이를 위해 prompt-to-prompt 라는 것을 만들어 공개했다. 

https://github.com/google/prompt-to-prompt

 

GitHub - google/prompt-to-prompt

Contribute to google/prompt-to-prompt development by creating an account on GitHub.

github.com

 

 

Jupyter Notebook 형태로 코드를 제공한다. 물론 다 벗겨내고 순수 python으로도 만드는 것이 어려운 일은 아니다.

 

논문은 아래 링크 참고.

https://arxiv.org/abs/2208.01626

 

Prompt-to-Prompt Image Editing with Cross Attention Control

Recent large-scale text-driven synthesis models have attracted much attention thanks to their remarkable capabilities of generating highly diverse images that follow given text prompts. Such text-based synthesis methods are particularly appealing to humans

arxiv.org

 


 

 

비공식적이지만 좀더 사용하기 편하게 만든 것도 있음. 다양한 기능도 좀 더 집어 넣었고.. 얘가 좀 더 댕기기는 함.

https://github.com/bloc97/CrossAttentionControl

 

GitHub - bloc97/CrossAttentionControl: Unofficial implementation of "Prompt-to-Prompt Image Editing with Cross Attention Control

Unofficial implementation of "Prompt-to-Prompt Image Editing with Cross Attention Control" with Stable Diffusion - GitHub - bloc97/CrossAttentionControl: Unofficial implementation of &quo...

github.com

 

나중에 시간될때 찍먹 시리즈로 좀 더 파고 들어 볼 생각..

 

 


 

Stable Diffusion 모델의 동작 방식에 대해 알고 싶으면 아래 링크 참고.

https://www.youtube.com/watch?v=f6PtJKdey8E 

 

대학원생이 랩 세미나에서 제대로 이해하지도 못하고 웅얼웅얼 대는거 말고..

한글로 제대로 분석된 영상이 있으면 좋겠다...

 

들리나요? 동빈나 선생!!?
우쥬 플리즈~

 

* 인공지능 관련 논문 분석 영상들 중 '동빈나'가 설명력은 단연 최고입니다.

https://www.youtube.com/c/dongbinna

 

동빈나

안경잡이개발자 나동빈입니다.

www.youtube.com