--- title: Preprocessing Lab emoji: 🔬 colorFrom: blue colorTo: pink sdk: gradio sdk_version: 6.28.0 app_file: app.py python_version: "3.12" short_description: See how preprocessing changes what a vision model sees startup_duration_timeout: 30m tags: - education - image-preprocessing - image-classification - instance-segmentation - resnet - yolo --- # Preprocessing Lab A teaching app about one idea: **a model only works on the input it was trained on.** One photo goes through preprocessing steps into ResNet50 (classify a pet) or YOLO11s-seg (find, outline and count objects). Every step shows its image, the exact Python code that ran, and why it exists. - **Preparation** steps are on: BGR→RGB, resize, crop or letterbox, normalize, channels first. Skip one and watch the model break (skip Normalize: the boxer becomes a "spotlight"). - **Break it** switches do what the real world does to photos: rotate, dark, blur, noise, low resolution. - **Fix it** switches are classic enhancement and restoration: gamma, histogram equalization, CLAHE, denoising, median filter, sharpening, straightening. Some bring the answer back; some can't (lost detail is gone for good). Keys: `←` `→` walk the pipeline, `1`–`6` break-it switches, `H` histogram, `E` explain & code. Source, notebook and tests: https://github.com/JustKamlesH21/image-preprocessing-demo Images: Oxford-IIIT Pet (CC BY-SA 4.0) and COCO 2017 (CC BY 4.0 annotations, Flickr image licenses). Models: ResNet50 (torchvision, BSD-3-Clause), YOLO11s-seg (Ultralytics, AGPL-3.0).