Generates equal keras models with the desired data format
Project description
Keras data format converter
Generates equal keras models with the desired data format
Requirements
tensorflow >= 2.0
API
convert_channels_first_to_last(model: keras.Model, inputs_to_transpose: List[str] = None, verbose: bool = False) -> keras.Model
convert_channels_last_to_first(model: tf.keras.Model, inputs_to_transpose: List[str] = None, verbose: bool = False) \ -> tf.keras.Model
model
: Keras model to convert
inputs_to_transpose
: list of input names that need to be transposed due tothe data foramt changing
verbose
: detailed output
Getting started
from tensorflow import keras
from keras_data_format_converter import convert_channels_last_to_first
# Load Keras model
keras_model = keras.models.load_model("my_image_model")
# Call the converter (image_input is an input that needs to be transposed, can be different for your model)
converted_model = convert_channels_last_to_first(keras_model, ["image_input"])
Supported Layers with Special handling
- Normalization layers
- Permute
- Reshape
- Concatenate
- Dot
- MultiHeadAttention
- TFOpLambda (Inserted by the Functional API construction whenever users call a supported TF symbol on KerasTensors, see here at Tensorflow repo for more info)
Unsupported Layers due to lack of data_format property
- Cropping1D
- Upsampling1D
- Zeropadding1D
- All layers in tensorflow.keras.preprocessing
How to deploy
- Create a new release version on GitHub
- Update parameters in setup.py (usually
version
anddownload_url
) - Run
python setup.py sdist
in root directory - Run
pip install twine
- Run
twine upload dist/*
License
This software is covered by MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for keras-data-format-converter-0.0.17.dev1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c035adfe360d1976b48571a585ae4d880c3a89a9bb30ef22d6e4db361d04fa0b |
|
MD5 | 68cfc9bb3235e1e4003ad3baa1be6d56 |
|
BLAKE2b-256 | 95761cf798c65fb442334d27689328e145b617e152656bbdbdd523b2e65d48f9 |
Close
Hashes for keras_data_format_converter-0.0.17.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f441a830ed3ce1fa160b970ec0800670245e3a22a71337363af6ac937a41ceec |
|
MD5 | 14ce6628d905b4f6aea7b6852003f95e |
|
BLAKE2b-256 | 877a2e9b68c3b32f506fe9e8576c7ccb2c60d96d91dc4d3bd9011269419398d7 |