TypeError: __init__() 得到了一个意外的关键字参数 'fpn_min_level'

问题描述 投票:0回答:0

当我运行我的对象检测模型时,屏幕上显示以下类型错误:


TypeError                                 Traceback (most recent call last)
\<ipython-input-26-f5bf27ce595e\> in \<module\>
 1 # Load pipeline config and build a detection model
 2 configs = config_util.get_configs_from_pipeline_file(CONFIG_PATH)
 \----\> 3 detection_model = model_builder.build(model_config=configs\['model'\], is_training=False)
 4
 5 # Restore checkpoint

 \~\\AppData\\Roaming\\Python\\Python37\\site-packages\\object_detection\\builders\\model_builder.py     in build(model_config, is_training, add_summaries)
    125   meta_architecture = model_config.WhichOneof('model')
    126   if meta_architecture == 'ssd':
    \--\> 127     return \_build_ssd_model(model_config.ssd, is_training, add_summaries)
    128   if meta_architecture == 'faster_rcnn':
    129     return \_build_faster_rcnn_model(model_config.faster_rcnn, is_training,

\~\\AppData\\Roaming\\Python\\Python37\\site-packages\\object_detection\\builders\\model_builder.py in \_build_ssd_model(ssd_config, is_training, add_summaries)
    
    248       feature_extractor_config=ssd_config.feature_extractor,
    249       freeze_batchnorm=ssd_config.freeze_batchnorm,
    \--\> 250       is_training=is_training)
    251
    252   box_coder = box_coder_builder.build(ssd_config.box_coder)

\~\\AppData\\Roaming\\Python\\Python37\\site-packages\\object_detection\\builders\\model_builder.py in \_build_ssd_feature_extractor(feature_extractor_config, is_training, freeze_batchnorm, reuse_weights)
    224     })
    225
    \--\> 226   return feature_extractor_class(\*\*kwargs)
    227
    228

TypeError: __init__() got an unexpected keyword argument 'fpn_min_level'

我已尝试搜索以修复此错误,但仍然无法找到相关信息。

这是我遇到错误的代码部分:

加载管道配置并构建检测模型

configs = config_util.get_configs_from_pipeline_file(CONFIG_PATH)
detection_model = model_builder.build(model_config=configs\['model'\], is_training=False)

恢复检查点

ckpt = tf.compat.v2.train.Checkpoint(model=detection_model)
ckpt.restore(os.path.join(CHECKPOINT_PATH, 'ckpt-6')).expect_partial()

@tf.function
def detect_fn(image):
image, shapes = detection_model.preprocess(image)
prediction_dict = detection_model.predict(image, shapes)
detections = detection_model.postprocess(prediction_dict, shapes)  

返回检测

python tensorflow machine-learning neural-network object-detection-api
© www.soinside.com 2019 - 2024. All rights reserved.