본문 바로가기

tfrecord

[tensorflow] About using trained NN in C++ ** tensorflow에서 학습한 network를 C++에서 사용 ** In the previous post (visit 2017/07/18 - [Deep Learning] - [tensorflow] how to load and use CNN in C++), I described how to load the CNN trained by using tensorflow and how to use the CNN in C++. In the example, I assumed that the CNN output is of size (1x1). The following example shows how to access the output of CNN whose size is greater than (1x1). Enj.. 더보기
[tensorflow] how to store/save/read float type numpy array as tfrecord ** float 타입 변수 tfrecord로 저장하기 ** Tensorflow.org recommends saving your training data in the format of tfrecord. Many examples can be found on websites. (See my previous post 2017/07/18 - [Deep Learning] - [tensorflow] How to make tfrecord file for training.) Unfortunately, however, most of the examples are dealing with saving images/labels of data type uint8, int64. In this post, I am going to d.. 더보기
[tensorflow] How to load a mini-batch from tfrecord and feed it to CNN ** tfrecord 파일로 부터 random mini-batch 만들고 CNN에 feed_dict 형식으로 입력 ** step1) load a mini-batch from tfrecord by tf.train.shuffle_batch()step2) use tf.placeholder_with_default() to convert the tensor (of size mini_batch_size) to numpy array // PSEUDO CODE ///////////////////////////////////import tensorflow as tfimport osimport numpy as npimport network as net def _get_image_and_label(param): ## dir.. 더보기
[tensorflow] How to random flip an image and its corresponding label ** tensorflow graph에서 영상과 해당 label 값을 동시에 random filp ** import tensorflow as tfimport osimport numpy as npimport network as net def _do_nothing(image, label): return image, label def _random_true_false(): prob = tf.random_uniform(shape=[], minval=0., maxval=1., dtype=tf.float32) predicate = tf.less(prob, 0.5) return predicate def _image_and_label_flip(image, label): image_flip = tf.image.flip_l.. 더보기
[tensorflow] How to make tfrecord file for training ** training data image들로 부터 tfrecord 만들기 ** ** Assume you have saved 100 images at 'file_path'. The corresponding labels are stored in label.csv file. That is, one integer value label per RGB image. // PSEUDO CODE //////////////////////////////////////import tensorflow as tfimport something def _bytes_feature(value): return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) def _int6.. 더보기