Coder Social home page Coder Social logo

image-classification-transfer-learning's Introduction

A Custom Image Classifier using Transfer Learning on Google Inception V3

Let’s experience the power of transfer learning by adapting an existing image classifier (Inception V3) to a custom task: categorizing product images to help a food and groceries retailer reduce human effort in the inventory management process of its warehouse and retail outlets.

Original blog post here.

Feel free to contact me: [email protected]

image-classification-transfer-learning's People

Contributors

rishabh-shrivastava avatar wisdal 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  avatar  avatar  avatar  avatar

image-classification-transfer-learning's Issues

ERROR:tensorflow:Image directory ' 'not found

Hi, when I was running retrain.py, I encountered the problem 'Image directory ' 'not found'. While the image_dir is a customizable paramter, the article says that "we properly set it up during preprocessing step." Does that mean I didn't set it up properly during the preprocessing step (but all steps were run successfully after i defined the train_dir parameter)? Or, what's wrong with with the retrain.py file?

Mobilenet decodeJpeg tensor

Hi, I'm trying to read the generated retrained_graph.pb and then use it to run predictions on an image of mine, so I would do something like this:

with tf.compat.v1.Session() as sess:
        # Feed the image_data as input to the graph and get first prediction

        softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')

        predictions = sess.run(softmax_tensor,
                               {'DecodeJpeg/contents:0': image_data})
        #print('predictions', predictions)
        return predictions

My problem is DecodeJpeg/contents:0 doesn't exist in the graph generated by mobilenet (it exists in inception_v3 and works)
Is there a workaround for this?
or more simply, what is the input_layer_name for mobilenet ?

name 'train_dir' is not defined

Hey Wisdom, this is an excellent tutorial. Congratulations.
However, I notice that the variable 'train_dir' at the pre_process.ipynb file is not recognized.
Did you mean src_train_dir? Thank you

KeyError

I have run the retain and edit the final code of the test notebook as below. It run with keyerror. What this final code is supposed to do? I found the photos in test_img are png. Is it necessary to convert to jpg first? The code in test does not include the conversion. Is there way of showing the classification result using the test photos?

src=os.path.join('.','test_img')
dest=os.path.join('.','test_img2')
labels='tf_files/retrained_labels.txt'
graph='tf_files/retrained_graph.pb'
input_layer='DecodeJpeg/contents:0'
output_layer='final_result:0'
num_top_predictions=1
labels = load_labels(labels)
load_graph(graph)
run_graph(src,dest,labels,input_layer,output_layer,num_top_predictions)

KeyError Traceback (most recent call last)
~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
3062 try:
-> 3063 return self._engine.get_loc(key)
3064 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 0

Resizing images before training.

Hello, I just want to know how should I resize my images before feeding them to retrain.py. I have images in subfolders named by their classes. Where should I make changes in retrain.py in order to use the model provided?

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.