'str object has no attribute 'decode'

BACKBONE = 'vgg16'
preprocess_input = sm.get_preprocessing(BACKBONE)
# preprocess input
x_train_new = preprocess_input(x_train)
x_test_new = preprocess_input(x_test)
# define model
model_resnet_backbone = sm.Unet(BACKBONE,encoder_weights='imagenet', classes=n_classes, activation='softmax')
metrics=['accuracy', jacard]
# compile keras model with defined optimozer, loss and metrics
#model_resnet_backbone.compile(optimizer='adam', loss=focal_loss, metrics=metrics)
model_resnet_backbone.compile(optimizer='adam', loss='categorical_crossentropy', metrics=metrics)
print(model_resnet_backbone.summary())
history_tf=model_resnet_backbone.fit(x_train_new, 
          y_train,
          batch_size=16, 
          epochs=1,
          verbose=1,
          validation_data=(x_test_new, y_test))

I want to train using resnet34. But [this error][1] is coming, what should I do? AttributeError Traceback (en son çağrı) () 8 9 # define model - --> 10 model_resnet_backbone = sm.Unet(BACKBONE,encoder_weights='imagenet', sınıflar=n_classes, activation='softmax') 9 kare /tensorflow-1.15.2/python3.7/keras/engine/saving.py load_weights_from_hdf5_group(f, Layer, reshape) 1181 """ 1182 f.attrs'de 'keras_version' ise: -> 1183 orijinal_keras_version = f. attrs['keras_version'].decode('utf8') 1184 başka: 1185 orijinal_keras_version = '1' AttributeError: 'str' nesnesinin 'decode' özniteliği yok



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source