2017-09-11 1 views
1

TIFF 형식의 일부 지형 공간 이미지 데이터를 읽으려면 tensorflow를 사용하고 있습니다. 나는 다음과 같은 것을 사용하고 싶다.데이터 판독기를 사용하여 tensorflow에서 tiff 파일을 읽는 올바른 방법

images = tf.convert_to_tensor(image_list, dtype=tf.string) 
    img_contents = tf.read_file(images) 
    img = tf.image.decode_image(img_contents, channels=3) 

나는 내가 독자적으로 디코딩 기능을 작성해야한다고 생각한다. 하지만 img_contents는 실제로 파일에 액세스 할 때 사용할 수없는 텐서 문자열입니다. 티파니 이미지를 읽을 수있는 방법이 있습니까?

답변

0

당신은 파이썬에서 파일을 구문 분석하고, feed_dict에 의해 훈련 그래프를 TensorFlow 단지 데모 코드를 따르지만을 통과 할 수는 실행 가능한되지 않습니다 :

def read_tiff_file(file_path): 
    #### code that read tiff_file content 
    return image_content # return the image content with 18 * 18 * 3 

image_pl = tf.placeholder([18, 18, 3], tf.float32) # suppose your image is 18*18 with 3 channels 

## constructing tf.graph with image_pl 
## ... 

train_step = tf.train.GradientDescentOptimizer(0.5).minimize(loss) 

with tf.Session as sess: 
    for file_name in file_name_list: 
     image_content = read_tiff_file(file_name) 
     sess.run(train_step, feed_dict={image_pl:image_content}) 
+0

그냥 궁금, 내가 DataReader를 계속 사용 할 수있는 방법이있다 대기열에요? – QSMonk

+0

@QSMonk tiff_decode가 없으므로 op를 작성해야합니다. 그렇지 않으면 불가능합니다. –

관련 문제