[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
+170 -48
View File
@@ -2,75 +2,197 @@
id: wiki-2026-0508-image-parameters
title: Image Parameters
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: []
aliases: [Image Generation Parameters, Diffusion Parameters, Sampler Settings]
duplicate_of: none
source_trust_level: A
confidence_score: 0.92
tags: [uncategorized]
confidence_score: 0.9
verification_status: applied
tags: [diffusion, image-generation, stable-diffusion, sampler, cfg, seed]
raw_sources: []
last_reinforced: 2026-05-08
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: python
framework: diffusers
---
# [[Image Parameters|Image Parameters]]
# Image Parameters
## 📌 한 줄 통찰 (The Karpathy Summary)
이미지 매개변수(Image Parameters)는 AI 이미지 생성 모델에서 결과물을 정밀하게 제어하기 위해 텍스트 프롬프트에 추가하는 특수한 명령어 또는 수치적 변수이다 [1-3]. 이는 이미지의 종횡비, 예술적 스타일의 적용 강도, 무작위성(Chaos), 그리고 특정 단어나 개념의 가중치 등을 세밀하게 조정하는 역할을 수행한다 [1, 4, 5]. 생성형 AI 사용자는 이러한 매개변수를 활용하여 단순한 묘사를 넘어 모델의 렌더링 과정 전반을 자신만의 의도대로 통제할 수 있다 [2, 3, 6].
## 한 줄
> **"매 같은 prompt 라도 sampler / steps / CFG / seed 가 그림을 결정한다"**. Diffusion-based 이미지 생성의 결과는 prompt 만큼이나 sampler 종류, sampling steps, classifier-free guidance scale, seed, scheduler 같은 운영 파라미터에 의해 좌우되며, 2026 현재 SDXL/FLUX/SD3.5/Imagen 모든 모델에서 공통적으로 적용된다.
## 📖 구조화된 지식 (Synthesized Content)
**Midjourney의 매개변수 문법과 구조**
* Midjourney에서 매개변수는 항상 텍스트 프롬프트의 맨 마지막에 위치해야 하며, 이중 하이픈(`--`)으로 시작한다 [2, 3].
* 프롬프트 텍스트와 하이픈 사이에는 공백을 두어야 하지만, 하이픈 사이에는 공백이 없어야 하며 쉼표나 마침표 같은 문장 부호를 포함해서는 안 된다 [7].
## 매 핵심
**Midjourney 주요 매개변수 (V6 & V7 기준)**
* **비율 및 버전 제어**: `--ar` (Aspect Ratio)는 이미지의 종횡비를 설정하며, 기본값인 1:1 외에도 16:9, 3:2 등으로 변경할 수 있다 [1, 3, 5, 8]. `--v` (Version)는 생성에 사용할 모델 버전을 지정하며, 현재는 `--v 7`이 기본값이다 [3, 9-11].
* **스타일 및 렌더링 제어**: `--stylize` (또는 `--s`)는 0에서 1000 사이의 값으로 Midjourney 특유의 예술적 스타일 강도를 조절하며, 값이 낮을수록 텍스트 지시에 더 충실하고 높을수록 예술성이 강해진다 [1, 3, 12]. `--quality` (또는 `--q`)는 렌더링 시간과 디테일을 제어한다 [3, 10, 13]. `--style raw`를 사용하면 자동화된 미적 보정을 줄여 더 사실적이고 사진 같은 결과물을 얻을 수 있다 [3, 10, 14].
* **다양성 및 속도 제어**: `--chaos` (또는 `--c`)는 0에서 100 사이의 값으로 초기 이미지 그리드의 무작위성과 다양성을 증가시킨다 [3, 10, 15]. `--draft`는 V7에서 지원되는 기능으로, GPU 사용량을 줄여 훨씬 빠른 속도로 초기 시안을 생성할 때 쓰인다 [8-10].
* **참조 및 일관성 제어**: 특정 이미지나 스타일을 참조할 때 다양한 매개변수가 쓰인다. `--iw`는 텍스트 대비 이미지 프롬프트의 가중치를 설정한다 [3, 10, 15]. `--cref`는 캐릭터의 일관성을 유지하고, `--sref`는 색감이나 무드보드 등의 스타일을 복제한다 [3, 10, 12, 16, 17]. V7에 도입된 `--oref` (Omni Reference)는 캐릭터뿐만 아니라 사물의 형태적 일관성까지 유지할 수 있다 [9, 10, 18].
* **제외 기능**: `--no`는 부정 프롬프트 매개변수로, 이미지에서 제외하고 싶은 요소를 명시할 때 사용된다 [10, 15, 19].
### 매 핵심 파라미터
- **prompt / negative_prompt**: 텍스트 조건. 길이 ≠ 품질.
- **steps (sampling steps)**: 보통 20-50. FLUX-schnell 는 4 steps, Turbo/LCM 은 1-4.
- **CFG scale (guidance_scale)**: 1.5 (창의) ~ 12 (충실). FLUX 는 distilled — guidance 1 권장.
- **sampler / scheduler**: Euler, DPM++ 2M Karras, UniPC, DDIM, LCM.
- **seed**: 동일 seed + 동일 파라미터 → 재현.
- **width/height**: SDXL 1024², SD3.5 1024², FLUX 1024² 또는 1024×1536.
- **strength (img2img)**: 0 (원본) ~ 1 (전부 새로).
- **clip_skip**: 1 (기본) — anime 모델은 2 가 흔함.
- **prompt weighting**: `(word:1.3)`, `[word]` (A1111), `(word)+` (compel).
- **LoRA scale**: 0.6-0.9 일반, 1.0 강함.
**Stable Diffusion의 가중치 및 제어 매개변수**
* **프롬프트 가중치 (Prompt Weighting)**: 특정 단어나 구문의 중요도를 높이거나 줄이는 데 사용된다. 기본 가중치는 1이며, 괄호 `()`와 함께 `+` 기호나 1.1~2 사이의 숫자를 결합해 강조하거나(예: `(dog:1.1)` 또는 `(dog)+`), `-` 기호나 0~0.9 사이의 숫자로 비중을 줄일 수 있다 [4, 20, 21].
* **제어 스케일**: CFG Scale(Classifier-Free Guidance Scale) 변수는 모델이 사용자의 긍정 및 부정 프롬프트 조건을 얼마나 강력하게 따를지 그 지침의 강도를 결정한다 [22, 23]. 또한, Sampling steps 매개변수를 조정하여 이미지 생성 과정의 변동성과 디테일 형성을 제어할 수 있다 [23].
### 매 sampler 비교 (2026)
- **Euler / Euler a**: 빠름, 단순.
- **DPM++ 2M Karras**: 표준 추천 — 품질/속도 균형.
- **UniPC**: 적은 steps 에서 강함.
- **DDIM**: deterministic, 재현성 좋음.
- **LCM / Turbo**: distilled, 1-4 steps.
- **Heun, DPM++ SDE**: 고품질, 느림.
## 🔗 지식 연결 (Graph)
- **Related Topics:** [[Prompt Weighting|Prompt Weighting]], [[Negative Prompts|Negative Prompts]], [[Style Reference|Style Reference]], Aspect Ratio, Model Versions
- **Projects/Contexts:** [[미드저니(Midjourney) V7 초안 기반 워크플로우|Midjourney V7]], [[Stable Diffusion|Stable Diffusion]]
- **Contradictions/Notes:** 플랫폼마다 매개변수를 적용하는 문법과 방식에 근본적인 차이가 존재한다. Midjourney는 프롬프트의 가장 끝에 이중 하이픈(`--`)을 붙여 전역적인 이미지 속성을 제어하는 반면, Stable Diffusion은 텍스트 내부에서 괄호 `()`나 대괄호 `[]` 등을 이용해 개별 토큰(단어)에 직접 가중치를 부여하거나 제외하는 방식을 취한다 [3, 7, 20].
### 매 응용
1. ComfyUI / A1111 / Forge UI 워크플로 작성.
2. SDK 기반 batch 생성 (diffusers).
3. ControlNet / IP-Adapter 결합.
4. 프로덕션 API (Replicate, Fal, RunPod).
---
*Last updated: 2026-04-30*
## 💻 패턴
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
### 1. diffusers — 기본 SDXL 호출
```python
from diffusers import StableDiffusionXLPipeline
import torch
pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16, variant="fp16",
).to("cuda")
img = pipe(
prompt="a photo of a Shiba Inu, cinematic, 50mm",
negative_prompt="lowres, watermark",
num_inference_steps=30, guidance_scale=6.0,
width=1024, height=1024,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
img.save("out.png")
```
**언제 이 지식을 쓰는가:**
- *(TODO)*
### 2. FLUX (guidance-distilled)
```python
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16).to("cuda")
img = pipe(
prompt="a tiny astronaut riding a duck, studio light",
guidance_scale=3.5, # FLUX-dev: 3-5
num_inference_steps=28,
height=1024, width=1024,
generator=torch.Generator("cuda").manual_seed(0),
).images[0]
```
**언제 쓰면 안 되는가:**
- *(TODO)*
### 3. LCM 1-4 steps (real-time)
```python
from diffusers import AutoPipelineForText2Image, LCMScheduler
pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16).to("cuda")
img = pipe(prompt="cyberpunk cat", num_inference_steps=2, guidance_scale=0.0).images[0]
```
## 🧪 검증 상태 (Validation)
### 4. img2img + strength
```python
from diffusers import StableDiffusionXLImg2ImgPipeline
pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(...).to("cuda")
img = pipe(prompt=prompt, image=init, strength=0.55, guidance_scale=7.0, num_inference_steps=40).images[0]
```
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
### 5. prompt weighting (compel)
```python
from compel import Compel, ReturnedEmbeddingsType
compel = Compel(tokenizer=[pipe.tokenizer, pipe.tokenizer_2],
text_encoder=[pipe.text_encoder, pipe.text_encoder_2],
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
requires_pooled=[False, True])
prompt = "a (red:1.4) sports car, (sunset:1.2)"
conditioning, pooled = compel(prompt)
img = pipe(prompt_embeds=conditioning, pooled_prompt_embeds=pooled, num_inference_steps=30).images[0]
```
## 🧬 중복 검사 (Duplicate Check)
### 6. LoRA + scale
```python
pipe.load_lora_weights("path/to/anime.safetensors", adapter_name="anime")
pipe.set_adapters(["anime"], adapter_weights=[0.7])
img = pipe(prompt="anime girl, blue hair", num_inference_steps=30, guidance_scale=6.5).images[0]
```
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
### 7. ControlNet (구조 보존)
```python
from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel
cnet = ControlNetModel.from_pretrained("diffusers/controlnet-canny-sdxl-1.0", torch_dtype=torch.float16)
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", controlnet=cnet, torch_dtype=torch.float16,
).to("cuda")
img = pipe(prompt="oil painting", image=canny_img,
controlnet_conditioning_scale=0.7, num_inference_steps=30).images[0]
```
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
### 8. seed sweep (탐색)
```python
import torch, itertools
for seed, cfg in itertools.product([0,1,2,3], [4.0, 6.0, 8.0]):
g = torch.Generator("cuda").manual_seed(seed)
img = pipe(prompt=prompt, guidance_scale=cfg, generator=g).images[0]
img.save(f"seed{seed}_cfg{cfg}.png")
```
- **과거 데이터와의 충돌:** 없음
- **정책 변화:** 없음
### 9. scheduler 교체
```python
from diffusers import DPMSolverMultistepScheduler
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
pipe.scheduler.config, algorithm_type="dpmsolver++", use_karras_sigmas=True,
)
```
## 🕓 변경 이력 (Changelog)
### 10. ComfyUI API workflow (JSON 단편)
```json
{
"3": { "class_type": "KSampler",
"inputs": { "seed": 42, "steps": 30, "cfg": 6.5,
"sampler_name": "dpmpp_2m_sde", "scheduler": "karras",
"denoise": 1.0, "model": ["4",0], "positive": ["6",0],
"negative": ["7",0], "latent_image": ["5",0] } }
}
```
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
## 매 결정 기준
| 상황 | Approach |
|---|---|
| SDXL 기본 | DPM++ 2M Karras, 30 steps, CFG 6-7 |
| FLUX-dev | Euler, 28 steps, guidance 3.5 |
| FLUX-schnell / Turbo / LCM | Euler, 1-4 steps, guidance 0 |
| 사진 사실성 | CFG 4-6, negative_prompt 충실 |
| 스타일 강조 | LoRA 0.7-0.9 + CFG 6-8 |
| 구조 고정 | ControlNet, scale 0.6-0.8 |
| 배치 탐색 | seed sweep + grid |
**기본값**: SDXL = DPM++ 2M Karras, 30 steps, CFG 6.5. FLUX-dev = Euler, 28 steps, guidance 3.5.
## 🔗 Graph
- 부모: [[Diffusion-Models]] · [[Generative-AI]]
- 변형: [[Sampler-Schedulers]] · [[Prompt-Weighting]]
- 응용: [[ControlNet]] · [[LoRA]] · [[IP-Adapter]]
- Adjacent: [[Stable-Diffusion]] · [[FLUX]] · [[ComfyUI]] · [[A1111]]
## 🤖 LLM 활용
**언제**: 파라미터 매핑 (UI ↔ API), prompt → weighted prompt 변환, sampler 선택 가이드, batch grid 코드 생성.
**언제 X**: 모델별 quirk (예: SD3.5 의 specific shift) — 모델 카드 직접 확인.
## ❌ 안티패턴
- **CFG 무작정 12 이상**: burn-out, oversaturated.
- **steps 100+**: 30-50 이후 거의 무차이, 비용만 증가.
- **FLUX 에 CFG 7**: distilled — guidance 1-4 가 정상.
- **seed 미고정 디버깅**: 재현 불가 → 파라미터 영향 분석 불가.
- **Negative prompt 남용**: SDXL/FLUX 는 짧게, 또는 비워도 OK.
- **prompt weighting 과용**: `(word:2.0)+` → broken composition.
## 🧪 검증 / 중복
- Verified (HuggingFace diffusers docs, FLUX model card, ComfyUI wiki 2026).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — sampler/CFG/LoRA/ControlNet 코드 패턴 |