Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3 other subscribers

14 Comments

  1. RROY
    June 7, 2017 @ 7:23 pm

    Nice write up. Can you please add the steps on how to do the validation of the trained model?

    Thanks,
    Rupam Roy

    Reply

  2. RROY
    June 7, 2017 @ 7:57 pm

    I am getting the below error when trying to o some validation tests :

    KeyError: “The name ‘softmax:0’ refers to a Tensor which does not exist. The operation, ‘softmax’, does not exist in the graph.
    any idea what is causing this?

    Reply

    • akshay
      June 10, 2017 @ 9:47 am

      Hi,

      So that error is occurring because this new model which has been trained contains a softmax later in the end that helps in classification. what script are you using for validating the trained models ?

      Reply

      • Wayne Cheng
        June 22, 2017 @ 2:00 pm

        I have the same issue. After I use the retrain.py to have the new pb and pbtxt file. I use the classifier.py to validate the image file. I got the error: “The name ‘softmax:0’ refers to a Tensor which does not exist. The operation, ‘softmax’, does not exist in the graph.” . And I do get the “Converted 2 variables to const ops.” prompt.

        Reply

        • akshay
          June 22, 2017 @ 2:08 pm

          can you show me the full command that you are using to run the classifier.py script?

          Reply

          • Wayne Cheng
            June 22, 2017 @ 2:23 pm

            The full command is: “python3 classifier.py –image_file ./image/test.jpg”

        • admin
          June 28, 2017 @ 10:46 am

          Somehow I am not getting this error. I have added another file to the git repo “retrain_new.py”. this new script has been updated to run with the newer version of tensorflow.

          Another thing is that the classifier.py should not be used to test the new model that you have retrained. This is only to set up a simple imagenet classifier and run it. What you would have to do is create a tensorflow session by loading your new model and getting the predictions in a to session like : top_k = predictions[0].argsort()[-len(predictions[0]):][::-1]

          I will upload a full script by this weekend.

          Reply

  3. Wayne Cheng
    June 22, 2017 @ 2:20 pm

    ” python3 retrain.py –model_dir ./inception –image_dir ../image –input_binary=true” . After get the “Converted 2 variables to const ops.” , I copy the /tmp/output_graph.pb and /tmp/output_labes to ./inception as classify_image_graph_def.pb and imagenet_2012_challenge_label_map_proto.pbtxt. Then run the classifier.py, and get the error.

    Reply

  4. Sang
    June 27, 2017 @ 4:03 pm

    Image directory ‘~\fabrics’ not found.
    Traceback (most recent call last):
    File “retrain.py”, line 970, in
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
    File “C:\Users\itagi\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py”, line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
    File “retrain.py”, line 716, in main
    class_count = len(image_lists.keys())
    AttributeError: ‘NoneType’ object has no attribute ‘keys’

    I am getting the following error when running on windows 10

    Reply

    • admin
      June 27, 2017 @ 4:35 pm

      the structure “~/fabrics” is used for Linux. Could you try giving the full path of the folder and running it again?

      Reply

      • Sang
        June 28, 2017 @ 11:09 am

        It worked .Thank you very much.
        How do we provide a single image and know which class it belongs to.

        Reply

        • admin
          June 28, 2017 @ 11:23 am

          You’re welcome. As of now that script to test the classifier, I haven’t uploaded. I’ll be uploading it by this weekend and you can use that .

          Until then, you can try to create a the session and use the prediction on the model.

          There is another script “classifier.py” in the GitHub repo but that will only work with imagenet model and not the retrained model.

          Reply

          • Shashi
            June 28, 2017 @ 11:43 am

            Which model is best for image classifying ? Alexnet or Inceptionv3

          • admin
            June 28, 2017 @ 12:20 pm

            Definitely Inception V3. It’s newer and has better accuracy fro image classification. As of now there is Resnet V2 which is better performing than inception V3. But you would have to use the new TF slim to work with it.

Leave a Reply

Your email address will not be published. Required fields are marked *