{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/models/issues/5371","repository_url":"https://api.github.com/repos/tensorflow/models","labels_url":"https://api.github.com/repos/tensorflow/models/issues/5371/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/models/issues/5371/comments","events_url":"https://api.github.com/repos/tensorflow/models/issues/5371/events","html_url":"https://github.com/tensorflow/models/issues/5371","id":363170963,"node_id":"MDU6SXNzdWUzNjMxNzA5NjM=","number":5371,"title":"[Object Detection] TypeError: `name` must be string, given: 0","user":{"login":"nikitaverbis","id":21986402,"node_id":"MDQ6VXNlcjIxOTg2NDAy","avatar_url":"https://avatars1.githubusercontent.com/u/21986402?v=4","gravatar_id":"","url":"https://api.github.com/users/nikitaverbis","html_url":"https://github.com/nikitaverbis","followers_url":"https://api.github.com/users/nikitaverbis/followers","following_url":"https://api.github.com/users/nikitaverbis/following{/other_user}","gists_url":"https://api.github.com/users/nikitaverbis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikitaverbis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikitaverbis/subscriptions","organizations_url":"https://api.github.com/users/nikitaverbis/orgs","repos_url":"https://api.github.com/users/nikitaverbis/repos","events_url":"https://api.github.com/users/nikitaverbis/events{/privacy}","received_events_url":"https://api.github.com/users/nikitaverbis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"pkulzc","id":35853368,"node_id":"MDQ6VXNlcjM1ODUzMzY4","avatar_url":"https://avatars3.githubusercontent.com/u/35853368?v=4","gravatar_id":"","url":"https://api.github.com/users/pkulzc","html_url":"https://github.com/pkulzc","followers_url":"https://api.github.com/users/pkulzc/followers","following_url":"https://api.github.com/users/pkulzc/following{/other_user}","gists_url":"https://api.github.com/users/pkulzc/gists{/gist_id}","starred_url":"https://api.github.com/users/pkulzc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkulzc/subscriptions","organizations_url":"https://api.github.com/users/pkulzc/orgs","repos_url":"https://api.github.com/users/pkulzc/repos","events_url":"https://api.github.com/users/pkulzc/events{/privacy}","received_events_url":"https://api.github.com/users/pkulzc/received_events","type":"User","site_admin":false},"assignees":[{"login":"pkulzc","id":35853368,"node_id":"MDQ6VXNlcjM1ODUzMzY4","avatar_url":"https://avatars3.githubusercontent.com/u/35853368?v=4","gravatar_id":"","url":"https://api.github.com/users/pkulzc","html_url":"https://github.com/pkulzc","followers_url":"https://api.github.com/users/pkulzc/followers","following_url":"https://api.github.com/users/pkulzc/following{/other_user}","gists_url":"https://api.github.com/users/pkulzc/gists{/gist_id}","starred_url":"https://api.github.com/users/pkulzc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkulzc/subscriptions","organizations_url":"https://api.github.com/users/pkulzc/orgs","repos_url":"https://api.github.com/users/pkulzc/repos","events_url":"https://api.github.com/users/pkulzc/events{/privacy}","received_events_url":"https://api.github.com/users/pkulzc/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-09-24T14:27:21Z","updated_at":"2018-09-27T12:48:30Z","closed_at":null,"author_association":"NONE","body":"### System information\r\n- **What is the top-level directory of the model you are using**: ~/tf_1_10_src/tensorflow/tensorflow/models\r\n- **Have I written custom code (as opposed to using a stock example script provided in TensorFlow)**: No\r\n- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:Ubuntu 16.04.3 LTS\r\n- **TensorFlow installed from (source or binary)**: source \r\n- **TensorFlow version (use command below)**: 1.10.1\r\n- **Bazel version (if compiling from source)**: 0.15.2\r\n- **CUDA/cuDNN version**: CUDA 9.0/cuDNN 7.3\r\n- **GPU model and memory**: GTX TitanXp\r\n- **Exact command to reproduce**: `cd ~/tf_1_10_src/tensorflow/tensorflow/models/research; ~/train_object_detection_v1.sh`\r\n\r\n### Describe the problem\r\nDescribe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.\r\n\r\n### Source code / logs\r\n\r\nScript train_object_detection_v1.sh source:\r\n```\r\n!/bin/bash\r\necho \"Object detection script v.1\"\r\necho \"Check execution path\"\r\nif [[ \"$PWD\" = \"$TFMODELPATH/research\" ]]\r\nthen\r\n  echo \"Current working directory is correct.\"\r\n  \r\n  PROJECT_DIR=/media/nikita/LinuxBD4Tb/SSD_PROJECT\r\n  PIPELINE_CONFIG_PATH=$PROJECT_DIR/ssd_inception_v2_coco_nik.config\r\n  MODEL_DIR=$PROJECT_DIR/models/model\r\n  NUM_TRAIN_STEPS=4000000\r\n  SAMPLE_1_OF_N_EVAL_EXAMPLES=1\r\n  \r\n  echo \"PIPELINE_CONFIG_PATH=$PIPELINE_CONFIG_PATH\"\r\n  echo \"MODEL_DIR=$MODEL_DIR\"\r\n  echo \"NUM_TRAIN_STEPS=$NUM_TRAIN_STEPS\"\r\n  echo \"SAMPLE_1_OF_N_EVAL_EXAMPLES=$SAMPLE_1_OF_N_EVAL_EXAMPLES\"\r\n  echo \"-----------------\"\r\n  echo \"Start object_detection/model_main.py\"\r\n  python object_detection/model_main.py \\\r\n    --pipeline_config_path=${PIPELINE_CONFIG_PATH} \\\r\n    --model_dir=${MODEL_DIR} \\\r\n    --num_train_steps=${NUM_TRAIN_STEPS} \\\r\n    --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \\\r\n    --alsologtostderr \r\nelse\r\n  echo \"Current working directory must be 'tensorflow/models/research/'.\"\r\n  echo \"Correct path is '$TFMODELPATH/research'\"\r\n  echo \"Exit.\"  \r\nfi\r\n```\r\nDir struct:\r\n\r\n```\r\n./SSD_PROJECT/\r\n├── data\r\n│   ├── mscoco_label_map.pbtxt\r\n│   ├── mscoco_train.record\r\n│   └── mscoco_val.record\r\n├── models\r\n│   └── model\r\n│       ├── eval\r\n│       ├── pipeline.config\r\n│       └── train\r\n└── ssd_inception_v2_coco_nik.config\r\n```\r\nFile ssd_inception_v2_coco_nik.config:\r\n```\r\nmodel {\r\n  ssd {\r\n    num_classes: 90\r\n    box_coder {\r\n      faster_rcnn_box_coder {\r\n        y_scale: 10.0\r\n        x_scale: 10.0\r\n        height_scale: 5.0\r\n        width_scale: 5.0\r\n      }\r\n    }\r\n    matcher {\r\n      argmax_matcher {\r\n        matched_threshold: 0.5\r\n        unmatched_threshold: 0.5\r\n        ignore_thresholds: false\r\n        negatives_lower_than_unmatched: true\r\n        force_match_for_each_row: true\r\n      }\r\n    }\r\n    similarity_calculator {\r\n      iou_similarity {\r\n      }\r\n    }\r\n    anchor_generator {\r\n      ssd_anchor_generator {\r\n        num_layers: 6\r\n        min_scale: 0.2\r\n        max_scale: 0.95\r\n        aspect_ratios: 1.0\r\n        aspect_ratios: 2.0\r\n        aspect_ratios: 0.5\r\n        aspect_ratios: 3.0\r\n        aspect_ratios: 0.3333\r\n        reduce_boxes_in_lowest_layer: true\r\n      }\r\n    }\r\n    image_resizer {\r\n      fixed_shape_resizer {\r\n        height: 300\r\n        width: 300\r\n      }\r\n    }\r\n    box_predictor {\r\n      convolutional_box_predictor {\r\n        min_depth: 0\r\n        max_depth: 0\r\n        num_layers_before_predictor: 0\r\n        use_dropout: false\r\n        dropout_keep_probability: 0.8\r\n        kernel_size: 3\r\n        box_code_size: 4\r\n        apply_sigmoid_to_scores: false\r\n        conv_hyperparams {\r\n          activation: RELU_6,\r\n          regularizer {\r\n            l2_regularizer {\r\n              weight: 0.00004\r\n            }\r\n          }\r\n          initializer {\r\n            truncated_normal_initializer {\r\n              stddev: 0.03\r\n              mean: 0.0\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n    feature_extractor {\r\n      type: 'ssd_inception_v2'\r\n      min_depth: 16\r\n      depth_multiplier: 1.0\r\n      conv_hyperparams {\r\n        activation: RELU_6,\r\n        regularizer {\r\n          l2_regularizer {\r\n            weight: 0.00004\r\n          }\r\n        }\r\n        initializer {\r\n          truncated_normal_initializer {\r\n            stddev: 0.03\r\n            mean: 0.0\r\n          }\r\n        }\r\n        batch_norm {\r\n          train: true,\r\n          scale: true,\r\n          center: true,\r\n          decay: 0.9997,\r\n          epsilon: 0.001,\r\n        }\r\n      }\r\n      override_base_feature_extractor_hyperparams: true\r\n    }\r\n    loss {\r\n      classification_loss {\r\n        weighted_sigmoid {\r\n        }\r\n      }\r\n      localization_loss {\r\n        weighted_smooth_l1 {\r\n        }\r\n      }\r\n      hard_example_miner {\r\n        num_hard_examples: 3000\r\n        iou_threshold: 0.99\r\n        loss_type: CLASSIFICATION\r\n        max_negatives_per_positive: 3\r\n        min_negatives_per_image: 0\r\n      }\r\n      classification_weight: 1.0\r\n      localization_weight: 1.0\r\n    }\r\n    normalize_loss_by_num_matches: true\r\n    post_processing {\r\n      batch_non_max_suppression {\r\n        score_threshold: 1e-8\r\n        iou_threshold: 0.6\r\n        max_detections_per_class: 100\r\n        max_total_detections: 100\r\n      }\r\n      score_converter: SIGMOID\r\n    }\r\n  }\r\n}\r\n\r\ntrain_config: {\r\n  batch_size: 32\r\n  optimizer {\r\n    rms_prop_optimizer: {\r\n      learning_rate: {\r\n        exponential_decay_learning_rate {\r\n          initial_learning_rate: 0.004\r\n          decay_steps: 800720\r\n          decay_factor: 0.95\r\n        }\r\n      }\r\n      momentum_optimizer_value: 0.9\r\n      decay: 0.9\r\n      epsilon: 1.0\r\n    }\r\n  }\r\n  fine_tune_checkpoint: \"/home/nikita/tf_1_10_src/pretrained_InceptionV2_ImageNet_CLS2012/inception_v2.ckpt\"\r\n  from_detection_checkpoint: false\r\n  # Note: The below line limits the training process to 200K steps, which we\r\n  # empirically found to be sufficient enough to train the pets dataset. This\r\n  # effectively bypasses the learning rate schedule (the learning rate will\r\n  # never decay). Remove the below line to train indefinitely.\r\n  #num_steps: 300000\r\n  data_augmentation_options {\r\n    random_horizontal_flip {\r\n    }\r\n  }\r\n  data_augmentation_options {\r\n    ssd_random_crop {\r\n    }\r\n  }\r\n}\r\n\r\ntrain_input_reader: {\r\n  tf_record_input_reader {\r\n    input_path: \"/media/nikita/LinuxBD4Tb/SSD_PROJECT/data/mscoco_train.record\"\r\n  }\r\n  label_map_path: \"/media/nikita/LinuxBD4Tb/SSD_PROJECT/data/mscoco_label_map.pbtxt\"\r\n}\r\n\r\neval_config: {\r\n  num_examples: 5000\r\n  # Note: The below line limits the evaluation process to 10 evaluations.\r\n  # Remove the below line to evaluate indefinitely.\r\n  max_evals: 10\r\n}\r\n\r\neval_input_reader: {\r\n  tf_record_input_reader {\r\n    input_path: \"/media/nikita/LinuxBD4Tb/SSD_PROJECT/data/mscoco_val.record\"\r\n  }\r\n  label_map_path: \"/media/nikita/LinuxBD4Tb/SSD_PROJECT/data/mscoco_label_map.pbtxt\"\r\n  shuffle: false\r\n  num_readers: 1\r\n}\r\n```\r\n\r\n\r\nError log:\r\n```\r\nnikita@ubuntulinux:~/tf_1_10_src/tensorflow/tensorflow/models/research$ ~/train_object_detection_v1.sh \r\nObject detection script v.1\r\nCheck execution path\r\nCurrent working directory is correct.\r\nPIPELINE_CONFIG_PATH=/media/nikita/LinuxBD4Tb/SSD_PROJECT/ssd_inception_v2_coco_nik.config\r\nMODEL_DIR=/media/nikita/LinuxBD4Tb/SSD_PROJECT/models/model\r\nNUM_TRAIN_STEPS=4000000\r\nSAMPLE_1_OF_N_EVAL_EXAMPLES=1\r\n-----------------\r\nStart object_detection/model_main.py\r\n/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/object_detection/utils/visualization_utils.py:27: UserWarning: \r\nThis call to matplotlib.use() has no effect because the backend has already\r\nbeen chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,\r\nor matplotlib.backends is imported for the first time.\r\n\r\nThe backend was *originally* set to u'TkAgg' by the following code:\r\n  File \"object_detection/model_main.py\", line 26, in <module>\r\n    from object_detection import model_lib\r\n  File \"/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/object_detection/model_lib.py\", line 27, in <module>\r\n    from object_detection import eval_util\r\n  File \"/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/object_detection/eval_util.py\", line 27, in <module>\r\n    from object_detection.metrics import coco_evaluation\r\n  File \"/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/object_detection/metrics/coco_evaluation.py\", line 20, in <module>\r\n    from object_detection.metrics import coco_tools\r\n  File \"/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/object_detection/metrics/coco_tools.py\", line 47, in <module>\r\n    from pycocotools import coco\r\n  File \"/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/pycocotools/coco.py\", line 49, in <module>\r\n    import matplotlib.pyplot as plt\r\n  File \"/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py\", line 69, in <module>\r\n    from matplotlib.backends import pylab_setup\r\n  File \"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py\", line 14, in <module>\r\n    line for line in traceback.format_stack()\r\n\r\n\r\n  import matplotlib; matplotlib.use('Agg')  # pylint: disable=multiple-statements\r\nWARNING:tensorflow:Forced number of epochs for all eval validations to be 1.\r\nW0924 15:58:51.491380 140112981780224 tf_logging.py:125] Forced number of epochs for all eval validations to be 1.\r\nWARNING:tensorflow:Expected number of evaluation epochs is 1, but instead encountered `eval_on_train_input_config.num_epochs` = 0. Overwriting `num_epochs` to 1.\r\nW0924 15:58:51.491605 140112981780224 tf_logging.py:125] Expected number of evaluation epochs is 1, but instead encountered `eval_on_train_input_config.num_epochs` = 0. Overwriting `num_epochs` to 1.\r\nWARNING:tensorflow:Estimator's model_fn (<function model_fn at 0x7f6e49985c80>) includes params argument, but params are not passed to Estimator.\r\nW0924 15:58:51.491858 140112981780224 tf_logging.py:125] Estimator's model_fn (<function model_fn at 0x7f6e49985c80>) includes params argument, but params are not passed to Estimator.\r\n1) exporter_name=Servo_0; eval_spec_name=0(type <type 'int'>)\r\nTraceback (most recent call last):\r\n  File \"object_detection/model_main.py\", line 109, in <module>\r\n    tf.app.run()\r\n  File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py\", line 125, in run\r\n    _sys.exit(main(argv))\r\n  File \"object_detection/model_main.py\", line 102, in main\r\n    eval_on_train_data=False)\r\n  File \"/home/nikita/tf_1_10_src/tensorflow/tensorflow/models/research/object_detection/model_lib.py\", line 659, in create_train_and_eval_specs\r\n    exporters=exporter))\r\n  File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py\", line 237, in __new__\r\n    raise TypeError('`name` must be string, given: {}'.format(name))\r\nTypeError: `name` must be string, given: 0\r\n```\r\n\r\nDebug of file object_detection/model_lib.py shows:\r\nFile modifications:\r\n```\r\neval_specs = [] #line 646\r\n  cntr = 0 # add counter\r\n  for eval_spec_name, eval_input_fn in zip(eval_spec_names, eval_input_fns):\r\n    cntr += 1 # add counter inc\r\n    exporter_name = '{}_{}'.format(final_exporter_name, eval_spec_name)\r\n    print(\"{}) exporter_name={}; eval_spec_name={}(type {})\".format(cntr, exporter_name, eval_spec_name, type(eval_spec_name))) # add debuging variables\r\n    exporter = tf.estimator.FinalExporter(\r\n        name=exporter_name, serving_input_receiver_fn=predict_input_fn)\r\n    eval_specs.append(\r\n        tf.estimator.EvalSpec(\r\n            name=eval_spec_name),\r\n            input_fn=eval_input_fn,\r\n            steps=None,\r\n            exporters=exporter))\r\n```\r\nResult:\r\n```\r\n...\r\n1) exporter_name=Servo_0; eval_spec_name=0(type <type 'int'>)\r\n...\r\n```\r\nPossible solution (IMHO):\r\nChange in object_detection/model_lib.py:\r\n```\r\neval_specs.append(\r\n        tf.estimator.EvalSpec(\r\n            name=eval_spec_name),\r\n            input_fn=eval_input_fn,\r\n            steps=None,\r\n            exporters=exporter))\r\n```\r\nto:\r\n```\r\neval_specs.append(\r\n        tf.estimator.EvalSpec(\r\n            name=str(eval_spec_name),\r\n            input_fn=eval_input_fn,\r\n            steps=None,\r\n            exporters=exporter))\r\n```\r\n\r\nP.S. Can't understand why in file object_detection/model_lib.py at line 644 list of integers generated:\r\n```\r\nif eval_spec_names is None: # line 643\r\n  eval_spec_names = range(len(eval_input_fns)) # creates integers. Line 644\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/models/issues/comments/425077742","html_url":"https://github.com/tensorflow/models/issues/5371#issuecomment-425077742","issue_url":"https://api.github.com/repos/tensorflow/models/issues/5371","id":425077742,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTA3Nzc0Mg==","user":{"login":"Kevze","id":7648075,"node_id":"MDQ6VXNlcjc2NDgwNzU=","avatar_url":"https://avatars2.githubusercontent.com/u/7648075?v=4","gravatar_id":"","url":"https://api.github.com/users/Kevze","html_url":"https://github.com/Kevze","followers_url":"https://api.github.com/users/Kevze/followers","following_url":"https://api.github.com/users/Kevze/following{/other_user}","gists_url":"https://api.github.com/users/Kevze/gists{/gist_id}","starred_url":"https://api.github.com/users/Kevze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kevze/subscriptions","organizations_url":"https://api.github.com/users/Kevze/orgs","repos_url":"https://api.github.com/users/Kevze/repos","events_url":"https://api.github.com/users/Kevze/events{/privacy}","received_events_url":"https://api.github.com/users/Kevze/received_events","type":"User","site_admin":false},"created_at":"2018-09-27T12:48:30Z","updated_at":"2018-09-27T12:48:30Z","author_association":"NONE","body":"> Give this line of change a shot (wrapping `eval_spec_name` with `str`):\r\n> https://github.com/tensorflow/models/pull/5372/files#diff-76df8ca264a059e8a3003851fe4d7849R653\r\n\r\nThis seems to work for me, thanks!\r\n"}}
{"actor":{"display_login":"Kevze"}}