使用tensorflow 1.8进行物体检测

时间:2019-06-11 07:53:16

标签: tensorflow python-3.5 object-detection-api

(tensorflow2) C:\tensorflow2\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
WARNING:tensorflow:From C:\Users\Nischay\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\platform\app.py:124: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\legacy\trainer.py:266: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
WARNING:tensorflow:num_readers has been reduced to 1 to match input file shards.
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "C:\Users\Nischay\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
    _sys.exit(main(argv))
  File "C:\Users\Nischay\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\util\deprecation.py", line 136, in new_func
    return func(*args, **kwargs)
  File "train.py", line 180, in main
    graph_hook_fn=graph_rewriter_fn)
  File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 291, in train
    clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue])
  File "C:\tensorflow1\models\research\slim\deployment\model_deploy.py", line 193, in create_clones
    outputs = model_fn(*args, **kwargs)
  File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 204, in _create_losses
    prediction_dict = detection_model.predict(images, true_image_shapes)
  File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 821, in predict
    prediction_dict = self._predict_first_stage(preprocessed_inputs)
  File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 872, in _predict_first_stage
    image_shape) = self._extract_rpn_feature_maps(preprocessed_inputs)
  File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1250, in _extract_rpn_feature_maps
    feature_map_shape[2])]))
  File "C:\tensorflow1\models\research\object_detection\core\anchor_generator.py", line 103, in generate
    anchors_list = self._generate(feature_map_shape_list, **params)
  File "C:\tensorflow1\models\research\object_detection\anchor_generators\grid_anchor_generator.py", line 111, in _generate
    with tf.init_scope():
AttributeError: module 'tensorflow' has no attribute 'init_scope'

对于tensorflow 1.8 cuda 9.0 cuDNN 7.4.2,在训练模型时出错。

1 个答案:

答案 0 :(得分:0)

Tensorflow 1.8没有定义名为init_scope()的函数。您可以查看API r1.8中所有可用的functions。考虑升级到Tensorflow的更高版本,例如API r1.13,其中定义了init_scope()