qubvel / segmentation_models

Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
MIT License
4.66k stars 1.03k forks source link

module 'keras.utils.generic_utils' has no attribute 'get_custom_objects' #570

Open Rakshith2202 opened 1 year ago

Rakshith2202 commented 1 year ago

This is the error I am getting when I am trying to import segmentation_models

jensleitloff commented 11 months ago

Try to add

import os
os.environ['SM_FRAMEWORK'] = 'tf.keras'

before importing keras and segmentation_models.

vijay-jaisankar commented 7 months ago

Adding on to @jensleitloff 's answer, this answer on StackOverflow provides some more alternate approaches.

The accepted answer worked for me on a local machine and the answer in this thread worked for Kaggle/Colab.

sohailjamal commented 7 months ago

this answer helped alot

idhamari commented 5 months ago

this may help https://github.com/qubvel/segmentation_models/pull/582