Custom Preprocessing Function with ImageDataGenerator

Abhay Shukla
Feb 16, 2021

--

In this code snippet, I will show you, how to write a custom preprocessing function to use with ImageDataGenerator to extract image patches, random selecting from predefined sizes.

Here we go!

Note that, for every image, we get either the complete image or a patch of it. The relative proportion of cases can be controlled by the parameter p. Also note that all patches are of square shape but that can be changed easily. So I leave that to you.

Thats it!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Abhay Shukla
Abhay Shukla

Written by Abhay Shukla

Data Science @ Meesho, Ex- Airtel, Swiggy, [24]7.ai https://www.linkedin.com/in/shuklaabhay/ #DataScience #ML #AI #Statistics #Reading #Music #Running

No responses yet

Write a response