TensorFlow.NET icon indicating copy to clipboard operation
TensorFlow.NET copied to clipboard

[Question]: Loading Python EfficientNetV2B0 model

Open werag55 opened this issue 2 years ago • 1 comments

Description

Hello I have tf.keras.Model created in Python using trasnfer learning with EfficientNetV2B0 as a base model. I saved it in SavedModel format and currently trying to load it using tf.keras.models.load_model but I'm getting an exception: exception Any ideas how to overcome this? Thank you in advance!

Alternatives

I'm using TensorFlow.Keras version 0.15.0 and SciSharp.TensorFlow.Redist version 2.16.0. I'm quite sure the issue is in EfficientNetV2B0, because I tried to create a simple tf.keras.Model in Python and load it using tf.keras.models.load_model and it worked just fine. But trying to load even the simplest model using EfficientNetV2B0, e.g.

import tensorflow as tf
target_size=(200, 200)
channels=3
model = tf.keras.applications.efficientnet_v2.EfficientNetV2B0(
        include_top=False,
        input_shape=(*target_size, channels)
    )
model.save("model")

leads to that exception.

This is how I'm trying to load the model:

using Tensorflow.Keras.Engine;
using static Tensorflow.Binding;
using static Tensorflow.KerasApi;

var model = tf.keras.models.load_model("model");

werag55 avatar Jan 19 '24 04:01 werag55

:(

werag55 avatar Jan 24 '24 18:01 werag55