{"action":"opened","issue":{"url":"https://api.github.com/repos/tensorflow/models/issues/2426","repository_url":"https://api.github.com/repos/tensorflow/models","labels_url":"https://api.github.com/repos/tensorflow/models/issues/2426/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/models/issues/2426/comments","events_url":"https://api.github.com/repos/tensorflow/models/issues/2426/events","html_url":"https://github.com/tensorflow/models/issues/2426","id":259447849,"number":2426,"title":"[attention_ocr] error on new dataset","user":{"login":"everhu","id":20342443,"avatar_url":"https://avatars0.githubusercontent.com/u/20342443?v=4","gravatar_id":"","url":"https://api.github.com/users/everhu","html_url":"https://github.com/everhu","followers_url":"https://api.github.com/users/everhu/followers","following_url":"https://api.github.com/users/everhu/following{/other_user}","gists_url":"https://api.github.com/users/everhu/gists{/gist_id}","starred_url":"https://api.github.com/users/everhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everhu/subscriptions","organizations_url":"https://api.github.com/users/everhu/orgs","repos_url":"https://api.github.com/users/everhu/repos","events_url":"https://api.github.com/users/everhu/events{/privacy}","received_events_url":"https://api.github.com/users/everhu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-21T10:23:38Z","updated_at":"2017-09-21T10:23:38Z","closed_at":null,"author_association":"NONE","body":"I want to train attention_ocr on new dataset, each example has 1 image, size of image is (800,600,3). The max_sequence_length is 18, size of charset is 37(10 digits + 26 uppercase + 1 null), config as follow:\r\n\r\n```python\r\nDEFAULT_CONFIG = {\r\n    'name': 'trade',\r\n    'splits': {\r\n        'train': {\r\n            'size': 5000,\r\n            'pattern': 'train/train*'\r\n        },\r\n        'test': {\r\n            'size': 234,\r\n            'pattern': 'test/test*'\r\n        }\r\n    },\r\n    'charset_filename': 'charset37.txt',\r\n    'image_shape': (800, 600, 3),  # height, width, channel\r\n    'num_of_views': 1,\r\n    'max_sequence_length': 18,\r\n    'null_code': 36,\r\n    'items_to_descriptions': {\r\n        'image': 'color image',\r\n        'label': 'characters codes',\r\n        'text': 'unicode string',\r\n        'length': 'length of the encoded text',\r\n        'num_of_view': '1'\r\n    }\r\n}\r\n```\r\n\r\nCode to generate tfrecord as follow:\r\n\r\n```python\r\next = 'RAW'\r\n\r\nimg = Image.open(img_path)\r\nwidth, height = img.size\r\nimg = img.resize((600, 800))\r\nimg_raw = img.tobytes()\r\n\r\ntext = item.split('_')[0].upper()  # 01442000MA4WG2LJ4N_e5dcd8a67e6bf1a89a8ef794d6449f03.jpeg\r\nids_unpadded = [_map_rev[k] for k in text]\r\nids_padded = ids_unpadded + [nul] * (18 - len(ids_unpadded))\r\n\r\nfeature={\r\n    'image/format': _bytes_feature([ext]),\r\n    'image/encoded': _bytes_feature([img_raw]),\r\n    'image/class': _int64_feature(ids_padded),\r\n    'image/unpadded_class': _int64_feature(ids_unpadded),\r\n    'height': _int64_feature([800]),\r\n    'width': _int64_feature([600]),\r\n    'orig_width': _int64_feature([600]),\r\n    'image/text': _bytes_feature([text])\r\n}\r\n```\r\n\r\nCommand to train:\r\n```\r\npython train.py --dataset_name trade --dataset_dir /root/data/trade --use_augment_input false --train_log_dir /tmp/trade/train\r\n```\r\n\r\nError log:\r\n\r\n```\r\nINFO 2017-09-21 18:12:57.000118: train.py: 167 Use already existing training directory /tmp/trade/train\r\nINFO 2017-09-21 18:12:57.000118: fsns.py: 131 Using trade dataset split_name=train dataset_dir=/root/data/trade\r\nDEBUG 2017-09-21 18:12:57.000301: model.py: 352 images: Tensor(\"shuffle_batch:0\", shape=(32, 800, 600, 3), dtype=float32)\r\nDEBUG 2017-09-21 18:12:57.000304: model.py: 357 Views=1 single view: Tensor(\"AttentionOcr_v1/split:0\", shape=(32, 800, 600, 3), dtype=float32)\r\nDEBUG 2017-09-21 18:12:57.000304: model.py: 200 Using final_endpoint=Mixed_5d\r\nDEBUG 2017-09-21 18:12:58.000429: model.py: 364 Conv tower: Tensor(\"AttentionOcr_v1/conv_tower_fn/INCE/InceptionV3/Mixed_5d/concat:0\", shape=(32, 97, 72, 288), dtype=float32)\r\nDEBUG 2017-09-21 18:12:58.000429: model.py: 368 Conv tower w/ encoded coordinates: Tensor(\"AttentionOcr_v1/conv_tower_fn/INCE/InceptionV3/Mixed_5d/concat:0\", shape=(32, 97, 72, 288), dtype=float32)\r\nDEBUG 2017-09-21 18:12:58.000432: model.py: 372 Pooled views: Tensor(\"AttentionOcr_v1/pool_views_fn/STCK/Reshape:0\", shape=(32, 6984, 288), dtype=float32)\r\nDEBUG 2017-09-21 18:12:58.000433: sequence_layers.py: 421 Use AttentionWithAutoregression as a layer class\r\nDEBUG 2017-09-21 18:12:59.000535: model.py: 375 chars_logit: Tensor(\"AttentionOcr_v1/sequence_logit_fn/SQLR/concat:0\", shape=(32, 18, 37), dtype=float32)\r\nWARNING:tensorflow:From /root/everhu/tensorflowapp/ocr/model.py:407: get_total_loss (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.\r\nInstructions for updating:\r\nUse tf.losses.get_total_loss instead.\r\nWARNING 2017-09-21 18:12:59.000973: tf_logging.py: 90 From /root/everhu/tensorflowapp/ocr/model.py:407: get_total_loss (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.\r\nInstructions for updating:\r\nUse tf.losses.get_total_loss instead.\r\nWARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/losses/python/losses/loss_ops.py:261: get_losses (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.\r\nInstructions for updating:\r\nUse tf.losses.get_losses instead.\r\nWARNING 2017-09-21 18:12:59.000974: tf_logging.py: 90 From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/losses/python/losses/loss_ops.py:261: get_losses (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.\r\nInstructions for updating:\r\nUse tf.losses.get_losses instead.\r\nWARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/losses/python/losses/loss_ops.py:263: get_regularization_losses (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.\r\nInstructions for updating:\r\nUse tf.losses.get_regularization_losses instead.\r\nWARNING 2017-09-21 18:12:59.000974: tf_logging.py: 90 From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/losses/python/losses/loss_ops.py:263: get_regularization_losses (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.\r\nInstructions for updating:\r\nUse tf.losses.get_regularization_losses instead.\r\n2017-09-21 18:13:11.757058: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.\r\n2017-09-21 18:13:11.757121: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.\r\nINFO:tensorflow:Restoring parameters from /tmp/trade/train/model.ckpt-0\r\nINFO 2017-09-21 18:13:11.000764: tf_logging.py: 82 Restoring parameters from /tmp/trade/train/model.ckpt-0\r\nINFO:tensorflow:Starting Session.\r\nINFO 2017-09-21 18:13:17.000928: tf_logging.py: 82 Starting Session.\r\nINFO:tensorflow:Saving checkpoint to path /tmp/trade/train/model.ckpt\r\nINFO 2017-09-21 18:13:18.000008: tf_logging.py: 82 Saving checkpoint to path /tmp/trade/train/model.ckpt\r\nINFO:tensorflow:Starting Queues.\r\nINFO 2017-09-21 18:13:18.000013: tf_logging.py: 82 Starting Queues.\r\nINFO:tensorflow:global_step/sec: 0\r\nINFO 2017-09-21 18:13:19.000014: tf_logging.py: 121 global_step/sec: 0\r\nINFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, Input to reshape is a tensor with 1920000 values, but the requested shape has 1440000\r\n     [[Node: Reshape_6 = Reshape[T=DT_UINT8, Tshape=DT_INT32, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](case/If_1/Merge, Reshape_6/shape)]]\r\nINFO 2017-09-21 18:13:27.000583: tf_logging.py: 82 Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, Input to reshape is a tensor with 1920000 values, but the requested shape has 1440000\r\n     [[Node: Reshape_6 = Reshape[T=DT_UINT8, Tshape=DT_INT32, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](case/If_1/Merge, Reshape_6/shape)]]\r\nterminate called after throwing an instance of 'std::bad_alloc'\r\n  what():  std::bad_alloc\r\nAborted\r\n```\r\n"}}
{"actor":{"display_login":"everhu"}}