Module 02 Activity
Scenario
The images have to become arrays a model can consume, and every step of that discards something.
What you build
A loading pipeline that detects format from bytes, rejects with reasons, and matches the compression and resolution of production images.
Steps
- Detect format from the file header rather than the extension. Find or construct one mismatched file and confirm it is handled.
- Measure what your target resize destroys: take your smallest feature and report its size in pixels before and after.
- Convert a sample to HSV and grayscale. Say which space suits your task and why.
- Save one image at three JPEG qualities and measure the pixel error. Compare against the quality production images arrive at.
- Write a loader that returns a reason for every rejection, and count rejections by kind over the whole folder.
- Report the rejection rate per source.
Evidence to hand in
- The header-based detection with one mismatched file handled.
- Your smallest feature's size before and after resize.
- The colour space choice with its reason.
- The compression comparison against production quality.
- Rejection counts by kind and by source.
Review checklist
- Format comes from the bytes, not the filename.
- The smallest feature's post-resize size is measured, not assumed.
- Training compression matches production compression.
- Every rejection carries a reason.
- Rejection rates are reported per source, not in aggregate.
