Версия Tensorflow - 1.14.0 Python версия - 3.7.5
Это модель, которую я создал
from tensorflow import keras
import tensorflow.python.keras.backend as K
from tensorflow.python.keras import callbacks
from tensorflow.python.keras import Sequential
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout, BatchNormalization, GlobalAveragePooling2D
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
from tensorflow.python.keras.callbacks import ModelCheckpoint, EarlyStopping
def create_model_v1():
model = keras.Sequential()
model.add(Conv2D(filters = 64, kernel_size = 3, padding='same', activation = 'relu', input_shape=(img_rows, img_cols, color_type)))
model.add(MaxPooling2D(pool_size = 2))
model.add(Conv2D(filters = 128, padding='same', kernel_size = 3, activation = 'relu'))
model.add(MaxPooling2D(pool_size = 2))def create_model_v1():
model_v1 = create_model_v1()
history_v1 = model_v1.fit(x_train, y_train,
validation_data=(x_test, y_test),callbacks=callbacks,
epochs=nb_epoch, batch_size=batch_size, verbose=1)
Это код для экспорта в tflite:
keras_file = 'saved_models/history1.h5'
keras.models.save_model(history_v1, keras_file)
converter = tf.lite.TocoConverter.from_keras_model_file(keras_file)
tflite_model = converter.convert()
open('linear.tflite', 'wb').write(tflite_model)
Это ошибка:
Объект «История» не имеет атрибута «_is_graph_network»