Files
minsung 34a885bcf8 Initial publish: SamGeo3 multi-prompt segmentation lab.
Scripts, prompt JSON tiers, usage docs, and README. Input images
(data/) and segmentation outputs (output/) are gitignored.
2026-07-15 16:11:59 +09:00
..

Multi-object prompts (Grok + Gemini)

비전 분석 결과를 합친 SAM 3.1 / SamGeo3 텍스트 프롬프트 세트입니다.

파일 설명
dji_20260306_0016.json DJI 드론 정사 철도·산업 장면 (Grok+Gemini 병합)
dji_20260306_0044.json 0016 확장 (extends) + scene_delta (철로+도로+열차)

tier

tier 내용
compact 1차 실험용 19개 (기본)
gap 누락 보강 12개 (Gemini 재검토: road, dense forest, covered truck 등)
gap2 합본 빈 영역 보강 (다수 프롬프트)
gap2_core gap2 중 실측 성공 프롬프트만 (재실행 권장)
improved compact + gap 병합 (~31개)
A_high 1차 고확률
B_facility 시설·구조
C_detail 야적·지면·지붕색
D_rail_domain 철도 특화 (편차 큼)
E_missed gap 확장판 (동의어 포함)
all A→E 전부 (중복 제거)

기대 난이도 (정사 드론 기준)

프롬프트 기대 튜닝 팁
building, solar panel, tree, car, truck 높음 기본 객체. 낮은 confidence에서도 비교적 잘 잡힘
railway track, fence, parking lot, blue tarp 중~높음 선형·구획. context에 따라 변동
utility pole, container, material pile 작거나 밀집. --min-size로 노이즈 제거
rail, ballast, railroad sleeper, catenary 낮~중 도메인 용어·가는 객체. confidence 튜닝 필수

권장: confidence 0.25~0.35 로 시작.

단일 프롬프트 (text_segment.py)

cd D:\MYCLAUDE_PROJECT\samgeo3-lab
.\.venv\Scripts\Activate.ps1

$img = "data\DJI_20260306100802_0016.JPG"
# 또는: $img = "D:\MYCLAUDE_PROJECT\segment-geospatial\sample\DJI_20260306100802_0016.JPG"
$out = "output\dji_0016_analysis"

python scripts\text_segment.py `
  --image $img `
  --prompt "solar panel" `
  --confidence 0.3 `
  --output-dir $out

python scripts\text_segment.py `
  --image $img `
  --prompt "building" `
  --confidence 0.3 `
  --output-dir $out

python scripts\text_segment.py `
  --image $img `
  --prompt "railway track" `
  --confidence 0.3 `
  --output-dir $out

결과 예: output\dji_0016_analysis\DJI_..._solar_panel_mask.png

멀티 프롬프트 일괄 (multi_prompt_segment.py) — 이미 포함됨

모델·이미지를 1회 로드 후 프롬프트 루프. 결과는
output\<stem>_<tier>\{stem}_{prompt}_mask.png 등 + summary.json.

cd D:\MYCLAUDE_PROJECT\samgeo3-lab
.\.venv\Scripts\Activate.ps1

# 프롬프트 목록만
python scripts\multi_prompt_segment.py --list-only --tier compact

# compact 19개 일괄 (권장 1차)
python scripts\multi_prompt_segment.py `
  --image "data\DJI_20260306100802_0016.JPG" `
  --tier compact `
  --confidence 0.3 `
  --output-dir "output\dji_0016_compact"

# 누락 보강 (Gemini gap) — confidence 약간 낮게, 같은 폴더에 추가하면 merge에 포함
python scripts\multi_prompt_segment.py `
  --image "data\DJI_20260306100802_0016.JPG" `
  --tier gap `
  --confidence 0.25 `
  --output-dir "output\dji_0016_compact"

# 1차+보강 한 번에
python scripts\multi_prompt_segment.py --tier improved --confidence 0.28

# 1차 고확률만
python scripts\multi_prompt_segment.py --tier A_high --confidence 0.3

# 전체 tier
python scripts\multi_prompt_segment.py --tier all --confidence 0.25

# 직접 지정
python scripts\multi_prompt_segment.py `
  --prompts "solar panel,building,railway track,tree,car,truck" `
  --confidence 0.3 `
  --output-dir "output\dji_0016_analysis"

DJI_0044 = 이미지 1번(0016) 확장 (별도 체계 아님)

0016 base (compact/gap/gap2)  +  scene_delta(열차·도로·야적)  →  0044
# 상속 확인
python scripts\multi_prompt_segment.py --prompts-json prompts\dji_20260306_0044.json --list-only --tier compact
python scripts\multi_prompt_segment.py --prompts-json prompts\dji_20260306_0044.json --list-only --tier delta

# 0016과 동일한 파이프라인
python scripts\multi_prompt_segment.py `
  --prompts-json prompts\dji_20260306_0044.json `
  --image data\DJI_20260306100928_0044.JPG `
  --tier compact --confidence 0.3 `
  --output-dir output\dji_0044_compact

python scripts\multi_prompt_segment.py `
  --prompts-json prompts\dji_20260306_0044.json `
  --tier gap --confidence 0.25 `
  --output-dir output\dji_0044_compact

python scripts\merge_multi_results.py `
  --result-dir output\dji_0044_compact `
  --image data\DJI_20260306100928_0044.JPG

HTML: docs/dji_0044_prompts.html

예시: DJI_0100 전체 파이프라인 (compact → gap → gap2_core → merge)

0044 프롬프트 JSON(0016 상속 + 도로/열차 delta)을 0100 이미지에 적용하는 권장 end-to-end 예입니다. gap / gap2_core 단계는 선택입니다.

cd D:\MYCLAUDE_PROJECT\samgeo3-lab
.\.venv\Scripts\Activate.ps1

$img = "data\DJI_20260306101434_0100.JPG"
$out = "output\dji_0100_compact"
$json = "prompts\dji_20260306_0044.json"

# (선택) 프롬프트 목록 확인
python scripts\multi_prompt_segment.py --prompts-json $json --list-only --tier compact

# 1) 세그 — compact (0016 상속 + 도로/열차 delta)
python scripts\multi_prompt_segment.py `
  --prompts-json $json `
  --image $img `
  --tier compact `
  --confidence 0.3 `
  --output-dir $out

# 2) (선택) gap 보강
python scripts\multi_prompt_segment.py `
  --prompts-json $json `
  --image $img `
  --tier gap `
  --confidence 0.25 `
  --output-dir $out

# 3) (선택) gap2_core 보강
python scripts\multi_prompt_segment.py `
  --prompts-json $json `
  --image $img `
  --tier gap2_core `
  --confidence 0.22 `
  --output-dir $out

# 4) 합치기 + interactive index.html
python scripts\merge_multi_results.py `
  --result-dir $out `
  --image $img `
  --max-side 2048

# 5) 결과 열기
start "$out\merged\index.html"

권장 confidence: compact 0.3 → gap 0.25 → gap2_core 0.22.
같은 $out 폴더에 단계별로 마스크를 쌓은 뒤 merge하면 한 HTML에서 전부 볼 수 있습니다.

결과 합치기 (overlay + grid + HTML)

multi_prompt_segment 실행 후:

python scripts\merge_multi_results.py `
  --result-dir "output\dji_0016_compact" `
  --image "data\DJI_20260306100802_0016.JPG" `
  --max-side 2560

출력 (output\dji_0016_compact\merged\):

파일 내용
combined_overlay.png 전 클래스 색상 오버레이
combined_with_legend.png 오버레이 + 범례
per_class_grid.png 클래스별 썸네일 격자
index.html 브라우저로 한눈에 보기
merge_summary.json 클래스·픽셀 통계