با سلام من میخوام این مدل رو برا دیتاست خودم بسازم 60*60*1
و 124 تا کلاس منتهی این ارور رومیده
Error when checking input: expected input_6 to have shape (124,) but got array with shape (1,)
و اینم مدلم:
input_shape = [60, 60, 1]
num_routing = 3
NCLASSES =124
x = layers.Input(shape=input_shape)
conv1 = layers.Conv2D(filters=256, kernel_size=9, strides=1, padding='valid',
activation='relu',
name='conv1')(x)
primarycaps = PrimaryCap(conv1, dim_vector=8, n_channels=32, kernel_size=9, strides=2,
padding='valid')
digitcaps = DigitCaps(num_capsule=NCLASSES, dim_vector=16, num_routing=num_routing,
name='digitcaps')(primarycaps)
v_j_abs = Length(name='v_j_abs')(digitcaps)
y = layers.Input(shape=(NCLASSES,))
def Mask(inputs):
return K.batch_dot(inputs[0], inputs[1], [1, 1])
masked = layers.Lambda(Mask)([digitcaps, y])
l = layers.Dense(512, activation='relu')(masked)
l = layers.Dense(1024, activation='relu')(l)
l = layers.Dense(3600, activation='sigmoid')(l)
print(l.shape)
decoded = layers.Reshape(target_shape=input_shape, name='decoded')(l)
print(decoded)
model = keras.models.Model([x, y], [v_j_abs, decoded])
model.summary()
ممنون میشم چک کنید کد اصلی هم اینجاست روی mnist
https://github.com/leoniloris/CapsNet/blob/master/CapsNet-keras-tf_back.ipynb