Giter Site home page Giter Site logo

dgurkaynak / tensorflow-cnn-finetune Goto Github PK

View Code? Open in Web Editor NEW
194.0 10.0 93.0 6.55 MB

Finetuning AlexNet, VGGNet and ResNet with TensorFlow

License: MIT License

Shell 3.27% Python 96.73%
convolutional-neural-networks tensorflow alexnet vggnet resnet finetune

tensorflow-cnn-finetune's People

Contributors

dgurkaynak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorflow-cnn-finetune's Issues

Do you have code for classifying images?

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?

support for multi-GPU

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!

About AlexNet

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)

Converting image RGB to BGR

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

IndexError: list index out of range

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?

Does VGG not support training with CPU?

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!

Checkpoint

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.

Question about inference

Thanks. This framework is user-friendly.
A question is how to use the cpkt to test a single picture or a batch of picture.

Confusion Matrix

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.

  1. How can I get the confusion matrix of your model to understand the performance of a classification model?
  2. How can I get the separate accuracy of each categories?

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.

ckpt 2 npy

I want to know how ckpt2npy and use the npy model to test the image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.