首页 > 解决方案 > 在 Colab 中使用 Sementation 模型导入 UNet 时出错

问题描述

我对机器学习还很陌生。

我试图在 Google colab 上使用分割模型进行一些语义分割。

我刚刚用这条线安装了分段模型。

pip install git+https://github.com/qubvel/segmentation_models

然后,在块中的“model=sm.Unet(~~”行。我得到了错误代码。

BACKBONE = 'resnet34'
preprocess_input = sm.get_preprocessing(BACKBONE)


# define model
model = sm.Unet(BACKBONE, encoder_weights='imagenet')
model.compile(optimizer='adam', loss='sm.losses.bce_jaccard_loss', metrics=[sm.metrics.iou_score, 'mse'])

print(model.summary())

这是错误代码。

/usr/local/lib/python3.7/dist-packages/classification_models/weights.py in load_model_weights(model, model_name, dataset, classes, include_top, **kwargs)
     23                              ' as true, `classes` should be {}'.format(weights['classes']))
     24 
---> 25         weights_path = keras_utils.get_file(
     26             weights['name'],
     27             weights['url'],

AttributeError: module 'keras.utils' has no attribute 'get_file'

有人可以帮我解决问题吗?

标签: pythongoogle-colaboratoryunity3d-unet

解决方案


推荐阅读