Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Traceback (most recent call last) #32

Open
kjayn opened this issue Dec 8, 2022 · 2 comments
Open

ValueError: Traceback (most recent call last) #32

kjayn opened this issue Dec 8, 2022 · 2 comments

Comments

@kjayn
Copy link

kjayn commented Dec 8, 2022

# Create our model (returns a compiled model)
model = canaro.models.createSimpsonsModel(IMG_SIZE=IMG_SIZE, channels=channels, output_dim=len(characters), 
                                         loss='binary_crossentropy', decay=1e-7, learning_rate=0.001, momentum=0.9,
                                         nesterov=True)

ValueError: decay is deprecated in the new Keras optimizer, pleasecheck the docstring for valid arguments, or use the legacy optimizer, e.g., tf.keras.optimizers.legacy.SGD.

how to fix this?

@MAHENDRA9535
Copy link

# Create our model (returns a compiled model)
model = canaro.models.createSimpsonsModel(IMG_SIZE=IMG_SIZE, channels=channels, output_dim=len(characters), 
                                         loss='binary_crossentropy', decay=1e-7, learning_rate=0.001, momentum=0.9,
                                         nesterov=True)

ValueError: decay is deprecated in the new Keras optimizer, pleasecheck the docstring for valid arguments, or use the legacy optimizer, e.g., tf.keras.optimizers.legacy.SGD.

how to fix this?

use this code instead:
#this is the import statements you need to add
import tensorflow as tf
import keras
from keras.models import Sequential, Model
from keras.layers import Conv2D, Flatten, MaxPooling2D, Dense, Input, Reshape, Concatenate, GlobalAveragePooling2D, BatchNormalization, Dropout, Activation, GlobalMaxPooling2D
from keras.utils import Sequence

#this is the functional code used to create the model

def create_ST_layer(input_shape = (64, 128, 3)):
input_img = Input(shape=input_shape)
model = Conv2D(48, kernel_size=(5, 5), input_shape = input_shape, strides = (1, 1), activation = "relu")(input_img)
model = MaxPooling2D(pool_size=(2, 2), strides = (2, 2))(model)
model = Conv2D(32, kernel_size=(5, 5), strides = (1, 1), activation = "relu")(model)
model = MaxPooling2D(pool_size=(2, 2), strides = (2, 2))(model)
model = Dense(50, activation = "relu")(model)
model = Dense(6)(model)
model = tf.keras.Model(inputs=input_img, outputs= model)
return model

#to print the summary

model = create_ST_layer()
model.summary()

Hope this helps!!!!

@MrIzzat
Copy link

MrIzzat commented May 17, 2024

The best solution I found was to modify the simpsons.py file as stated in the answer here: https://stackoverflow.com/a/75951851/17870878.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants