Skip to main content


Data preprocessing is a frequent first step in the deep learning pipeline. Image data is preprocessed using a variety of methods. Image resizing, converting images to grayscale, and image augmentation are some examples. Furthermore, different models may have different preprocessing settings. Because of that reason, Modelify allows you to write your own custom preprocess function.


In Image input, Modelify apply default preprocess script. This is because it must match the inputs of an image model coming into the API. For example; If a request is sent to the API with a 1000x500 image, your model needs to be resized according to its inputs. Then it needs to be converted to numpy format. Modelify does this automatically.


If you define your own preprocess function, Modelify's default preprocess function will not work.

Here is an example,

def my_preprocess(inputs):
.... # will be updated

my_input = Image(width=28, height=28,channel=1) # grayscale image
inference = ModelInference(model=model, framework="KERAS", inputs=my_input)

inference.preprocess = my_preprocess

Your postprocess function must take the inputs argument.