python - 使用 Maskrcnn 进行对象检测的准确性
问题描述
我正在尝试训练模型来检测对象(建筑物),我正在使用 Maskrcnn,模型运行但我想知道我尝试使用的模型的准确性,model.compile(metrics=['accuracy'])
但我收到此错误消息
AttributeError Traceback(最近一次调用最后一次)在 [40] 中:第 8 行:
model.compile(metrics=[metrics.categorical_accuracy])
AttributeError: 'MaskRCNN' object has no attribute 'compile'
这是我的完整代码
import os
from pathlib import Path
from arcgis.learn import MaskRCNN, prepare_data
from arcgis.gis import GIS
filepath =.....
import zipfile
with zipfile.ZipFile(filepath, 'r') as zip_ref:
zip_ref.extractall(Path(filepath).parent)
data_path = Path(os.path.join(os.path.splitext(filepath)[0]))
data = prepare_data(data_path, batch_size=2, chip_size=300)
data.show_batch(rows=4)
model = MaskRCNN(data)
lr = model.lr_find()
lr
from keras import metrics
model.compile(metrics=['accuracy'])
from keras import callbacks
earlystopping = callbacks.EarlyStopping(monitor ="val_loss", mode ="min", patience = 5, restore_best_weights = True)
model.fit(25,lr=lr,early_stopping=[earlystopping])
解决方案
推荐阅读
- python - 插入 USB 设备后,如何自动运行 python 脚本?
- python - selenium 使用的 credentials.txt 格式是什么?
- excel - 每周发送一次自动邮件 VBA
- algorithm - 如何创建高效的基于时间的触发服务?
- python - 查找 IP 地址和 IP 网络集中的 IP
- web-applications - 如何从 Samsung Health 获取心率和计步器等数据到 Tizen 应用程序?
- enums - 有没有办法在使用 Serde 反序列化时允许未知的枚举标签?
- postgresql - PostgreSQL 11.5 对 SELECT EXISTS 查询进行顺序扫描
- javascript - 反应,创建项目问题
- java - 如何构建数据驱动的 Selenium WebDriver + Java + TestNG 框架