deep-learning-models icon indicating copy to clipboard operation
deep-learning-models copied to clipboard

Same predictions for any input for fine tuned inception v3 model

Open pavanyvs opened this issue 9 years ago • 0 comments

I am trying to fine tune an inception v3 model with 2 categories . These are the steps i followed

  1. created sharded files from custom data using build_image_data.py by changing the number of classes and examples in imagenet_data.py . Used a labelsfile.txt ;
  2. changed the values accordingly in flowers_data.py and using flowers_train.py I trained the model. ;
  3. I froze the model and got protobuf file. using this script;
  4. My input node (x) expects a batch of size 32 and size 299x299x3 so I hacked my way by duplicating my test image 32 times and created an input batch ;
  5. using input&output nodes, input batch and the script below, I am able to print the scores of predictions using the below script

image_data = create_test_batch(args.image_name) graph=load_graph(args.frozen_model_filename) x = graph.get_tensor_by_name('prefix/batch_processing/Reshape:0') y = graph.get_tensor_by_name('prefix/tower_0/logits/predictions:0') with tf.Session(graph=graph) as sess: y_out=sess.run(y, feed_dict={x:image_data}) print(y_out)

I got the result which looks like:

[ 0.02264258 0.16756369 0.80979371] [ 0.02351799 0.16782859 0.80865341].... [ 0.02205461 0.1794569 0.7984885 ] [ 0.02153662 0.16436867 0.81409472]

For any image as input, I have been getting the maximum score only in column 3 which means I'd get the same prediction for any input.

Is there any point which I am missing in my process or is there any bug? Can anyone help me with this issue? I am using python 2.7 in ubuntu 16.04 in cloudVM

pavanyvs avatar Oct 06 '17 15:10 pavanyvs