jerryli27/AniSeg

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 394: invalid start byte

hadaev8 opened this issue · 3 comments

As I understand, tensorflow cant load checkpoint
Code and full trace:
https://colab.research.google.com/drive/1zQSmHVrB0VN6d7I16PZk6ED9oRIHMQc1

did ever find what was causing this? Have the same

@hadaev8 ln 100 of detection_inference.py
with tf.gfile.Open(inference_graph_path, 'rb') as graph_def_file:

adding 'b' flag worked for me

gwern commented

This appears to affect both face detection & figure segmentation. The diff:

diff --git a/object_detection/inference/detection_inference.py b/object_detection/inference/detection_inference.py
index 298fc2d..c205504 100644
--- a/object_detection/inference/detection_inference.py
+++ b/object_detection/inference/detection_inference.py
@@ -97,7 +97,7 @@ def build_inference_graph(image_tensor, inference_graph_path, override_num_detec
     detected_labels_tensor: Detected labels. Int64 tensor,
         shape=[num_detections]
   """
-  with tf.gfile.Open(inference_graph_path, 'r') as graph_def_file:
+  with tf.gfile.Open(inference_graph_path, 'rb') as graph_def_file:
     graph_content = graph_def_file.read()
   graph_def = tf.GraphDef()
   graph_def.MergeFromString(graph_content)
diff --git a/object_detection/inference/mask_inference.py b/object_detection/inference/mask_inference.py
index 146f5d6..15e197d 100644
--- a/object_detection/inference/mask_inference.py
+++ b/object_detection/inference/mask_inference.py
@@ -117,7 +117,7 @@ def build_inference_graph(image_tensor, inference_graph_path, override_num_detec
     detected_labels_tensor: Detected labels. Int64 tensor,
         shape=[num_detections]
   """
-  with tf.gfile.Open(inference_graph_path, 'r') as graph_def_file:
+  with tf.gfile.Open(inference_graph_path, 'rb') as graph_def_file:
     graph_content = graph_def_file.read()
   graph_def = tf.GraphDef()
   graph_def.MergeFromString(graph_content)