models icon indicating copy to clipboard operation
models copied to clipboard

google.protobuf.text_format.ParseError: 6:21 : 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Open xunzhaogancao opened this issue 8 years ago • 14 comments

My environment: anaconda 4.2.0, python3.5.5, win10 64bit, tensorflow-gpu 1.10.0 When I test object_detection, It happens: (C:\tensorflow\tensorflow) C:\tensorflow\tensorflow\models\research>python object_detection/builders/input_reader_builder_test.py 2018-08-20 09:08:53.105492: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2018-08-20 09:08:54.106143: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 0 with properties: name: GeForce GTX 1060 with Max-Q Design major: 6 minor: 1 memoryClockRate(GHz): 1.3415 pciBusID: 0000:01:00.0 totalMemory: 6.00GiB freeMemory: 4.97GiB 2018-08-20 09:08:54.117708: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0 2018-08-20 09:08:55.612782: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-08-20 09:08:55.618360: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0 2018-08-20 09:08:55.622696: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0: N 2018-08-20 09:08:55.626112: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1843 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 6.1) E2018-08-20 09:08:55.773250: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0 2018-08-20 09:08:55.777761: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-08-20 09:08:55.782797: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0 2018-08-20 09:08:55.785656: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0: N 2018-08-20 09:08:55.788341: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1843 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 6.1) E..

ERROR: test_build_tf_record_input_reader (main.InputReaderBuilderTest)

Traceback (most recent call last): File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1291, in _ConsumeSingleByteString result = text_encoding.CUnescape(text[1:-1]) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_encoding.py", line 105, in CUnescape .decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "object_detection/builders/input_reader_builder_test.py", line 79, in test_build_tf_record_input_reader text_format.Merge(input_reader_text_proto, input_reader_proto) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge descriptor_pool=descriptor_pool) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines return parser.MergeLines(lines, message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines self._ParseOrMerge(lines, message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField value = tokenizer.ConsumeString() File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString the_bytes = self.ConsumeByteString() File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString the_list = [self._ConsumeSingleByteString()] File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1293, in _ConsumeSingleByteString raise self.ParseError(str(e)) google.protobuf.text_format.ParseError: 5:21 : 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

====================================================================== ERROR: test_build_tf_record_input_reader_and_load_instance_masks (main.InputReaderBuilderTest)

Traceback (most recent call last): File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1291, in _ConsumeSingleByteString result = text_encoding.CUnescape(text[1:-1]) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_encoding.py", line 105, in CUnescape .decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "object_detection/builders/input_reader_builder_test.py", line 111, in test_build_tf_record_input_reader_and_load_instance_masks text_format.Merge(input_reader_text_proto, input_reader_proto) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge descriptor_pool=descriptor_pool) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines return parser.MergeLines(lines, message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines self._ParseOrMerge(lines, message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField value = tokenizer.ConsumeString() File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString the_bytes = self.ConsumeByteString() File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString the_list = [self._ConsumeSingleByteString()] File "C:\tensorflow\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1293, in _ConsumeSingleByteString raise self.ParseError(str(e)) google.protobuf.text_format.ParseError: 6:21 : 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape


Ran 4 tests in 2.721s

FAILED (errors=2)

xunzhaogancao avatar Aug 20 '18 01:08 xunzhaogancao

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. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce

tensorflowbutler avatar Aug 20 '18 12:08 tensorflowbutler

  • Windows 10.
  • TensorFlow (cpu) installed from git clone.
  • Python version 3.6.5
  • Using Virtual environment

I have the exact same issue occuring to me. Use case: Trying to train my own model. Generated both .record files (train and test), added & edited ssd_mobilenet_v1_pets.config and added object_detection.pbtxt. Now I'm trying to execute the following command: train.py --logtostderr --train_dir=data --pipeline_config_path=ssd_mobilenet_v1_pets.config I copied both train.py and ssd_mobilenet_v1_pets.config file to the same folder in which I execute the command in cmd virtual environment.

Does anyone have an idea on how to solve this error?

I'll add my log & error as well but from my understanding it's basically the same.

`(venv) C:\venv\models\research\object_detection\test_images\train\keuken>train.py --logtostderr --train_dir=data --pipeline_config_path=ssd_mobilenet_v1_pets.config WARNING:tensorflow:From C:\venv\lib\site-packages\tensorflow\python\platform\app.py:125: main (from main) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. Traceback (most recent call last): File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1291, in _ConsumeSingleByteString result = text_encoding.CUnescape(text[1:-1]) File "C:\venv\lib\site-packages\google\protobuf\text_encoding.py", line 105, in CUnescape .decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\venv\models\research\object_detection\test_images\train\keuken\train.py", line 184, in tf.app.run() File "C:\venv\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "C:\venv\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func return func(*args, **kwargs) File "C:\venv\models\research\object_detection\test_images\train\keuken\train.py", line 93, in main FLAGS.pipeline_config_path) File "C:\venv\models\research\object_detection\utils\config_util.py", line 94, in get_configs_from_pipeline_file text_format.Merge(proto_str, pipeline_config) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge descriptor_pool=descriptor_pool) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines return parser.MergeLines(lines, message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines self._ParseOrMerge(lines, message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField value = tokenizer.ConsumeString() File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString the_bytes = self.ConsumeByteString() File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString the_list = [self._ConsumeSingleByteString()] File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1293, in _ConsumeSingleByteString raise self.ParseError(str(e)) google.protobuf.text_format.ParseError: 160:25 : 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape`

Ayrtonalec avatar Aug 21 '18 14:08 Ayrtonalec

change '\' to '/' in the config file include input_path and label_map_path

liminghao1630 avatar Sep 13 '18 09:09 liminghao1630

  • Windows 10.
  • TensorFlow (cpu) installed from git clone.
  • Python version 3.6.5
  • Using Virtual environment

I have the exact same issue occuring to me. Use case: Trying to train my own model. Generated both .record files (train and test), added & edited ssd_mobilenet_v1_pets.config and added object_detection.pbtxt. Now I'm trying to execute the following command: train.py --logtostderr --train_dir=data --pipeline_config_path=ssd_mobilenet_v1_pets.config I copied both train.py and ssd_mobilenet_v1_pets.config file to the same folder in which I execute the command in cmd virtual environment.

Does anyone have an idea on how to solve this error?

I'll add my log & error as well but from my understanding it's basically the same.

`(venv) C:\venv\models\research\object_detection\test_images\train\keuken>train.py --logtostderr --train_dir=data --pipeline_config_path=ssd_mobilenet_v1_pets.config WARNING:tensorflow:From C:\venv\lib\site-packages\tensorflow\python\platform\app.py:125: main (from main) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. Traceback (most recent call last): File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1291, in _ConsumeSingleByteString result = text_encoding.CUnescape(text[1:-1]) File "C:\venv\lib\site-packages\google\protobuf\text_encoding.py", line 105, in CUnescape .decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\venv\models\research\object_detection\test_images\train\keuken\train.py", line 184, in tf.app.run() File "C:\venv\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "C:\venv\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func return func(*args, **kwargs) File "C:\venv\models\research\object_detection\test_images\train\keuken\train.py", line 93, in main FLAGS.pipeline_config_path) File "C:\venv\models\research\object_detection\utils\config_util.py", line 94, in get_configs_from_pipeline_file text_format.Merge(proto_str, pipeline_config) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge descriptor_pool=descriptor_pool) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines return parser.MergeLines(lines, message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines self._ParseOrMerge(lines, message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField value = tokenizer.ConsumeString() File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString the_bytes = self.ConsumeByteString() File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString the_list = [self._ConsumeSingleByteString()] File "C:\venv\lib\site-packages\google\protobuf\text_format.py", line 1293, in _ConsumeSingleByteString raise self.ParseError(str(e)) google.protobuf.text_format.ParseError: 160:25 : 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape`

bro can u solve?

Shubhamrock428 avatar Oct 07 '18 03:10 Shubhamrock428

@liminghao1630 change '' to '/' in the config file include input_path and label_map_path.

I have done this and still raises the same issue. I am using windows 7, 4GB Ram.

rahulsanju avatar Mar 13 '19 13:03 rahulsanju

Windows 10. TensorFlow (cpu) installed from git clone. Python version 3.6.8

I have got the same error. (tensorflow_cpu) C:\Users\Divin\tensorflow\workspace\training_demo>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_coco.config

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see:

  • https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  • https://github.com/tensorflow/addons If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\platform\app.py:125: main (from main) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. Traceback (most recent call last): File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 1291, in _ConsumeSingleByteString result = text_encoding.CUnescape(text[1:-1]) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_encoding.py", line 105, in CUnescape .decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 184, in tf.app.run() File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func return func(*args, **kwargs) File "train.py", line 93, in main FLAGS.pipeline_config_path) File "C:\Users\Divin\tensorflow\models\research\object_detection\utils\config_util.py", line 98, in get_configs_from_pipeline_file text_format.Merge(proto_str, pipeline_config) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge descriptor_pool=descriptor_pool) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines return parser.MergeLines(lines, message) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines self._ParseOrMerge(lines, message) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField value = tokenizer.ConsumeString() File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString the_bytes = self.ConsumeByteString() File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString the_list = [self._ConsumeSingleByteString()] File "C:\Users\Divin\Anaconda3\envs\tensorflow_cpu\lib\site-packages\google\protobuf\text_format.py", line 1293, in _ConsumeSingleByteString raise self.ParseError(str(e)) google.protobuf.text_format.ParseError: 151:25 : 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Maxalop avatar Apr 27 '19 20:04 Maxalop

change '' to '/' in the config file include input_path and label_map_path

Sir, can you please elaborate the solution because i am facing the same problem

kamal0803 avatar Jun 07 '19 08:06 kamal0803

change '' to '/' in the config file include input_path and label_map_path

Sir, can you please elaborate the solution because i am facing the same problem

kamal0803 avatar Jun 07 '19 08:06 kamal0803

change '' to '/' in the config file include input_path and label_map_path

Sir, can you please elaborate the solution because i am facing the same problem

kamal0803 avatar Jun 07 '19 08:06 kamal0803

change '' to '/' in the config file include input_path and label_map_path

Sir, can you please elaborate the solution because i am facing the same problem

Just replace all \ with / and replace " with '.

hassaanseeker avatar Jun 19 '19 11:06 hassaanseeker

change '' to '/' in the config file include input_path and label_map_path

Sir, can you please elaborate the solution because i am facing the same problem

Just replace all \ with / and replace " with '.

exactly, thanks.

darissa avatar Sep 20 '19 07:09 darissa

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Sep 11 '20 18:09 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Sep 18 '20 19:09 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Sep 25 '20 20:09 google-ml-butler[bot]