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.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6fda9bf1a7852a4bca8d34a65c0e92093aa1b778b215f339236726808954044 |
|
MD5 | 09ab3c686906eed6c999a7bdb3df3b28 |
|
BLAKE2b-256 | 2147f5d8f26c41c54fe8726648a07bb9b8c0f79e259cfd28fe66ffcfd1d34ce1 |
Close
Hashes for keras_data_format_converter-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 049785216d5dd5fdbfc8d31a2208fd952e3af31a6628e1af79e950a3ca087839 |
|
MD5 | bdaf784ab35839cc709c3baded46c800 |
|
BLAKE2b-256 | a603f0d25266f1162a0f540f377e881718c0ed3b10468768843eef72dad2a952 |