Skip to main content

Extended utilities for Keras

Project description

Keras Utils

This package provides utilities for Keras, such as modified callbacks, genereators, etc.

Installation

To install the package from the PyPi repository you can execute the following command:

pip install keras-utils

Usage

The usage of the package is simple:

import keras
import keras_utils

# build your model
model = get_model(input_shape, num_classes=num_classes, reserve_layers=reserve_layers)

# build your train-set & validation-set generators
train_generator = ImageDataGenerator().flow_from_directory(
        train_images_path,
        target_size=target_size,
        batch_size=batch_size,
        color_mode='rgb',
        class_mode='categorical',
        seed=seed,
        shuffle=True
)

valid_generator = ImageDataGenerator().flow_from_directory(
        valid_images_path,
        target_size=target_size,
        batch_size=1,
        color_mode='rgb',
        class_mode='categorical',
        shuffle=False
)

# create a validation-callback which tests the validation-set every 10 epocks
valid_callback = ValidateCallback(10, valid_generator, model)

# create a save-callback which saves the model every 20 epochs under the name "model_name"
save_callback = SaveCallback(20, 'model_name.model', model)

# train your model
model.fit_generator(generator=train_generator,
                    epochs=epochs,
                    verbose=1,
                    workers=8,
                    callbacks=[valid_callback, save_callback])

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

keras-utils-1.0.13.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file keras-utils-1.0.13.tar.gz.

File metadata

  • Download URL: keras-utils-1.0.13.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

File hashes

Hashes for keras-utils-1.0.13.tar.gz
Algorithm Hash digest
SHA256 2e0269412869b38a321356421bfc12f5787e37752601dd2c000b6d87d86a5a7a
MD5 e281eb73ee99fa2419fd5cef3b3d766e
BLAKE2b-256 31a28be2aee1c8cd388e83d447556c2c84a396944c8bad93d710c5e757f8e98e

See more details on using hashes here.

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