dgurkaynak / tensorflow-cnn-finetune Goto Github PK
View Code? Open in Web Editor NEWFinetuning AlexNet, VGGNet and ResNet with TensorFlow
License: MIT License
Finetuning AlexNet, VGGNet and ResNet with TensorFlow
License: MIT License
Thanks for your code, Everything is ok when I run it. But when I use my classify code to test, there are always something wrong. Do you have it? I will appreciate it if you share it to me, thank you again!
By the way, here is a piece of my classify code
......
model = AlexNetModel(classNum, dropoutPro)
score1 = tf.nn.softmax(model.inference.score)
......
max = tf.arg_max(sess.run(score1, feed_dict = {x: resized.reshape((1, 227, 227, 3))}),1)
res = sess.run(max)[0]
......
The error is 'function' object has no attribute 'score', why the 'score' couldn't be used to my classify code?
Hello, I am wondering that the moving_mean and moving_variance in the 'bn' layers seem no to be updated by this code.
hi,
the url in resnet download_weights.sh is unavailable....
could you offer another link for us?
or just upload the npy file?
BTW, the mean_color=[132.2766, 139.6506, 146.9702] in BatchPreprocessor is from ImageNet or CIFAR?
hi, I really appreciate that you have done this great job. I have implemented your code on my own machine with 4 GPUs. However, even though it occupies all the 4 GPUs, there is only 1 GPU really computing which can be showed by Volatile GPU-Util if you command nvidia-smi. It seems that your code doesn't support multi-GPU training. I'm wondering whether you have plans to support multi-GPU? Appreciate!
Hello. In AlexNet, what I understand about your code is that you only train the fc8 and fc7 layers, and the weights of other layers remain unchanged. Is that true? Do the weights of the fc8 and fc7 layers need to be initialized? The following form:
weights = tf.get_variable('weights', shape=[num_in, num_out], initializer=tf.truncated_normal_initializer(stddev=0.005), trainable=True)
biases = tf.get_variable('biases', [num_out], initializer=tf.constant_initializer(1.0), trainable=True)
I want to use the model created to extract the features of the image,can you tell me how to use your code
Hey @dgurkaynak,
In AlexNet model, images should convert from RGB to BGR as it's mentioned in the AlexNet paper. I couldn't find where did you convert images. Can you tell me which line in your code?
thanks
Traceback (most recent call last):
File "finetune.py", line 155, in
tf.app.run()
File "/home/lshl/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "finetune.py", line 87, in main
output_size=[224, 224], horizontal_flip=True, shuffle=True, multi_scale=multi_scale)
File "../utils/preprocessor.py", line 29, in init
self.labels.append(int(items[1]))
IndexError: list index out of range
When I finetune the alexnet, it has a error ,i couldn't find what the matter .Can you give me some advice?
I download preprocessor,but there is no function named BatchPreprocessor in the package.What makes me confused is that i've run the file two months ago,no error happened.
Hi, I'm a student study deep learning for several month and your job help me a lot ,It's a wonderful job!
But now I meet a problem that if I run the vgg , the code will stop running without any error ,and the systerm told me that the python didn't work ,I never met such a problem before.
Besides this , in my data the Alexnet is much better than resnet ,I do not know how to explain this situation ,I both use your default parameter ,and the acc of Alexnet is 99.5% and the resnet is only 91%.
Many thanks!
Hi, I wonder why there are so many steps to finetune resnet?
Hey @dgurkaynak,
I want to use the checkpoint which saved during training and validating. I mean, I want to evaluate model by using saved checkpoint on test_data. First I load my test data like this:
test_preprocessor = BatchPreprocessor(dataset_file_path=FLAGS.test_file, num_classes=FLAGS.num_classes, output_size=[FLAGS.img_size, FLAGS.img_size])
test_batches_per_epoch = np.floor(len(test_preprocessor.labels) / FLAGS.batch_size).astype(np.int16)
Then I have to restore the checkpoint which I did it in a new Session
saver.restore(sess, checkpoint_path)
Final step, I have to feed the accuracy with all my test images and labels.
print('Test_Accuracy: {:.3%}'.format(accuracy.eval({x: **??**, y_true: **??**})))
I have tried to feed it by test_preprocessor.images
and test_preprocessor. labels
but I got an error because images and labels are path and string not float. what should be the value for ?? in above line?
thanks in advance.
Your code has helped me a lot. Thank you very much.
Thanks. This framework is user-friendly.
A question is how to use the cpkt to test a single picture or a batch of picture.
Hi,
First of all, thanks for the code. your code helps me a lot and I hope inception(V2, V3) will be ready very soon :)
Secondly, I have 2 questions if you can help me to find out the solution.
My main problem is when I want to get confusion matrix, I need the true_class
and predicted_class
and I don't know how
There is a function for confusion matrix which is:
tf.confusion_matrix(labels, predictions,num_classess)
How am I going to feed this function?
Thanks in advance.
I want to know how ckpt2npy and use the npy model to test the image
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.