COCO animals dataset and pre-processing images
For our examples, we shall use the COCO animals dataset, which is a smaller subset of the COCO dataset made available by the researchers at the Stanford University at the following link: http://cs231n.stanford.edu/coco-animals.zip. The COCO animals dataset has 800 training images and 200 test images of 8 classes of animals: bear, bird, cat, dog, giraffe, horse, sheep, and zebra. The images are downloaded and pre-processed for the VGG16 and Inception models.
For the VGG model, the image size is 224 x 224 and the preprocessing steps are as follows:
- Images are resized to 224 x 224 with a function similar to the
tf.image.resize_image_with_crop_or_pad
function from TensorFlow. We implemented this function as follows:
def resize_image(self,in_image:PIL.Image, new_width, new_height, crop_or_pad=True): img = in_image if crop_or_pad: half_width = img.size[0] // 2 half_height = img.size[1] // 2 half_new_width = new_width...