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
File details
Details for the file keras_data_format_converter-0.1.17.tar.gz
.
File metadata
- Download URL: keras_data_format_converter-0.1.17.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.13 Linux/5.13.0-22-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98c1156ce4b07b199977c1566c501bb793d4ce8ede4245661a5fcd43f6ed2b0b |
|
MD5 | 44d9b1f07339ad32a399bdb2db1edf37 |
|
BLAKE2b-256 | 86060fa2f4e4785d0441de02152130da75b5e88e09871634e7b87a0047ef655f |
File details
Details for the file keras_data_format_converter-0.1.17-py3-none-any.whl
.
File metadata
- Download URL: keras_data_format_converter-0.1.17-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.13 Linux/5.13.0-22-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09399e33d83325c314190efbdfc772a817f705d08d96a37415c9597def2b9734 |
|
MD5 | be0af67326e11e9064e4e1f830bcafef |
|
BLAKE2b-256 | ec4335a1020effe20ca16f6b5d9bddd2d689af0a96a27b222d8d5b09fc521c3d |