Skip to content

Report file, line and reason for skipped pose label lines (#873) - #876

Merged
EHxuban11 merged 2 commits into
devfrom
873-pose-label-diagnostics
Sep 18, 2026
Merged

EHxuban11 merged 2 commits into
devfrom
873-pose-label-diagnostics

Conversation

@EHxuban11

@EHxuban11 EHxuban11 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes the logging request left open by #873. Parsing rules are unchanged: the
same lines are still rejected.

What changed

  • YOLOPoseDataset names the label file, the line number and the actual reason
    for each skipped line, quoting the first 5 and counting the rest.
  • A non-numeric class id or coordinate is now reported as such. Previously one
    except ValueError covered both the length check and number parsing, so every
    rejection printed "field count does not match", including ones that were not
    about field count.
  • A wrong-length line says how many keypoints it carries and whether it matches
    the other kpt_shape keypoint dim.
  • PoseValidator._build_coco_gt_from_yolo dropped malformed ground-truth lines
    with no message at all, so reported mAP was computed over fewer objects than
    the user expected with nothing in the log. It now warns. Not part of Pose dataset loader drops label lines without saying which ones #873.
  • docs/dataset_schema.md and the module docstring state the accepted xy /xyv
    layouts and that a bad row is skipped alone, not the whole file.

Review notes

  • bbox and keypoints are now slices of one array instead of two separate
    np.array calls; they are disjoint views, and both call sites copy.
  • MAX_REPORTED_BAD_LINES = 5 caps log volume on a dataset with many bad rows.
  • format_bad_label_lines is imported by the validator, hence public.

Verification

  • New tests/unit/test_pose_label_diagnostics.py (9 tests): valid [K, 2] and
    [K, 3] layouts keep every line, the warning names file and line, a numeric
    error is not reported as field count, quoting is capped.
  • New test in tests/unit/test_pose_validator.py for the dropped ground truth.
  • pytest tests/unit -k "pose or dataset or validat": 876 passed, 29 skipped.
  • Not verified: no real training or validation run on a GPU.

Code provenance

Original code written for this PR. No third-party code was ported, adapted, or
derived. The changes are confined to error reporting in
libreyolo/data/pose_dataset.py and libreyolo/validation/pose_validator.py,
their tests, and documentation.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable failures remain in the reviewed changes.

Summary

This PR adds bounded, line-specific diagnostics when malformed YOLO pose labels are skipped during dataset loading or validation.

  • Reports the label file, line number, and actual parsing failure.
  • Limits quoted examples while retaining the total rejected-line count.
  • Warns when malformed validation ground truth is excluded from pose metrics.
  • Documents the accepted xy and xyv layouts and row-level rejection behavior.
  • The previous non-finite class-ID failure is fixed by translating OverflowError into the parser's existing ValueError contract.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Pose label row] --> B{Field count valid?}
    B -->|No| E[Record file, line, and reason]
    B -->|Yes| C{Class and coordinates parse?}
    C -->|No| E
    C -->|Yes| D[Add pose annotation]
    E --> F[Skip only malformed row]
    F --> G[Emit bounded warning summary]
    D --> H[Training or pose evaluation]
Loading

Reviews (2) · Last reviewed commit: "Skip non-finite pose class ids instead o..."

Comment thread libreyolo/data/pose_dataset.py
YOLOPoseDataset and PoseValidator dropped label lines behind a summary
count that always blamed the field count, so a non-numeric field was
misreported and no file or line was named.

- quote the first 5 offending lines as file:line: reason
- distinguish field count, non-numeric class id and non-numeric coordinate
- hint how many keypoints a wrong-length line carries, and whether it
  matches the other kpt_shape keypoint dim
- warn about ground-truth lines pose validation drops from its metrics
- document the accepted xy / xyv layouts and the skip behaviour
int(float("inf")) raises OverflowError, not ValueError, so a label line
with class id inf / -inf / 1e400 crashed dataset construction and pose
validation instead of being skipped and reported. Greptile P1 on #876.
@EHxuban11
EHxuban11 force-pushed the 873-pose-label-diagnostics branch from 7cc6ef8 to 447670b Compare September 17, 2026 18:28
@EHxuban11
EHxuban11 merged commit e4a34f7 into dev Sep 18, 2026
14 checks passed
@EHxuban11
EHxuban11 deleted the 873-pose-label-diagnostics branch September 26, 2026 15:35
EHxuban11 added a commit that referenced this pull request Sep 26, 2026
int(float("inf")) raises OverflowError, not ValueError, so a label line
with class id inf / -inf / 1e400 crashed dataset construction and pose
validation instead of being skipped and reported. Greptile P1 on #876.
EHxuban11 added a commit that referenced this pull request Sep 26, 2026
Report file, line and reason for skipped pose label lines (#873)
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.

1 participant