AI 이미지에서 같은 캐릭터를 여러 장 유지하기
고정 묘사문 프롬프트, 미드저니 --cref 참조 파라미터, Diffusers LoRA 파인튜닝을 단계별로 적용해 동일 인물 이미지를 일관되게 생성합니다.
AI 이미지 생성에서 동일한 캐릭터의 얼굴과 고유 특징을 유지하면서 다양한 구도와 상황으로 생성합니다.
[1] 인물의 외모를 규정하는 고정 묘사문(Character Sheet 프롬프트)을 정의합니다. 나이, 머리 모양, 눈동자 색, 피부 톤, 고유 의상을 동일한 영어 어휘로 묶고 장면에 관계없이 항상 프롬프트 앞단에 배치합니다.
prompt: A 24-year-old Korean woman, shoulder-length straight black hair, hazel eyes, sharp jawline, wearing a navy blue oversized hoodie, plain white background, neutral lighting, studio portrait, 8k[2] 생성된 결과물 중 정면과 반측면 각도의 선명한 이미지를 선택하여 웹에 업로드하거나 디스코드 이미지 URL 을 확보합니다.
https://example.com/images/character-front.pnghttps://example.com/images/character-side.png[3] 미드저니(Midjourney) 에서 새 장면 프롬프트를 작성하고 맨 뒤에 --cref 파라미터와 참조 이미지 주소를 붙입니다. 기본값인 --cw 100 이 적용되어 얼굴, 헤어스타일, 의상을 모두 원본에 맞춰 재현합니다.
/imagine prompt: A woman reading a book in a sunlit wooden library, wide shot --cref https://example.com/images/character-front.png[4] 캐릭터의 얼굴 이목구비만 유지하고 의상이나 머리스타일을 바꾸려면 캐릭터 가중치를 --cw 0 으로 낮춥니다.
/imagine prompt: A woman wearing an astronaut space suit inside a spaceship cockpit --cref https://example.com/images/character-front.png --cw 0[5] 프롬프트와 참조 파라미터만으로 세부 디테일이 유지되지 않는다면, 15~20장의 캐릭터 이미지를 모아 Hugging Face Diffusers 의 LoRA(Low-Rank Adaptation) 학습 스크립트로 베이스 모델을 미세조정합니다.
$ accelerate launch train_text_to_image_lora.py \ --pretrained_model_name_or_path="stable-diffusion-v1-5/stable-diffusion-v1-5" \ --dataset_name="example-character-dataset" \ --dataloader_num_workers=8 \ --resolution=512 \ --center_crop \ --random_flip \ --train_batch_size=1 \ --gradient_accumulation_steps=4 \ --max_train_steps=1500 \ --learning_rate=1e-04 \ --output_dir="character-lora"[6] 학습이 끝나 생성된 pytorch_lora_weights.safetensors 가중치를 Diffusers 파이프라인에 불러와 새 배경으로 캐릭터를 추론합니다.
from diffusers import AutoPipelineForText2Imageimport torch pipeline = AutoPipelineForText2Image.from_pretrained( "stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch.float16,).to("cuda") pipeline.load_lora_weights("character-lora", weight_name="pytorch_lora_weights.safetensors")image = pipeline("A character standing in a neon-lit cyberpunk alleyway").images[0]image.save("result.png")