joelthchao / tensorflow-finetune-flickr-style Goto Github PK
View Code? Open in Web Editor NEWDemonstrate the finetune process on TensorFlow
Demonstrate the finetune process on TensorFlow
2018-07-02 08:16:08.890713 Iter 12160: Testing Accuracy = 0.4056
Why you are only 0.3250? So big variance of training, what happened?
can you share you dateset in baidu cloud, it seem hard to get the dataset because of network time out!
hi,Thanks for your share first. I want to know what is the test.txt file look like? In this test.txt file, if a label is need for every image?
Hi,I am so sorry to trouble you again, but I have a issue troubled me these days. I use your code https://github.com/joelthchao/tensorflow-finetune-flickr-style/blob/master/finetune.py to finetune the network onto my own data to classify kaggle Dogs VS. Cats. It runs this error: ValueError: Cannot feed value of shape () for Tensor u'Placeholder:0', which has shape '(50, 227, 227, 3)'
Why did it happened? Please help me.
Hi, I try to modify your finetune.py and model.py in order to fine-tune VGG16 where converted from Caffe. I extracted VGG16_Tensorflow.npy via converting VGG16 Caffe model. The code shows error when I added "load_with_skip('VGG16_Tensorflow.npy', sess, ['fc8']) ", the error information is
Traceback (most recent call last):
File "mff_vgg16.py", line 125, in <module>
main()
File "mff_vgg16.py", line 66, in main
load_with_skip('VGG16_Tensorflow.npy', sess, ['fc8']) # Skip weights from fc8
File "/home/larson/atensorflow_code/Document14C/finetune_example/network.py", line 19, in load_with_skip
session.run(tf.get_variable(subkey).assign(data))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 497, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 45, in assign
use_locking=use_locking, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/op_def_library.py", line 455, in apply_op
as_ref=input_arg.is_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 620, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/constant_op.py", line 179, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/constant_op.py", line 162, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 353, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 290, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected float32, got 'weights' of type 'str' instead.
VGG16 model is
@staticmethod
def VGG16(_X, _dropout, n_class):
# part 1 (conv-conv-pool)
conv1_1 = conv(_X, 3, 3, 64, 1, 1, padding='SAME', name='conv1_1')
conv1_2 = conv(conv1_1, 3, 3, 64, 1, 1, padding='SAME', name='conv1_2')
pool1 = max_pool(conv1_2, 2, 2, 2, 2, padding='SAME', name='pool1')
# part 2 (conv-conv-pool)
conv2_1 = conv(pool1, 3, 3, 128, 1, 1, padding='SAME', name='conv2_1')
conv2_2 = conv(conv2_1, 3, 3, 128, 1, 1, padding='SAME', name='conv2_2')
pool2 = max_pool(conv2_2, 2, 2, 2, 2, padding='SAME', name='pool2')
# part 3 (conv-conv-conv-pool)
conv3_1 = conv(pool2, 3, 3, 256, 1, 1, padding='SAME', name='conv3_1')
conv3_2 = conv(conv3_1, 3, 3, 256, 1, 1, padding='SAME', name='conv3_2')
conv3_3 = conv(conv3_2, 3, 3, 256, 1, 1, padding='SAME', name='conv3_3')
pool3 = max_pool(conv3_3, 2, 2, 2, 2, padding='SAME', name='pool3')
# part 4 (conv-conv-conv-pool)
conv4_1 = conv(pool3, 3, 3, 512, 1, 1, padding='SAME', name='conv4_1')
conv4_2 = conv(conv4_1, 3, 3, 512, 1, 1, padding='SAME', name='conv4_2')
conv4_3 = conv(conv4_2, 3, 3, 512, 1, 1, padding='SAME', name='conv4_3')
pool4 = max_pool(conv4_3, 2, 2, 2, 2, padding='SAME', name='pool4')
# part 5 (conv-conv-conv-pool)
conv5_1 = conv(pool4, 3, 3, 512, 1, 1, padding='SAME', name='conv5_1')
conv5_2 = conv(conv5_1, 3, 3, 512, 1, 1, padding='SAME', name='conv5_2')
conv5_3 = conv(conv5_2, 3, 3, 512, 1, 1, padding='SAME', name='conv5_3')
pool5 = max_pool(conv5_3, 2, 2, 2, 2, padding='SAME', name='pool5')
# Layer 6 (fc-relu-drop)
fc6 = tf.reshape(pool5, [-1, 7*7*512])
fc6 = fc(fc6, 7*7*512, 4096, name='fc6')
fc6 = dropout(fc6, _dropout)
# Layer 7 (fc-relu-drop)
fc7 = fc(fc6, 4096, 4096, name='fc7')
fc7 = dropout(fc7, _dropout)
# Layer 8 (fc-prob)
fc8 = fc(fc7, 4096, n_class, relu=False, name='fc8')
return fc8
How to modify the code ?
Thanks a lot !
2019-05-21 16:26:02.627367 Iter 5040: Training Loss = 0.0148, Accuracy = 1.0000
2019-05-21 16:26:07.453140 Iter 5060: Training Loss = 0.0249, Accuracy = 1.0000
2019-05-21 16:26:12.326071 Iter 5080: Training Loss = 0.0172, Accuracy = 1.0000
2019-05-21 16:26:17.227455 Iter 5100: Training Loss = 0.0552, Accuracy = 0.9800
2019-05-21 16:26:27.450521 Iter 5120: Testing Accuracy = 0.4336
Hi, thanks for your remarkable work! I want to download photos with more than 20 styles in your code. I search a lot on flickr website, but cannot find any document about the style mapping. Can you give me a link which talk about this? Thanks!
Hello,when I use this project and I have read the readme ,But I still don't konw how to download the caffenet.npy.please I tell me how to download that,or you can give me a Internet connection。Thank you very much!
Downloading 80000 images with 3 workers...
Writing train/val for 0 successfully downloaded images.
When I wanna download the flickr dataset,an error occurs:
python assemble_data.py images train.txt test.txt 500
File "assemble_data.py", line 67
print('{} {}'.format(url, class_id), file=f)
^
SyntaxError: invalid syntax
Do you know what the reason is?
Dear author, thanks for your code, I am working on it. but I find that maybe it is not for finetuning as the model is not pretrained.
how to load a pretrained model? would you like to paste the code?
another question, what're the .txt files look like? I want to make them with my own dataset as the some urls in .csv are invalid.
thanks again, any help appreiated!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.