Skip to content


An image preprocessing and augmentation library with Keras like interface.

Hocrox Code Check Maitained PyPI - Downloads PyPI GitHub closed pull requests GitHub issues GitHub


Hocrox is an image preprocessing and augmentation library. It provides a Keras like simple interface to make preprocessing and augmentation pipelines. Hocrox internally uses OpenCV to perform the operations on images. OpenCV is one of the most popular Computer Vision library.

Here are some of the highlights of Hocrox:

  • Provides an easy interface that is suitable for radio pipeline development
  • It internally uses OpenCV
  • Highly configurable with support for custom layers

The Keas interface

Keras is one of the most popular Deep Learning library. Keras provides a very simple yet powerful interface that can be used to develop start-of-the-art Deep Learning models.

Check the code below. This is a simple Keras code to make a simple neural network.

model = keras.Sequential()
model.add(layers.Dense(2, activation="relu"))
model.add(layers.Dense(3, activation="relu"))

In Hocrox, the interface for making pipelines is very much similar. So anyone can make complex pipelines with few lines of code.


Here is one simple pipeline for preprocessing images.

from hocrox.model import Model
from hocrox.layer.preprocessing.transformation import Grayscale, Resize, Padding
from hocrox.layer import Read, Save

# Initializing the model
model = Model()

# Adding model layers
model.add(Resize((100, 100), name="Resize Layer"))
model.add(Grayscale(name="Grayscale Layer"))
model.add(Padding(10, 20, 70, 40, [255, 255, 255], name="Padding Layer"))
model.add(Save("preprocessed_images/", format="img", name="Save image"))

# Printing the summary of the model

# Apply transform to the images