segmentation_models: Unable to load the repository in google colab

I have already cloned the repository using: !git clone https://github.com/qubvel/segmentation_models

image

Now when I try to load it (import it), it shows following error:

from segmentation_models import Unet

--------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-21-95926c7db055> in <module>()
----> 1 from segmentation_models import Unet

/content/segmentation_models/__init__.py in <module>()
----> 1 from .segmentation_models import *

/content/segmentation_models/segmentation_models/__init__.py in <module>()
      3 from .__version__ import __version__
      4 
----> 5 from .unet import Unet
      6 from .fpn import FPN
      7 from .linknet import Linknet

/content/segmentation_models/segmentation_models/unet/__init__.py in <module>()
----> 1 from .model import Unet

/content/segmentation_models/segmentation_models/unet/model.py in <module>()
      2 from ..utils import freeze_model
      3 from ..utils import legacy_support
----> 4 from ..backbones import get_backbone, get_feature_layers
      5 
      6 old_args_map = {

/content/segmentation_models/segmentation_models/backbones/__init__.py in <module>()
----> 1 from classification_models import Classifiers
      2 from classification_models import resnext
      3 
      4 from . import inception_resnet_v2 as irv2
      5 from . import inception_v3 as iv3

/content/classification_models/__init__.py in <module>()
----> 1 from .classification_models import *

/content/classification_models/classification_models/__init__.py in <module>()
      3 from . import resnet as rn
      4 from . import senet as sn
----> 5 from . import keras_applications as ka
      6 
      7 

/content/classification_models/classification_models/keras_applications/__init__.py in <module>()
      1 import keras
----> 2 from .keras_applications.keras_applications import *
      3 
      4 set_keras_submodules(
      5     backend=keras.backend,

ModuleNotFoundError: No module named 'classification_models.classification_models.keras_applications.keras_applications.keras_applications'

Can anyone help regarding this? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

One more note, choose another network for multiclass segmentation. Unet has only 16 filters at the end, it would be hard to separate 255 classes. Better take PSP or FPN.

Never did it with so many classes. I think it depends on data a lot. Try to use PSP with downsampling_factor=16 and heavy encoders like InceptionResNetV2/Senet154 (require a lot of GPU memory), do not downsample image a lot. Maybe you need several GPUs to train something.

P.S. add aux output to help training (reed paper of PSPNet) P.P.S. use_batchnorm=False to reduce required memory P.P.P.S. (😄) use weighted loss function

I am closing this issue. I will create a new issue of implementation if necessary. Thank you once again.

ImageNet weights are compatible only with (None, None, 3) shape. In case of (None, None, 7) set encoder_weights=None

  1. !pip install -U segmentation_models if permission denied error try:
    !pip install -U segmentation_models --user
  2. !pip install git+https://github.com/qubvel/segmentation_models

Hi @sankalpmittal1911-BitSian you have to clone using --recursive flag or use git submodule update --init