ctuning / ck-tensorflow

Collective Knowledge components for TensorFlow (code, data sets, models, packages, workflows):
http://cKnowledge.org
BSD 3-Clause "New" or "Revised" License
93 stars 26 forks source link

added batch processing #129

Closed me2x closed 5 years ago

me2x commented 5 years ago

added the possibility to process batches in the object detection script. However, batch processing request a fixed image dimension, so I had to include a resizing of the processed images. This usually introduces a loss of precision in the network.

I changed the IMAGE_COUNT parameter, and it is now divided into 2 variables, BATCH_COUNT and BATCH_SIZE, with the number of processed images being the product of the two.

Other introduced parameter is the ENABLE_BATCH, that is set to false as default, to maintain the previous program ignoring all the resizing and modification for the batch run.

Moreover the resize is done giving 2 parameters, height and width, to support the possibility of resizing to non-squared images. to resize is used the LANCZOS algorithm of the pillow library. The API says that is an high-quality downsizing algorithm.

psyhtest commented 5 years ago

While PIL.Image.LANCZOS may be superior to PIL.Image.BILINEAR, it's incompatible with our current preprocessing (used e.g. in the TFLite program). So we will get different results in 3 cases:

I'm wondering if we should try native TF processing outside the graph? In this case, we should get the same precision but with batching enabled.