2017-09-21 1 views
2

양방향 LSTM의 입력으로 공급되기 전에 이미지를 처리하는 방법을 알고 싶습니다. 여기 이미지를 양방향 LSTM 네트워크의 입력으로 사용

outputs, _, _ = tf.nn.bidirectional_dynamic_rnn(lstm_fw_cell, lstm_bw_cell, x, dtype=tf.float32) 

문제와 관련된 내 코드의 일부이다 :이 라인에서

AttributeError: 'list' object has no attribute 'get_shape' 

: 나는 나에게 코드를 실행할 때마다 난 항상이 오류가

def bi_rnn(features, labels, mode): 
    x = tf.unstack(features, num_inputs, 1) 
    ... # cell initialization 
    # Get lstm cell output 
    try: 
     outputs, _, _ = tf.nn.bidirectional_dynamic_rnn(lstm_fw_cell, lstm_bw_cell, x, dtype=tf.float32) 

... 

def serving_input_fn(): 
    feature_placeholders = { 
     'features': tf.placeholder(tf.float32, [None, num_inputs]) 
    } 
    features = { 
     key: tf.expand_dims(tensor, -1) for key, tensor in feature_placeholders.items() 
    } 
    features = tf.squeeze(features, axis=[2]) 
    return InputFnOps(features, None, feature_placeholders) 

def read_dataset(img_paths, labels): 
    def _input_fn(): 
     ... # reading image paths omitted 
     image_files = tf.image.decode_png(image_files) 
     image_files = tf.image.resize_images(image_files, [1024, 128]) 
     image_files = evaluate_images(image_files) 
     ... # labels part omitted 
     return tf.convert_to_tensor(np.array(image_files)), labels2 
    return _input_fn 
+0

제공되는 코드와 오류를 사용하여 정확한 오류를 추적 할 수는 없습니다 (전체 스택 추적은 일반적으로 오류보다 유용합니다). 그러나 내 생각에 메서드가 예상하는 Python 목록을 전달하는 것입니다. 텐서. – iga

+0

다음은 코드와 스택 트레이스를 포함하는 요점이다 https://gist.github.com/selcouthlyBlue/ee06c170ea22ee82695a219e871f9c2c –

+0

이 문제이지만, bidirectional_dynamic_rnn에 대한 문서는 '귀하의 경우 inputs' ('x'가 필요한 경우 확실하지 않음)가 Tensor 또는 Tensors의 튜플이되도록합니다. 요점의 코드에서 ('tf.unstack'에 의해 반환 된) 목록입니다. 왜 거기에'tf.unstack '을 호출해야하는지 모르겠습니다. – iga

답변

0

나는 꽤 많은 이걸 이미 포기하고 something else 작품을 만들었습니다. 이것과는 다른 TFLearn 기능을 사용하지 않습니다. 최근에 제가 작업하고있는 것은 here을 볼 수있는 문제가 있습니다.

관련 문제