HOME
RECENT CHANGES

Fast Style Transfer


Source

스타일 트랜스퍼 구현 가운데 정리가 잘 되어 있는 소스.



Train

gomida@TITAN:~/github/tensorflow-fast-style-transfer$ time python3 run_train.py --style=style/wave.jpg --output=output --trainDB=train2014 --vgg_model=pre_trained_model
...
epoch : 1, iter : 41387,  L_total : 3.64985e+06, L_content : 2.54942e+06, L_style : 969267, L_tv : 131156
epoch : 1, iter : 41388,  L_total : 3.5645e+06, L_content : 2.41286e+06, L_style : 1.01815e+06, L_tv : 133492
epoch : 1, iter : 41389,  L_total : 4.10214e+06, L_content : 2.8635e+06, L_style : 1.10317e+06, L_tv : 135476
epoch : 1, iter : 41390,  L_total : 3.44248e+06, L_content : 2.29165e+06, L_style : 1.01803e+06, L_tv : 132808

real	246m24.080s
user	177m50.431s
sys	77m29.460s
gomida@TITAN:~/github/tensorflow-fast-style-transfer$ 



Test

2018 May 07

기본 옵션으로 학습한 모델

2018 May 07

제공되는 wave.ckpt 모델



TF Lite

interpreter->AllocateTensors() 호출 시
Failed to allocate tensors!
tensorflow/contrib/lite/kernels/div.cc:48 NumDimensions(input1) != NumDimensions(input2) (4 != 0)
변환 에러
gomida@TITAN:~/github/tensorflow$ ./bazel-bin/tensorflow/contrib/lite/toco/toco --input_file=/home/gomida/github/tensorflow-fast-style-transfer/frozen_out3.pb  --output_file=/home/gomida/github/tensorflow-fast-style-transfer/frozen_out3_r16.tflite --input_array=input --output_array=Tanh --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE
2018-04-22 09:59:33.502829: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 222 operators, 310 arrays (0 quantized)
2018-04-22 09:59:33.505184: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 222 operators, 310 arrays (0 quantized)
2018-04-22 09:59:33.511251: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] After general graph transformations pass 1: 158 operators, 260 arrays (0 quantized)
2018-04-22 09:59:33.513290: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before dequantization graph transformations: 158 operators, 260 arrays (0 quantized)
2018-04-22 09:59:33.514900: F tensorflow/contrib/lite/toco/allocate_transient_arrays.cc:310] Check failed: model->transient_data_size >= optimal_transient_alloc_size (462858240 vs. 555429888)
Aborted (core dumped)

2018 May 07

스트라이드를 줄이고 후반 디컨볼루션을 제거한 모델