Skip to main content

A fast and efficient implimentation of progressive sprinkles augmentation.

Project description


Sprinkles augmentation implemented in TensorFlow

Based on Less Wright's Medium article, Progessive Sprinkles: a New Data Augmentation for CNNs. See also his post on

To install:

pip install tf_sprinkles

To use:

from tf_sprinkles import Sprinkles
sprinkles = Sprinkles(num_holes, side_length)

Then call sprinkles(image) in the input pipeline for your image. A simple example to get started using the cat.jpeg image located in the data folder is:

import numpy as np
import tensorflow as tf
from tf_sprinkles import Sprinkles
from PIL import Image
from matplotlib import pyplot as plt

sprinkles = Sprinkles(num_holes=100, side_length=10)
img ='data/cat.jpeg')
img = np.asarray(img) / 255.
result = sprinkles(tf.constant(img, dtype=tf.float32))

Which results in the following image with sprinkles.

cat with sprinkles

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tf-sprinkles, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size tf_sprinkles-1.0.3.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page