Refactor Object Detection Transforms#835
Conversation
|
/review |
liopeer
left a comment
There was a problem hiding this comment.
I think in terms of hierarchy we need to discuss, because some hierarchy decisions are difficult to follow (e.g. PicoDetTransform inheriting from LTDETRTransform). We also now have imo to many levels of inheritance (we have the base transform, then LT-DETR transform and the specialized ones on top. One level is okay, but two are imo too much. Instead of inheriting anything from the first level, that first level should be completely abstract (protocols or ABCs).
|
Instead of using three-level inheritance with the shared logic as the intermediate child (refused bequest issue of refactoring), the common step-aware control logic is moved into reusable components in The new structure is split as follows:
The commit also fixes oriented object detection after removing the old LT-DETR base module. Note that PicoDet still inherits from the LT-DETR object detection transform stack, which is confusing and should be cleaned up in a follow-up PR. |
liopeer
left a comment
There was a problem hiding this comment.
Already quite a bit clearer. Would encourage to fix the inconsistencies in a follow-up, but would first focus on actually implementing the instance segmentation stuff.
51848b5 to
4bef13d
Compare
What has changed and why?
Refactored the LT-DETR object detection transform implementation into a shared
ltdetr_transformspackage with separate components for step-aware control, object detection, and utility modules. Updates all the relevant task model call sites to use the new structure while preserving the existing object detection behavior.The new structure is split as follows:
ltdetr_transforms/components.pycontains the reusable runtime pieces for LT-DETR-style transforms: step activation tracking, dataloader reinitialization checks, cached sample transform construction, and mosaic activation handling.ltdetr_transforms/object_detection.pycontains the object-detection transform and collate-function implementation, including input/output types, transform args contract, bbox normalization, degenerate-box filtering, mixup/copyblend/scale-jitter handling, and batch transform wiring.ltdetr_transforms/utils.pycontains helper functions for image-size resolution, activation schedules, albumentations transform ordering, bbox conversion/filtering, and normalization.The LT-DETR task-model transform modules now define task-specific defaults close to the task models, while reusing the object-detection transform/collate implementation and the shared components.
Also refactored the unit test accordingly.
How has it been tested?
Parity verified by AI.
Did you update CHANGELOG.md?
Did you update the documentation?