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
versionanddownload_url) - Run
python setup.py sdistin root directory - Run
pip install twine - Run
twine upload dist/*
License
This software is covered by MIT License.
Metadata
Release files for keras-data-format-converter 0.1.24
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keras_data_format_converter-0.1.24.tar.gz | 6.6 kB | Without provenance | Details for keras_data_format_converter-0.1.24.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keras_data_format_converter-0.1.24-py3-none-any.whl | Python 3 | none | any | Details for keras_data_format_converter-0.1.24-py3-none-any.whl |
Total release size: 16.2 kB
Release files / keras_data_format_converter-0.1.24.tar.gz
| Download URL | keras_data_format_converter-0.1.24.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54637106a010503d0c8c038de01a1544ee2fe252aadd4a77c0f5a8c13bcf48e7
|
|
BLAKE2b-256 checksum How to use checksums |
e17fd3cce9994c286aa9af57744358ceac2921d348e36b96eaa07f06a79beee2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.8 Darwin/24.6.0
|
Release files / keras_data_format_converter-0.1.24-py3-none-any.whl
| Download URL | keras_data_format_converter-0.1.24-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e78aa5fdd766526e200205a49d10e3e0e17a9fd0eaacdfb24a94fb4f7b88d34
|
|
BLAKE2b-256 checksum How to use checksums |
6bea291eef5273c846585c3416acc3d9076d6c498ae7cc6a5a570c46fc0ec600
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.8 Darwin/24.6.0
|
Security for keras-data-format-converter 0.1.24
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.