Open 20165645phungthitrang opened 3 years ago
I am also facing the similar issue. Is there a solution for this apart from downgrading.
I tried to downgrade to !pip install tensorflow==2.2.0 !pip install keras==2.3.1 But later in my code keras is conflicting with tensorflow.
` import tensorflow as tf
import tensorflow.keras as keras
print(tf.version)
print(keras.version) ` Output: 2.4.1 2.4.0
!pip install -U segmentation-models==0.2.1
import segmentation_models as sm
Gives the following error: ModuleNotFoundError: No module named 'keras.legacy'
stack Trace:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-16-7b5049dd4be0> in <module>()
----> 1 import segmentation_models as sm
6 frames
/usr/local/lib/python3.7/dist-packages/segmentation_models/__init__.py in <module>()
4
5 from .unet import Unet
----> 6 from .fpn import FPN
7 from .linknet import Linknet
8 from .pspnet import PSPNet
/usr/local/lib/python3.7/dist-packages/segmentation_models/fpn/__init__.py in <module>()
----> 1 from .model import FPN
2
/usr/local/lib/python3.7/dist-packages/segmentation_models/fpn/model.py in <module>()
----> 1 from .builder import build_fpn
2 from ..backbones import get_backbone, get_feature_layers
3 from ..utils import freeze_model
4 from ..utils import legacy_support
5
/usr/local/lib/python3.7/dist-packages/segmentation_models/fpn/builder.py in <module>()
6 from keras.models import Model
7
----> 8 from .blocks import pyramid_block
9 from ..common import ResizeImage
10 from ..common import Conv2DBlock
/usr/local/lib/python3.7/dist-packages/segmentation_models/fpn/blocks.py in <module>()
1 from keras.layers import Add
2
----> 3 from ..common import Conv2DBlock
4 from ..common import ResizeImage
5 from ..utils import to_tuple
/usr/local/lib/python3.7/dist-packages/segmentation_models/common/__init__.py in <module>()
1 from .blocks import Conv2DBlock
----> 2 from .layers import ResizeImage
/usr/local/lib/python3.7/dist-packages/segmentation_models/common/layers.py in <module>()
2 from keras.engine import InputSpec
3 from keras.utils import conv_utils
----> 4 from keras.legacy import interfaces
5 from keras.utils.generic_utils import get_custom_objects
6
ModuleNotFoundError: No module named 'keras.legacy'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
It seems like TensorFlow 2 is not yet supported.
when i am running this line :from segmentation_models import Unet getting this error : AttributeError: module 'tensorflow_core.compat.v2' has no attribute 'internal'
can anybody help me with it i am using following env. !pip install segmentation-models !pip install tensorflow==2.1.0 !pip install keras==2.3.1
It seems like TensorFlow 2 is not yet supported.
can you please mention the dependency or requirement to run this repo... i have tried every combination though still not able to fix it...............
It seems like TensorFlow 2 is not yet supported.
can you please mention the dependency or requirement to run this repo... i have tried every combination though still not able to fix it...............
I'm currently using this repository with the following requirements: %tensorflow_version 1.x and downgrading the h5py as follows !pip install 'h5py==2.10.0' and then imported the repo as: !pip install -U segmentation-models obviously not tensorflow version 1.x isnt as convincing as 2.x ,but this isworking for me at the moment
The following has worked for me on google colab as of now.
!pip3 install tensorflow==2.2
!pip3 install keras==2.3.1
!pip3 install -U segmentation-models
%env SM_FRAMEWORK=tf.keras
import segmentation_models as sm
tf.keras.backend.set_image_data_format('channels_last')
First of all, thanks for your repo! I am having problems importing the library, I tried to fix it but didn't fix it yet. Can you help me :(