0

I have had no problems downloading and using a model downloaded from Microsoft Custom Vision. However when I transfer the model and python code to another computer, the program crashes at this line:

graph_def.ParseFromString(f.read())

Windows throws an error saying something to the effect of: "A problem has occurred, the program is not working correctly. The program will be closed and Windows will notify you if a solution to the problem is found."

I haven't been able to figure out what is wrong and the debugging methods that I know of are not helping. The program doesn't proceed far enough to get to pdb.pm(), and python -m -trace --trace name.py halts at position 0 of the program saying it can't decode unicode.

full code to the area in question is:

        graph_def = tf.compat.v1.GraphDef()
        try:
            with tf.io.gfile.GFile(path_to_custom_vision_model, "rb") as f:
                try:
                    print("Parsing string...")
                    graph_def.ParseFromString(f.read())
                except:
                    pdb.pm()
                tf.import_graph_def(graph_def, name="")
        except EnvironmentError as err:
            print(err)
            print("Custom Visionのモデルを読み取ろうとした時にエラーが起きました。パスはあってるか確認してください。プログラムを終わらせます。")
            input("続けるにはenterを押してください")
            exit(-1)

Any solutions or suggestions of things to try to figure out the problem are much appreciated!

Tyson
  • 592
  • 4
  • 13
  • Would you mind add "# -*- coding: utf-8 -*-" to the header part of your script and run debugger again. – Vu Gia Truong Jul 12 '19 at 06:32
  • Thank you for the idea. I tried that and got the same error. I also tried typing "encoding" instead of "coding", and also tried just "#encoding: utf-8" . Maybe Python's trace doesn't support unicode? – Tyson Jul 12 '19 at 08:34
  • It's weird. Why don't you replace every Japanese character in your program by English and try again – Vu Gia Truong Jul 13 '19 at 07:53

0 Answers0