ModuleNotFoundError: No module named 'segmentation_models'

947 views Asked by At

i need to work with the segmentation model module, but even though I installed the module with the current version, it doesn't work what should I do

codes:

import os
import cv2
import keras
import numpy as np
import tensorflow as tf
import albumentations as A
import matplotlib.pyplot as plt
import segmentation_models as sm

from keras import Sequential
from keras.models import Model, load_model
from keras.layers import Conv2D, Flatten, Dense
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, EarlyStopping, CSVLogger

sm.set_framework('tf.keras')
sm.framework()

os.environ['CUDA_VISIBLE_DEVICES'] = '0'

error:

ModuleNotFoundError                       
Traceback (most recent call last)
<ipython-input-14-72e520a0f699> in <cell line: 8>()
      6 import albumentations as A
      7 import matplotlib.pyplot as plt
----> 8 import segmentation_models as sm
      9 
     10 from keras import Sequential

ModuleNotFoundError: No module named 'segmentation_models'
1

There are 1 answers

1
kev_ta On

You are using this repo: https://github.com/qubvel/segmentation_models So you need to install it first:

pip install -U segmentation-models