| name | review-transform |
| description | Run the full shared Codex review checklist against a transform. Use when the user asks to review, audit, or check a transform for correctness, performance, or API consistency. |
Review Transform
Run these checks in order. Report issues with severity: 🔴 Critical, 🟡 Important, 🟢 Suggestion.
1. Dead Code (🔴 Critical)
- Any methods defined but never called within the class or externally
- Unused imports at the top of the file
- Unreachable branches (
if False:, conditions that can never be true)
2. Correctness
- Mathematical/logical errors in the transform
- Off-by-one errors in coordinate handling
- Incorrect dtype preservation (uint8 in → uint8 out, float32 in → float32 out)
- BBox/keypoint coordinate correctness after spatial transforms
- Do not request 2D grayscale compatibility for Compose paths: images and volumes are channel-last with explicit channels
(
(H,W,C), (N,H,W,C), (D,H,W,C), (N,D,H,W,C)), and grayscale is (H,W,1).
- Never auto-detect bbox type from column count — type comes from
BboxParams.bbox_type
- For OBB: never use raw
cv2.minAreaRect output; use cv2.boxPoints then polygons_to_obb
3. API Consistency (🔴 Critical)
4. Random Number Generation (🔴 Critical)
5. Type Safety (🔴 Critical)
6. Performance (🟡 Important)
Priority order to check:
cv2.LUT used for pixel lookup operations (fastest)
albucore.resize not cv2.resize for image resizing (handles 5+ channels, INTER_AREA, etc.)
cv2 over numpy for image ops where applicable
- Vectorized numpy instead of Python loops
- In-place ops where safe (avoid unnecessary
.copy())
- No repeated array allocations in tight loops
- Expensive computations cached in
get_params / get_params_dependent_on_data
Batch Optimization Checks
Flag any violations with a concrete speedup suggestion.
7. Documentation (🟡 Important)
8. Test Coverage (🟡 Important)
9. Code Quality (🟢 Suggestion)
Reporting Format
## Review: <TransformName>
### 🔴 Critical
- **Dead code**: `_unused_method` is never called (line 42)
- **API**: Parameter `fill_value` should be `fill`
### 🟡 Important
- **Performance**: Use `cv2.LUT` instead of numpy indexing for pixel mapping (5-10x faster)
- **Docs**: Missing `Examples` section in docstring
### 🟢 Suggestions
- Consider using relative `noise_range` instead of absolute pixel values