Repository navigation
feat: 측정값 기반 위험도 분석(risk-lab) 추가 - #63
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
기본값은 기존 llm이다. http에서는 점수를 고정 공식으로 계산하고 역검색 항목은 뺀다. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
jyx-07
reviewed
Nov 9, 2026
jyx-07
left a comment
Collaborator
There was a problem hiding this comment.
리뷰
머지 전 수정 필요
- OOM 위험 —
MAX_PIXELS=80M인데 컨테이너 mem_limit은 384m입니다.analyze()가 원본 해상도 복사본을 여러 개 만들어서 40~50MP JPEG 한 장이면 500MB 이상 필요하고, 컨테이너가 죽으면 대기 중인 요청이 전부 실패합니다. 상한을 낮추거나 디코딩 직후 축소해 주세요. 탐지에는 축소 이미지만 쓰는데 원본 크기 BGR 변환도 만들고,imageSharpness는 Java에서 안 씁니다. - http 모드에서 HIGH 불가에 가까움 — 3개 항목 평균에 GPS 없으면 metadata=10 고정이라 최대 70점이고, quality·exposure 둘 다 정확히 100이어야 HIGH입니다.
- 4xx를 서버 오류로 처리 — risk-lab의 400(디코딩 실패)/413(해상도 초과)도
ANALYSIS_UNAVAILABLE→AI_SERVER_ERROR("다시 시도")로 안내됩니다. 재시도해도 항상 실패하니 클라이언트 오류는 따로 매핑해 주세요.
개선 권장
- Java가 20초에 타임아웃돼도 risk-lab은 분석을 계속하고 세마포어(동시성 1)를 쥐고 있어서, 요청이 몰리면 대기열이 풀리지 않습니다.
_measure에서 x0/y0를 0 아래로만 막아서, 가장자리에 걸친 얼굴이면 이미지 밖에 1x1 박스가 생깁니다.faces/factors/recommendations가 모두 EAGER ElementCollection이라 얼굴 10개면 조회 1번에 약 120행이 조인됩니다(폴링마다 반복).@Fetch(SUBSELECT)또는 LAZY를 권장합니다.- 얼굴 개수 제한이 Python(topK=5000)과 Java(MAX_FACES=10) 두 곳에 나뉘어 있습니다. Python 쪽에서 한 번에 자르는 게 좋겠습니다.
buildClient/isTimeout/multipart 코드가HttpDeepfakeDetector와 중복됩니다.requirements.txt주석의scripts/risk-eval은 존재하지 않고(실제는risk-lab/eval_faces.py),LlmRiskAnalyzerjavadoc의 "유일한 빈" 설명은 이제 사실이 아닙니다.
… 이미지 안으로 맞춘다 4천만 화소 이미지의 최대 메모리가 574MB에서 JPEG 174MB, PNG 269MB로 줄었다. 해상도 상한은 8천만에서 4천만 화소로 낮췄다. 분석 자리를 5초 안에 얻지 못하거나 호출한 쪽이 끊었으면 503으로 돌려 줄이 쌓이지 않게 한다. 얼굴 개수 제한은 risk-lab에서만 하고 검출한 전체 수는 faceCount로 알린다. 서버가 쓰지 않는 imageSharpness는 뺐다. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
위치 정보가 없으면 메타데이터 10점 고정 때문에 단순 평균은 70이 한계였다. 품질 40%, 노출도 40%, 메타데이터 20%로 계산한다. risk-lab이 400/413으로 거절한 것은 다시 시도해도 같으므로 서버 오류가 아니라 파일 형식·크기 오류로 매핑하고, 접수 후 조회에서는 실패 사유 INVALID_IMAGE로 남긴다. 서버의 얼굴 개수 제한을 없애고 risk-lab이 정한 개수를 그대로 쓴다. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfUPGxfx9b1wA61pUbijb6
jyx-07
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 내용
측정값 기반 위험도 분석 (
risk-analysis.mode=http)llm이라 켜지 않으면 동작이 바뀌지 않음risk-lab/(FastAPI + OpenCV): YuNet 얼굴 검출(OpenCV Model Zoo, MIT)과 얼굴별 면적 비율·짧은 변 px·선명도·정면도 측정. 점수는 매기지 않고 측정값만 반환HttpRiskAnalyzer,RiskScoring: 측정값을 고정 공식으로 점수화하고 설명에 근거 측정값 표기(ko/en/ja/zh-CN)LlmRiskAnalyzer는 mode=llm(기본)일 때만 빈 등록, GPS 판독은GpsMetadata로 분리docker-compose.yml에risk서비스(프로필risk, 포트 미게시),application.yml에risk-analysis.*추가문서
docs/risk-analysis.md: 두 방식 비교와 점수 공식, 한계docs/detect-calibration.md,scripts/detect-calibration/: 탐지 점수 보정 실험 기록(서비스에는 적용하지 않음)확인 사항
남은 것 / 팀 결정 필요
deploy.yml)에는 아직 연결하지 않음. 켜려면docker compose --profile risk up -d --build risk와RISK_ANALYSIS_MODE=http가 필요하고, CI 이미지 빌드를 붙이는 건 후속 작업risk컨테이너 메모리 한도(384m)는 잠정값이라 배포 후docker stats로 조정 필요프론트 영향