首页 > 解决方案 > 使用 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])

标签: pythonkeras

解决方案


推荐阅读