models icon indicating copy to clipboard operation
models copied to clipboard

Mask RCNN predict_instance_masks: false KeyError: 'mask_predictions'

Open fboylu opened this issue 7 years ago • 5 comments

System information

  • What is the top-level directory of the model you are using: object_detection
  • 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): Ubuntu 16.04
  • TensorFlow installed from (source or binary): pip install
  • TensorFlow version (use command below): v1.12.0-0-ga6d8ffae09 1.12.0
  • CUDA/cuDNN version: CUDA 9.0/cuDNN 7.2.1
  • GPU model and memory: K80 x2
  • Bazel version: N/A
  • Exact command to reproduce: python object_detection/model_main.py

Describe the problem

I am trying to train mask_rcnn_inception_v2_coco_2018_01_28 with my own dataset that doesn't have masks and I have set predict_instance_masks: false as well as load_instance_masks: false in the config file however I am getting the error below. I appreciate if you can help me understand why I am getting the error. Thanks.

Source code / logs

Traceback (most recent call last): File "object_detection/model_main.py", line 109, in tf.app.run() File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "object_detection/model_main.py", line 105, in main tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0]) File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/training.py", line 471, in train_and_evaluate return executor.run() File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/training.py", line 610, in run return self.run_local() File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/training.py", line 711, in run_local saving_listeners=saving_listeners) File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 354, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1207, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1237, in _train_model_default features, labels, model_fn_lib.ModeKeys.TRAIN, self.config) File "/data/anaconda/envs/tfod/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1195, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "/datadrive/models/research/object_detection/model_lib.py", line 288, in model_fn features[fields.InputDataFields.true_image_shape]) File "/datadrive/models/research/object_detection/meta_architectures/faster_rcnn_meta_arch.py", line 692, in predict prediction_dict, true_image_shapes) File "/datadrive/models/research/object_detection/meta_architectures/faster_rcnn_meta_arch.py", line 880, in _predict_third_stage box_predictor.MASK_PREDICTIONS], axis=1) KeyError: 'mask_predictions'

fboylu avatar Apr 03 '19 21:04 fboylu

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. Bazel version

tensorflowbutler avatar Apr 04 '19 12:04 tensorflowbutler

Updated, thanks.

fboylu avatar Apr 04 '19 13:04 fboylu

This was resolved by changing the number_of_stages: 2. Thanks.

fboylu avatar Apr 26 '19 17:04 fboylu

@fboylu It worked for me surprizingly. Why do you think that worked ?

csingh27 avatar Jul 13 '20 17:07 csingh27

@csingh27 I think the masks are computed in the 3rd stage

fgerard avatar Sep 03 '20 21:09 fgerard