Skip to content

fix(core): Fix detection metric bugs and add classwise/weighted mean features#11

Open
Go-MinSeong wants to merge 22 commits intodevfrom
fix/metric-bugs-and-improvements
Open

fix(core): Fix detection metric bugs and add classwise/weighted mean features#11
Go-MinSeong wants to merge 22 commits intodevfrom
fix/metric-bugs-and-improvements

Conversation

@Go-MinSeong
Copy link
Collaborator

Summary

Detection 메트릭 계산 버그 4개 수정 및 신규 기능 2개 추가.

Bug Fixes

  • Bug 1 (Critical): 예측=0, GT>0 이미지에서 true_class_ids 이중 등록 → recall이 절반으로 계산되던 문제 수정 (if/ifif/elif/else 체인)
  • Bug 2 (Critical): 예측>0, GT=0 이미지에서 FP가 stats에 등록되지 않아 precision 과대평가되던 문제 수정
  • Bug 3 (Medium): Precision50이 IoU=0.5~0.95 전체 평균을 사용하던 문제 → IoU=0.5(index 0)만 사용하도록 수정
  • Bug 4 (Medium): classwise_metric_meters가 에포크 간 리셋되지 않아 값이 누적되던 문제 수정

New Features

  • Feature 5: Train phase에도 classwise 메트릭 표시 지원
  • Feature 6: 클래스별 GT 인스턴스 수로 가중 평균한 weighted_mean 추가 (All / All (weighted) 두 행 표시)
  • Evaluation fix: Evaluation pipeline에서 weighted_mean이 classwise 변환 시 누락되던 문제 수정

Modified Files

File Change
metrics/detection/metric.py Bug 1+2 (if/elif chain), Bug 3 (Precision50 IoU index), Feature 6 (weighted mean)
metrics/base.py Bug 4 (classwise reset), weighted_meter, result() train classwise
metrics/builder.py Feature 5 (train classwise 활성화)
pipelines/train.py Feature 5 (train classwise name 변환)
pipelines/evaluation.py weighted_mean 누락 수정
loggers/stdout.py All (weighted) 행 추가

hglee98 and others added 22 commits June 11, 2025 08:59
…onfig

Add configuration files for YOLOv9 Tiny model training from scratch
Bug fixes:
- Bug1: Fix double-registration of true_class_ids when pred=0 and GT>0 (if→elif chain)
  causing recall to be ~half the correct value
- Bug2: Register FP predictions when GT=0 so precision is not over-estimated
- Bug3: Fix Precision50 to use IoU=0.5 (index 0) instead of all IoU thresholds average
- Bug4: Reset classwise_metric_meters each epoch in MetricFactory.reset_values()

New features:
- Feature5: Enable classwise metrics for train phase (not only valid)
- Feature6: Add weighted_mean (instance-count weighted) alongside unweighted mean
  for all detection metrics; display as 'All (weighted)' row in stdout logs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
log_end_evaluation() was explicitly copying only 'mean' key when converting
classwise class numbers to names, silently dropping 'weighted_mean'.
Use dict comprehension to preserve all non-classwise keys (mean, weighted_mean, etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants