2016-12-01 2 views
0

Mein plantform ist MAC OS 10.12, wenn ich im2txt mitTensorflow Modelle im2txt Ausgabe

with tf.gfile.FastGFile(captions_file, "r") as f: 
caption_data = json.load(f) 

testen ein Fehler

TypeError: the JSON object must be str, not 'bytes' 

hat, dann habe ich versuchen Typ Zeichenfolge zu ändern, zu kodieren 'utf-8' und Objekt String ...... aber es gibt keinen Effekt

+0

'json.load (f.read())'? – sygi

Antwort

2

Dieser arbeitete für mich

with tf.gfile.FastGFile(captions_file, "r") as f: 
     caption_data = json.loads(str(f.read(), encoding = "utf-8")) 
Verwandte Themen