텐서플로우에서 이미지 데이타 처리 성능 향상방법
이미지 인식 모델을 만들다가 파일 포맷 성능 향상 관련해서 좋은 팁을 찾아서 메모
if you are working with >O(1000) JPEG images, keep in mind that it is extremely inefficient to individually ready 1000's of small files. This will slow down your training quite a bit.
A more robust and faster solution to convert a dataset of images to a sharded
TFRecord
ofExample
protos. Here is a fully worked script for converting the ImageNet data set to such a format. And here is a set of instructions for running a generic version of this preprocessing script on an arbitrary directory containing JPEG images.http://stackoverflow.com/questions/37126108/how-to-read-data-into-tensorflow-batches-from-example-queue
1000개 이상의 JPEG나 PNG 이미지를 매번 읽어서 트레이닝을 시킬 경우, 트레이닝 성능이 낮아진다.
그래서 JPEG 포맷을 사용하지 말고 TFRecord 포맷을 사용하고, TFRecord 포맷에서 한 파일에 하나의 데이타를 넣지말고 여러 데이타를 넣는 방법을 사용해야 한다.
'빅데이타 > 머신러닝' 카테고리의 다른 글
텐서플로우 - 파일에서 학습데이타를 읽어보자#2 (Reader와 Decoder) (1) | 2017.03.11 |
---|---|
텐서플로우-파일에서 학습 데이타를 읽어보자 #1 (큐 사용 방법과 구조) (4) | 2017.03.07 |
텐서플로우에서 이미지 데이타 처리 성능 향상방법 (2) | 2017.02.25 |
머신러닝 이미지 데이타 뻥튀기 방법 (0) | 2017.02.25 |
텐서 보드를 이용하여 학습 과정을 시각화 해보자 (0) | 2017.01.31 |
딥러닝을 이용한 숫자 이미지 인식 #2/2-예측 (12) | 2017.01.09 |
댓글을 달아 주세요
좋은글 감사합니다.
이미지를 tensorflow로 input만 하는 경우에는
def ImportImage(filename):
with tf.device('/cpu:0'):
img = tf.read_file(filename)
image = tf.image.decode_jpeg(img, channels=3)
with tf.Session() as sess:
start = time.time()
out = sess.run(image)
print (time.time() - start)
tf.reset_default_graph()
return out
그레프를 리셋시켜서 import속도가 늦어지는 것을 막을 수 있었습니다.
매번 잘보고 잘배우고 있습니다. 저또한 tfRecord로 사용하는중입니다. 감사합니다.