python - Kunne ikke indlæse en præ-uddannet resnet pb-fil fra Tensorflows officielle hjemmeside

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg hentede en pre-uddannet resnet pb fil fra
  http://download.tensorflow.org/models/official/resnet\_v1\_imagenet\_savedmodel.tar.gz[3]


Og da jeg forsøgte at importere den til grafen med følgende kode


tf.Graph().as\_default():

    with tf.gfile.FastGFile(path, 'rb') as file:
        graph\_def = tf.GraphDef()

        graph\_def.ParseFromString(file.read())

        tf.import\_graph\_def(graph\_def, name='')`


Jeg fik fejlen


    graph\_def.ParseFromString(file.read())
  File "D:Anaconda3libsite-packagesgoogleprotobufmessage.py", line 185, in
 ParseFromString
    self.MergeFromString(serialized)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternalpython\_message.p
y", line 1083, in MergeFromString
    if self.\_InternalParse(serialized, 0, length) != length:
  File "D:Anaconda3libsite-packagesgoogleprotobufinternalpython\_message.p
y", line 1120, in InternalParse
    pos = field\_decoder(buffer, new\_pos, end, self, field\_dict)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 633, in DecodeField
    if value.\_InternalParse(buffer, pos, new\_pos) != new\_pos:
  File "D:Anaconda3libsite-packagesgoogleprotobufinternalpython\_message.p
y", line 1120, in InternalParse
    pos = field\_decoder(buffer, new\_pos, end, self, field\_dict)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 612, in DecodeRepeatedField
    if value.add().\_InternalParse(buffer, pos, new\_pos) != new\_pos:
  File "D:Anaconda3libsite-packagesgoogleprotobufinternalpython\_message.p
y", line 1120, in InternalParse
    pos = field\_decoder(buffer, new\_pos, end, self, field\_dict)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 743, in DecodeMap
    if submsg.\_InternalParse(buffer, pos, new\_pos) != new\_pos:
  File "D:Anaconda3libsite-packagesgoogleprotobufinternalpython\_message.p
y", line 1109, in InternalParse
    new\_pos = local\_SkipField(buffer, new\_pos, end, tag\_bytes)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 850, in SkipField
    return WIRETYPE\_TO\_SKIPPER[wire\_type](buffer, pos, end)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 799, in \_SkipGroup
    new\_pos = SkipField(buffer, pos, end, tag\_bytes)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 850, in SkipField
    return WIRETYPE\_TO\_SKIPPER[wire\_type](buffer, pos, end)
  File "D:Anaconda3libsite-packagesgoogleprotobufinternaldecoder.py", lin
e 814, in \_SkipFixed32
    raise \_DecodeError('Truncated message.')
google.protobuf.message.DecodeError: Truncated message.


'sti' er pb-filen.

Bedste reference


Jeg finder ud af, at pb-filen fra http://download.tensorflow.org/models/official/resnet\_v1\_imagenet\_savedmodel.tar.gz er kun 806KB. Så det kan være en graffil uden vægte [4]