Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keras - flow_from_directory function - target_size parameter

Tags:

Keras has this function called flow_from_directory and one of the parameters is called target_size. Here is the explanation for it:

target_size: Tuple of integers (height, width), default: (256, 256). 
The dimensions to which all images found will be resized.

The thing that is unclear to me is whether it is just cropping the original image into 256x256 matrix (in this case we do not take the entire image) or it is just reducing the resolution of the image (while still showing us the entire image)?

If it is -let's say - just reducing the resolution: Assume that I have some xray images with the size 1024x1024 each (for breast cancer detection). And if I want to apply transfer learning to a pretrained Convolutional Neural Network which only takes 224x224 input images, will I not be loosing important data/information when I reduce the size of the image (and resolution) from 1024x1024 down to 224x224? Isn't there any such risk?

Thank you in advance!

like image 862
edn Avatar asked May 21 '18 06:05

edn


1 Answers

  1. Reducing the resolution (risizing)
  2. Yes, you are loosing data

The best way for you is to rebuild your CNN to work with your original image size, i.e. 1024*1024

like image 65
RafaelJan Avatar answered Oct 04 '22 19:10

RafaelJan