2017-09-10 1 views
0

내가 TensorFlow의 이미지를 분류하기 위해 길쌈 신경망을 코딩하고 있지만 문제가와 형식 오류 :Tensorflow : numpy_input_fn

내 NumPy와의 평평한 이미지의 배열 (0에서 RGB 값으로 3 개 채널을 공급하려고 documentati에서

train_input_fn = tf.estimator.inputs.numpy_input_fn(
    x={'x': train_x}, 
    y=train_y, 
    batch_size=8, 
    num_epochs=None, 
    shuffle=True) 

:

TypeError: Failed to convert object of type <class 'dict'> to Tensor. 
    Contents: {'x': <tf.Tensor 'random_shuffle_queue_DequeueMany:1' shape=(8, 
    196608) dtype=uint8>}. Consider casting elements to a supported type. 

내 numpy_imput_fn은 다음과 같습니다 : 나는 다음과 같은 오류를 얻을 tf.estimator.inputs.numpy_input_fn 255)

x: dict of numpy array object.

답변

0

걱정하지 마라, 그것을 고정 같은 문제를 갖는 경우 : 함수에이 x는 NumPy와 어레이의 딕셔너리되어야한다고 알려져있다. 내 모델 기능에서 나는 가지고 있었다 :

input_layer = tf.reshape(features, [-1, 256, 256, 1]) 

어떤 오류가 발생했습니다. 이 문제를 해결하려면 기능 사전에서 'x'키에 액세스해야합니다.

input_layer = tf.reshape(features['x'], [-1, 256, 256, 1])