Project Description:

This project was about practicing the basic image processing function and assembling them into a data augmentation pipeline for training models. The basic image processing techniques, such as image resizing, image cropping, color manipulation, image rotation, and rotation without black pixels, were implemented in the porj1.ipynb and student_code.py. Last, we will compose all the transforms and the data will be input pipeline.

What excited me from this project:

  1. Image Resizing: Adaptive resizing is implemented in this project. The Scale class will resize the image to match its shortest size and rescale the longest side with a particular ratio.

  2. Image Cropping: RandomSizedCrop will crop a random area of the original size with a random aspect ration. This crop is finally resized to a fixed given size. However, this class is an advance version of image cropping. We will crop the patch in the center with a square sized out put after all the attempts trials fail.

  3. Color Jitters: A small pertubation in the color space can leas to imaged with drastically different pixel values, yet are still perceptually meaningful. RandomColor class will implement color jitters. First, we will sample the alpha from a uniform distribution U(1-r, 1+r) and then alpha is mulitpled to the corresponding color channel. Improvment is this class: Create a lookup table, so we can look up each channel. We make sure all the pixel value is between the range 0 - 255 uing np.unit8

  4. Random Rotate + Cropping: We can simply rotate an image uing the function. However, this function will create the black pixels in the result image. The ideal situation is that we want to avoid these black pixels.RandomRotate class is able to crop the rotated image without black pixel by applying some math - sin, cos. The goal is to get the max area rectangular within the rotated image. We will apply the math to do this implementation.

    reference: stackoverflow.com/questions/16702966/rotate-image-and-crop-out-black-borders

    ζˆͺεœ– 2022-12-24 δΈ‹εˆ2.57.16.png

Result image:

loader_outputs_0-0.jpg

loader_outputs_0-1.jpg

loader_outputs_1-0.jpg

loader_outputs_1-1.jpg

outputs_0.jpg

outputs_1.jpg

Please visit here to view the details of the project.