-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
After entering the following code:
metrics=['accuracy', jacard_coef]
def get_model():
return multi_unet_model(n_classes=n_classes, IMG_HEIGHT=IMG_HEIGHT, IMG_WIDTH=IMG_WIDTH, IMG_CHANNELS=IMG_CHANNELS)
model = get_model()
model.compile(optimizer='adam', loss=total_loss, metrics=metrics)
#model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=metrics)
model.summary()
history1 = model.fit(X_train, y_train,
batch_size = 16,
verbose=1,
epochs=100,
validation_data=(X_test, y_test),
shuffle=False)
I am encountering the following error:
Total params: 1,941,190 (7.41 MB)
Trainable params: 1,941,190 (7.41 MB)
Non-trainable params: 0 (0.00 B)
Epoch 1/100
AttributeError Traceback (most recent call last)
in <cell line: 12>()
10
11
---> 12 history1 = model.fit(X_train, y_train,
13 batch_size = 16,
14 verbose=1,
3 frames
/usr/local/lib/python3.10/dist-packages/segmentation_models/base/functional.py in f_score(gt, pr, beta, class_weights, class_indexes, smooth, per_image, threshold, **kwargs)
143
144 # calculate score
--> 145 tp = backend.sum(gt * pr, axis=axes)
146 fp = backend.sum(pr, axis=axes) - tp
147 fn = backend.sum(gt, axis=axes) - tp
AttributeError: module 'keras.backend' has no attribute 'sum'
I am using keras Version: 3.0.2 and for tensorflow Version: 2.15.0.post1