python - 在 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'
有人可以帮我解决问题吗?
解决方案
推荐阅读
- python - 将字符串月日、年转换为 mm/dd/yyyy
- c# - 为什么我的服务器 TcpListener 使用本地地址而不使用公共地址?- 例外:请求的地址在其上下文中无效
- javascript - 需要一种使用字符串上的键来识别特定变量类型的方法
- javascript - 学生,老师一个普通的模型还是猫鼬中的两个单独的模型?
- java - SpringBoot + Postman @RequestMapping value = "getImage/{imageName:.+}"
- cassandra - Cassandra 无法将列覆盖为旧值
- java - 如何以编程方式折叠primefaces手风琴面板中的所有面板?
- c++ - 处理时间差异
- google-cast - 使用 HLS 的 AC-3 和 E-AC-3 直通
- python - 在列表上的元组上使用函数在 Google Colab 中有效,但在本地机器上无效