name "model" is not defined Keras

Asked by At

I have this error while saving mode:

NameError Traceback (most recent call last) in () ----> 1 Model.save(model, filepath="image_ocr/model.h5")

NameError: name 'model' is not defined

//imports:
from keras.models import load_model
from keras.models import Model
import os
import itertools
import codecs
import re
import datetime
import cairocffi as cairo
import editdistance
import numpy as np
from scipy import ndimage
import pylab
from keras import backend as K
from keras.layers.convolutional import Conv2D, MaxPooling2D
from keras.layers import Input, Dense, Activation
from keras.layers import Reshape, Lambda
from keras.layers.merge import add, concatenate
from keras.layers.recurrent import GRU
from keras.optimizers import SGD
from keras.utils.data_utils import get_file
from keras.preprocessing import image
import keras.callbacks

//training model

Model.save("model.h5") 

Error is only in last line, but I use 'model' earlier without any errors. I can't understand where is error.

0 Answers