Skip to main content

Image preprocessor for convolutional neural networks

Project description

Image Preprocessor

Simple image preprocessor I made while working on my first Keras binary classification convolutional neural network. Converts images from specified directories into NumPy arrays. Its functionality will be expanded out of necessity.

Installation

Install through pip as shown:

pip install image-preprocessor

Example usage

from image_preprocessor import ImagePreprocessor

# Vehicle-label correlations
vehicle_types = {
    0 : 'boat',
    1 : 'car',
    2 : 'motorcycle',
    3 : 'plane'
}

# Create the ImagePreprocessor object
ip = ImagePreprocessor(
    pixels=64,
    normalization=255,
    training_threshold=0.7,
    resize_method='square resize',
    color_mode='L'
)

# Prepare the images in select directories
package = ip.preprocess_dirs(
    paths=['images/boat', 'images/car', 'images/motorcycle', 'images/plane'],
    labels=[0, 1, 2, 3],
    partition=True
)

# Go on and do your neural network stuff 
train_features = package['TRAIN_IMAGES']
train_labels = package['TRAIN_LABELS']
test_features = package['TEST_IMAGES']
test_labels = package['TEST_LABELS']

Project details


Download files

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

Source Distribution

image-preprocessor-0.1.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

image_preprocessor-0.1.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page