2017-01-18 10 views
0

Ich versuche, das Tensorflow inception_v3-Modell für ein Transfer-Lernprojekt zu verwenden. Ich bekomme den folgenden Fehler beim Erstellen des Modells. TypeError: Expected int32, got list containing Tensors of type '_Message' instead. Derselbe Fehler tritt nicht auf, wenn dasselbe Skript für das inception_v1-Modell verwendet wird. Die Modelle aus slim.nets importiert werdentensorflow schlanke inception_v3 Modellfehler

auf CPU Lauf Tensorflow Version: 0.12.1

Script

import tensorflow as tf 
slim = tf.contrib.slim 
import models.inception_v3 as inception_v3 

print("initializing model") 
inputs=tf.placeholder(tf.float32, shape=[32,299,299,3]) 
with slim.arg_scope(inception_v3.inception_v3_arg_scope()): 
    logits,endpoints = inception_v3.inception_v3(inputs, num_classes=1001, is_training=False) 

trainable_vars=tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES) 
for tvars in trainable_vars: 
    print tvars.name 

Vollfehlermeldung

Traceback (most recent call last): 
File "test.py", line 8, in <module> 
logits,endpoints = inception_v3.inception_v3(inputs, num_classes=1001, is_training=False) 
File "/home/ashish/projects/python/fashion-language/models/inception_v3.py", line 576, in inception_v3 
depth_multiplier=depth_multiplier) 
File "/home/ashish/projects/python/fashion-language/models/inception_v3.py", line 181, in inception_v3_base 
net = array_ops.concat([branch_0, branch_1, branch_2, branch_3], 3) 
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1075, in concat 
dtype=dtypes.int32).get_shape(
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 669, in convert_to_tensor 
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) 
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 176, in _constant_tensor_conversion_function 
return constant(v, dtype=dtype, name=name) 
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 165, in constant 
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) 
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto 
_AssertCompatible(values, dtype) 
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible 
(dtype.name, repr(mismatch), type(mismatch).__name__)) 
TypeError: Expected int32, got list containing Tensors of type '_Message' instead. 

Antwort

1

gefunden Mein Fehler, ich importierte die m odel von https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim/python/slim/nets, während die aktualisierten Modelle bei https://github.com/tensorflow/models/tree/master/slim/nets sind.

Immer noch nicht verstanden, warum es zwei verschiedene Repositories für die gleichen Klassen gibt. Muss ein triftiger Grund sein.