tensorflow: AttributeError: module 'tensorflow' has no attribute 'init_scope'

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): -No OS Platform and Distribution (e.g., Linux Ubuntu 16.04): -Windows Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: -No TensorFlow installed from (source or binary): -Pip TensorFlow version (use command below): -Tensorflow-gpu 1.9.0 Python version: -Python 3.6.6 CUDA/cuDNN version: -CUDA 10.0.0 -cuDNN 7.6.1 GPU model and memory: -NVIDIA GeForce GTX 1070 Ti (8gb dedicated)

Describe the current behavior

  • Try to train a model based on faster_rcnn_nass_coco.config. Get an - error AttributeError: module ‘tensorflow’ has no attribute ‘init_scope’. Same code works if I use ssd_mobilenet_v1_pets.config

Code to reproduce the issue python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_nass_coco.config

Other info / logs _Traceback (most recent call last): File “train.py”, line 184, in <module> tf.app.run() File “C:\Users\Vitalie\Anaconda3\envs\python-cvcourse\lib\site-packages\tensorflow\python\platform\app.py”, line 125, in run _sys.exit(main(argv)) File “C:\Users\Vitalie\Anaconda3\envs\python-cvcourse\lib\site-packages\tensorflow\python\util\deprecation.py”, line 250, in new_func return func(*args, **kwargs) File “train.py”, line 180, in main graph_hook_fn=graph_rewriter_fn) File “C:\Users\Vitalie\Downloads\models-master\research\object_detection\legacy\trainer.py”, line 291, in train clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue]) File “C:\Users\Vitalie\Downloads\models-master\research\slim\deployment\model_deploy.py”, line 193, in create_clones outputs = model_fn(*args, **kwargs) File “C:\Users\Vitalie\Downloads\models-master\research\object_detection\legacy\trainer.py”, line 204, in _create_losses prediction_dict = detection_model.predict(images, true_image_shapes) File “C:\Users\Vitalie\Downloads\models-master\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py”, line 821, in predict prediction_dict = self._predict_first_stage(preprocessed_inputs) File “C:\Users\Vitalie\Downloads\models-master\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:\Users\Vitalie\Downloads\models-master\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py”, line 1250, in _extract_rpn_feature_maps feature_map_shape[2])])) File “C:\Users\Vitalie\Downloads\models-master\research\object_detection\core\anchor_generator.py”, line 103, in generate anchors_list = self._generate(feature_map_shape_list, **params) File “C:\Users\Vitalie\Downloads\models-master\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’

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

@ChenSi521 Can you please provide step-by-step explaination?