Import Error for segmentation_models_3d as sm (TF version: 2.12.0)

117 views Asked by At

I have TensorFlow version 2.12.0 and since Keras has been now a part of tensor flow, I am not installing Keras explicitly. The pip install command is running pretty well but on importing the segmentations_models_3d, I am receiving error saying Keras.engine module not found.

I tried downgrading TF to 2.x but no luck. I also tried using 1.x but nowadays TF has removed going back to TF1. Is there any way I can be helped.

import segmentation_models_3D as sm

The resulting error is,

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[10], line 1
----> 1 import segmentation_models_3D as sm

File ~/anaconda3/envs/UNET/lib/python3.10/site-packages/segmentation_models_3D/__init__.py:109
    106 from . import utils
    108 # wrap segmentation models with framework modules
--> 109 from .backbones.backbones_factory import Backbones
    110 from .models.unet import Unet as _Unet
    111 from .models.pspnet import PSPNet as _PSPNet

File ~/anaconda3/envs/UNET/lib/python3.10/site-packages/segmentation_models_3D/backbones/backbones_factory.py:2
      1 import copy
----> 2 from classification_models_3D.models_factory import ModelsFactory
      5 class BackbonesFactory(ModelsFactory):
      6     _default_feature_layers = {
      7 
      8         # List of layers to take features from backbone in the following order:
   (...)
     83                             'block2b_add', 'block1a_project_activation'),
     84     }

File ~/anaconda3/envs/UNET/lib/python3.10/site-packages/classification_models_3D/models_factory.py:14
     12 from .models import mobilenet as mb1
     13 from .models import mobilenet_v2 as mb2
---> 14 from .models import efficientnet as eff
     15 from .models import efficientnet_v2 as eff2
     16 from .models import convnext as cnext

File ~/anaconda3/envs/UNET/lib/python3.10/site-packages/classification_models_3D/models/efficientnet.py:33
     30 import math
     32 from keras.applications import imagenet_utils
---> 33 from keras.engine import training
     34 from keras.layers import VersionAwareLayers
     35 from keras.utils import data_utils

ModuleNotFoundError: No module named 'keras.engine'

0

There are 0 answers