jerryli27 / AniSeg

A faster-rcnn model for anime character segmentation.
Apache License 2.0
201 stars 15 forks source link

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

Closed hadaev8 closed 4 years ago

hadaev8 commented 5 years ago

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

everyoneishappy commented 5 years ago

did ever find what was causing this? Have the same

everyoneishappy commented 5 years ago

@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 4 years ago

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)