求助!用ssd训练模型时,报错AttributeError: module 'tensorflow' has no attribute 'init_scope'
发布于 24天前 作者 luyuxuan158 来自问答

求助!!使用widerface训练object-detective模型

环境:win10, tensorflowgpu-1.9,anaconda3

出错脚本:

python object_detection/model_main.py 

    --pipeline_config_path=

    E:/learning/AI/Project/models/research/object_detection/samples/configs/ssd_resnet50_v1_fpn_shared_box_predictor_640x640_coco14_sync_face.config 

    --model_dir=E:/learning/AI/Project/widerface_data/resnet50v1-fpn 

     --num_train_steps=100000 

       --alsologtostder

错误代码

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 0x00000156A61F3950>) 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 "object_detection/model_main.py", line 116, in <module>
tf.app.run()
File "D:\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "object_detection/model_main.py", line 112, in main
tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\training.py", line 447, in train_and_evaluate
return executor.run()
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\training.py", line 531, in run
return self.run_local()
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\training.py", line 669, in run_local
hooks=train_hooks)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 366, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1119, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1132, in _train_model_default
features, labels, model_fn_lib.ModeKeys.TRAIN, self.config)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1107, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "D:\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\model_lib.py", line 302, in model_fn
features[fields.InputDataFields.true_image_shape])
File "D:\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\ssd_meta_arch.py", line 579, in predict
im_width=image_shape[2]))
File "D:\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\core\anchor_generator.py", line 103, in generate
anchors_list = self._generate(feature_map_shape_list, **params)
File "D:\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\anchor_generators\multiscale_grid_anchor_generator.py", line 133, in _generate
(anchor_grid,) = ag.generate(feature_map_shape_list=[(feat_h, feat_w)])
File "D:\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\core\anchor_generator.py", line 103, in generate
anchors_list = self._generate(feature_map_shape_list, **params)
File "D:\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\anchor_generators\grid_anchor_generator.py", line 111, in _generate
with tf.init_scope():
AttributeError: module 'tensorflow' has no attribute 'init_scope'


求大神帮助!

1回复

在家里外网非常慢,stackflow.com有一条和这个有关的,家里网速打不开 愁死人

回到顶部