Match YOLOX and DAMO-YOLO preprocessing to upstream - #24
Conversation
Upstream's own test transforms are now the source of truth for both families: YOLOX's data_augment.preproc and DAMO-YOLO's December 2022 Resize + to_image_list (tinyvision/DAMO-YOLO 55ae14f). Both truncate the resized size with int(w * r), where we rounded; DAMO-YOLO also decodes with PIL and restores boxes per axis (BoxList.resize) rather than by one ratio. - Add LetterBoxLayout (center, size_rounding, per_axis_ratio), read by letterbox_layout(pre_cfg) and threaded through every shape-only geometry path: PostBase.ratio_pads_for, Results plotting, dense crops, semantic targets and DOTA ground truth. The center-boolean form still works. - LetterBox accepts size_rounding / per_axis_ratio and PIL images; _spatial_shape reads a PIL image's size so img0_shape stays the original. - scale_boxes / scale_coords divide x and y by their own ratio; rotated boxes, instance segmentation and OBB reject options they cannot restore. - YOLOX YAMLs: size_rounding: floor. DAMO-YOLO YAMLs: Reader.style: pil, size_rounding: floor, per_axis_ratio: true. - Tests compare both pipelines pixel-for-pixel with inlined upstream code. - Bump __version__ to 0.0.6 for the mblt-model-ops parity pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Codex review
Verdict
center= keyword was removed. Fix before merge; focused tests could not run because pytest is unavailable.
Suggested next steps
- Fix the DAMO-YOLO evaluation decode path and add a JPEG parity test through
get_coco_loader. - Restore
center=compatibility, then run the focused/full pytest suite and remeasure or label the documented COCO scores as historical.
Trigger: pull_request
- CustomCOCODataset takes decoder="cv2" | "pil", and eval_coco picks PIL for a Reader.style: pil model. The loader decodes before preprocessing, so DAMO-YOLO evaluation was still fed OpenCV's pixels. - letterbox_semantic_mask, get_ade20k_loader, get_cityscapes_loader, LetterBoxGeometry.from_shapes and resolve_ratio_pad accept the old center= keyword again, with a DeprecationWarning; passing both raises TypeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@mobilint-review Re-review after 28d9549, which fixes both earlier findings (COCO evaluation now decodes with the model's Reader library; the deprecated Context and intentional decisions, so the review need not re-litigate them:
|
There was a problem hiding this comment.
Codex review
Requested by @parkjinman98.
Verdict
The geometry and COCO decoder changes look correct, but the deprecated center= compatibility shim is still incomplete for renamed geometry helpers.
Suggested next steps
- Add the deprecated
center=alias to the remaining renamed helpers. - Add regression tests that call every renamed helper with
center=False.
Trigger: issue_comment
Source: #24 (comment)
resolve_ratio_pads, _apply_letterbox and DOTA's _ratio_pad_for_shape / _ground_truth_to_input_space route center= through deprecated_center_argument like the public helpers; one parametrized test calls every renamed callable with center=False, layout=..., and both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@mobilint-review Re-review after 4020e81, which completes the deprecated
The guide from the previous request still applies:
Please focus on any remaining correctness or test issues. |
There was a problem hiding this comment.
Codex review
Requested by @parkjinman98.
Verdict
One remaining compatibility defect exists in the deprecated center= shim.
Suggested next steps
- Use a sentinel to distinguish an omitted layout from explicit layout=True.
- Extend the parametrized compatibility test to cover layout=True together with center.
Trigger: issue_comment
Source: #24 (comment)
The nine shimmed signatures default layout to None, so layout=True together with center= raises TypeError like any other layout instead of silently taking center. Omitted still means Ultralytics' default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@mobilint-review Re-review after 54f00b5, which fixes the shim's handling of an explicit
The earlier guide still applies:
Please focus on any remaining correctness or test issues. |
Summary
Upstream's own test transforms are now the source of truth for YOLOX and DAMO-YOLO
pre_cfg, replacing mblt-model-ops'pipeline.yaml(which no code there consumes yet).data_augment.preproc)55ae14f)int(w*r)(truncate)int(w*r)(truncate)round(half-even)/ rBoxList.resize)/ rfor bothChanges
LetterBoxLayout(center, size_rounding, per_axis_ratio)plusletterbox_layout(pre_cfg). These are threaded through every path that derives geometry from shapes alone:PostBase.ratio_pads_forResultsplottingPassing a plain
centerboolean still works.The
LetterBoxop acceptssize_rounding: floor,per_axis_ratio: trueand PIL images._spatial_shapenow reads a PIL image's size, soimg0_shapestays the original shape.scale_boxesandscale_coordsdivide x and y by their own ratio. Uniform layouts are unchanged, since both ratios are equal.Options a task cannot restore now fail loudly:
floorandper_axis_ratio;per_axis_ratio.YAML changes:
size_rounding: floor.Reader.style: pil,size_rounding: floor,per_axis_ratio: true.AGENTS.md, themblt-visionskill andmblt_vision/README.mdare updated in the same commit.__version__is bumped to 0.0.6 so mblt-model-ops' parity pin can move to it.Test plan
build_preprocess(<model YAML>)pixel-for-pixel with inlined copies of the upstream code. They cover YOLOX-s, YOLOX-Nano and DAMO-YOLO-T, on shapes where truncation and rounding differ. DAMO-YOLO goes through a real JPEG decoded by PIL./ rfor YOLOX,BoxList.resizeper axis for DAMO-YOLO.pytest: 735 passed. 5 failed intests/test_onnx_yolo.py, which download from the Hub; they fail identically onmain.pre-commit(ruff 0.6.9) andgit diff --check.r = 1), so the expected change is small.🤖 Generated with Claude Code