This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# nolearn-utils

[![Build Status](](

Iterators and handlers for nolearn.lasagne to allow efficient real-time image augmentation and training progress monitoring

## Real-time image augmentation

- `ShuffleBatchIteratorMixin` to shuffle training samples
- `ReadImageBatchIteratorMixin` to transform image file path into image as color or as gray, and with specified image size
- `RandomFlipBatchIteratorMixin` to randomly (uniform) flip the image horizontally or verticaly
- `AffineTransformBatchIteratorMixin` to apply affine transformation (scale, rotate, translate) to randomly selected images from the given transformation options - `BufferedBatchIteratorMixin` to perform transformation in another thread automatically and put the result in a buffer (default size = 5)
- `LCNBatchIteratorMixin` to perform local contrast normalization to images
- `MeanSubtractBatchIteratorMixin` to subtract samples from the pre-calculated mean

Example of using iterators as below:

train_iterator_mixins = [
TrainIterator = make_iterator('TrainIterator', train_iterator_mixins)

train_iterator_kwargs = {
'buffer_size': 5,
'batch_size': batch_size,
'read_image_size': (image_size, image_size),
'read_image_as_gray': False,
'read_image_prefix_path': './data/train/',
'flip_horizontal_p': 0.5,
'flip_vertical_p': 0,
'affine_p': 0.5,
'affine_scale_choices': np.linspace(0.75, 1.25, 5),
'affine_translation_choices': np.arange(-3, 4, 1),
'affine_rotation_choices': np.arange(-45, 50, 5)
train_iterator = TrainIterator(**train_iterator_kwargs)

The `BaseBatchIterator` is also modified from `nolearn.lasagne` to provide a progress bar for training process for each iteration

## Handlers

- `EarlyStopping` stops training when loss stop improving
- `StepDecay` to gradually reduce a parameter (e.g. learning rate) over time
- `SaveTrainingHistory` to save training history (e.g. training loss)
- `PlotTrainingHistory` to plot out training loss and validation accuracy
over time after each iteration with matplotlib

## Examples

Example code requires `scikit-learn`


`example/mnist/` should produce a model of about 99.5% accuracy in less than 50 epoch.

MNIST data can be downloaded from

### CIFAR10

CIFAR10 images can be downloaded from [Kaggle]( Place the downloaded data as follows:

├── data
│   ├── train
│ | ├── 1.png
│ | ├── 2.png
│ | ├── 3.png
│ | ├── ...
│   └── trainLabels.csv

`example/cifat10/` should produce a model at about 85% accuracy at 100 epoch. Images are read from disk and augmented at training time (from another thread)


- [ ] Embarrassingly parallelize transform

## License


Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nolearn_utils-0.1.dev0-py2-none-any.whl (14.2 kB) Copy SHA256 Checksum SHA256 py2 Wheel Aug 30, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting