기능이 포함 된 여러 CSV 파일이 있습니다. 하나의 기능은 이미지의 파일 이름입니다. csv 파일을 줄 단위로 읽으려면 해당 이미지의 경로를 새 큐로 푸시합니다. 두 대기열은 모두 병렬로 처리해야합니다. (예를 들어, read_csv
) 헬퍼 함수의텐서 흐름의 자동 엔큐와 비동기 io의 대기열 합계
csv_queue = tf.FIFOQueue(10, tf.string)
csv_init = csv_queue.enqueue_many(['sample1.csv','sample2.csv','sample3.csv'])
path, label = read_label(csv_queue)
image_queue = tf.FIFOQueue(100, tf.string)
image_init = image_queue.enqueue(path)
_, image = read_image(image_queue)
with tf.Session() as sess:
csv_init.run()
image_init.run()
print(sess.run([key, label, path])) # works
print(sess.run(image)) # works
print(sess.run([key, label, path])) # works
print(sess.run(image)) # will deadlock unlike I do iq_init.run()
구현
here을 찾을 수 있습니다 할 수 있습니까 "숨기기"일괄 처리 교착 상태를 피할 수 있도록 sess.run(image)
뒤에 iq_init.run()
호출? image_queue
비어 있기 때문에
두 개의 대기열 (하나는 csv 파일 읽기, 다른 하나는 이미지 읽기)을 사용해야합니까? 귀하의 경우 모든 csv 파일을 하나로 묶는 것이 어렵습니까? – Seven
@Seven 네,이 특별한 경우는 약간 "인공적"일지 모르지만 한 큐에서 다른 큐로 비동기 개체를 푸시하려는 다른 상황에서 나타날 수 있습니다. – bodokaiser