代码的灵魂是bug! 2019-04-03 17:15 采纳率: 100%
浏览 2940
已采纳

用TensorFlow 训练mask rcnn时,总是在执行训练语句时报错,进行不下去了,求大神

用TensorFlow 训练mask rcnn时,总是在执行训练语句时报错,进行不下去了,求大神
执行语句是:

python model_main.py --model_dir=C:/Users/zoyiJiang/Desktop/mask_rcnn_test-master/training --pipeline_config_path=C:/Users/zoyiJiang/Desktop/mask_rcnn_test-master/training/mask_rcnn_inception_v2_coco.config

报错信息如下:

WARNING:tensorflow:Forced number of epochs for all eval validations to be 1.
WARNING:tensorflow:Expected number of evaluation epochs is 1, but instead encountered `eval_on_train_input_config.num_epochs` = 0. Overwriting `num_epochs` to 1.
WARNING:tensorflow:Estimator's model_fn (<function create_model_fn.<locals>.model_fn at 0x000001C1EA335C80>) includes params argument, but params are not passed to Estimator.
WARNING:tensorflow:num_readers has been reduced to 1 to match input file shards.
Traceback (most recent call last):
  File "model_main.py", line 109, in <module>
    tf.app.run()
  File "E:\Python3.6\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
    _sys.exit(main(argv))
  File "model_main.py", line 105, in main
    tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\training.py", line 439, in train_and_evaluate
    executor.run()
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\training.py", line 518, in run
    self.run_local()
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\training.py", line 650, in run_local
    hooks=train_hooks)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\estimator.py", line 363, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\estimator.py", line 843, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\estimator.py", line 853, in _train_model_default
    input_fn, model_fn_lib.ModeKeys.TRAIN))
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\estimator.py", line 691, in _get_features_and_labels_from_input_fn
    result = self._call_input_fn(input_fn, mode)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\estimator\estimator.py", line 798, in _call_input_fn
    return input_fn(**kwargs)
  File "D:\Tensorflow\tf\models\research\object_detection\inputs.py", line 525, in _train_input_fn
    batch_size=params['batch_size'] if params else train_config.batch_size)
  File "D:\Tensorflow\tf\models\research\object_detection\builders\dataset_builder.py", line 149, in build
    dataset = data_map_fn(process_fn, num_parallel_calls=num_parallel_calls)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 853, in map
    return ParallelMapDataset(self, map_func, num_parallel_calls)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1870, in __init__
    super(ParallelMapDataset, self).__init__(input_dataset, map_func)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1839, in __init__
    self._map_func.add_to_graph(ops.get_default_graph())
  File "E:\Python3.6\lib\site-packages\tensorflow\python\framework\function.py", line 484, in add_to_graph
    self._create_definition_if_needed()
  File "E:\Python3.6\lib\site-packages\tensorflow\python\framework\function.py", line 319, in _create_definition_if_needed
    self._create_definition_if_needed_impl()
  File "E:\Python3.6\lib\site-packages\tensorflow\python\framework\function.py", line 336, in _create_definition_if_needed_impl
    outputs = self._func(*inputs)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1804, in tf_map_func
    ret = map_func(nested_args)
  File "D:\Tensorflow\tf\models\research\object_detection\builders\dataset_builder.py", line 130, in process_fn
    processed_tensors = transform_input_data_fn(processed_tensors)
  File "D:\Tensorflow\tf\models\research\object_detection\inputs.py", line 515, in transform_and_pad_input_data_fn
    tensor_dict=transform_data_fn(tensor_dict),
  File "D:\Tensorflow\tf\models\research\object_detection\inputs.py", line 129, in transform_input_data
    tf.expand_dims(tf.to_float(image), axis=0))
  File "D:\Tensorflow\tf\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 543, in preprocess
    parallel_iterations=self._parallel_iterations)
  File "D:\Tensorflow\tf\models\research\object_detection\utils\shape_utils.py", line 237, in static_or_dynamic_map_fn
    outputs = [fn(arg) for arg in tf.unstack(elems)]
  File "D:\Tensorflow\tf\models\research\object_detection\utils\shape_utils.py", line 237, in <listcomp>
    outputs = [fn(arg) for arg in tf.unstack(elems)]
  File "D:\Tensorflow\tf\models\research\object_detection\core\preprocessor.py", line 2264, in resize_to_range
    lambda: _resize_portrait_image(image))
  File "E:\Python3.6\lib\site-packages\tensorflow\python\util\deprecation.py", line 432, in new_func
    return func(*args, **kwargs)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2063, in cond
    orig_res_t, res_t = context_t.BuildCondBranch(true_fn)
  File "E:\Python3.6\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 1913, in BuildCondBranch
    original_result = fn()
  File "D:\Tensorflow\tf\models\research\object_detection\core\preprocessor.py", line 2263, in <lambda>
    lambda: _resize_landscape_image(image),
  File "D:\Tensorflow\tf\models\research\object_detection\core\preprocessor.py", line 2245, in _resize_landscape_image
    align_corners=align_corners, preserve_aspect_ratio=True)
TypeError: resize_images() got an unexpected keyword argument 'preserve_aspect_ratio'

根据提示的最后一句,是说没有一个有效参数
我用的是TensorFlow1.8 python3.6,下载的最新的TensorFlow-models-master

  • 写回答

2条回答 默认 最新

  • 吃鸡王者 2019-04-03 17:36
    关注

    TypeError: resize_images() got an unexpected keyword argument 'preserve_aspect_ratio'

    最后一行,很明显参数异常啊,建议仔细看看具体函数和调用过程

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Xsheii7我安装这个文件的时候跳出来另一个文件已锁定文件的无一部分进程无法访问。这个该怎么解决
  • ¥15 unity terrain打包后地形错位,跟建筑不在同一个位置,怎么办
  • ¥15 FileNotFoundError 解决方案
  • ¥15 uniapp实现如下图的图表功能
  • ¥15 u-subsection如何修改相邻两个节点样式
  • ¥30 vs2010开发 WFP(windows filtering platform)
  • ¥15 服务端控制goose报文控制块的发布问题
  • ¥15 学习指导与未来导向啊
  • ¥15 求多普勒频移瞬时表达式
  • ¥15 如果要做一个老年人平板有哪些需求