Explore Courses Blog Tutorials Interview Questions
0 votes
in Machine Learning by (33.1k points)

I have an Android app that was modeled after the Tensorflow Android demo for classifying images,

The original app uses a tensorflow graph (.pb) file to classify a generic set of images from Inception v3 (I think)

I then trained my own graph for my own images following the instruction in Tensorflow for Poets blog,

and this worked in the Android app very well, after changing the settings in,


private static final int INPUT_SIZE = 299;

private static final int IMAGE_MEAN = 128;

private static final float IMAGE_STD = 128.0f;

private static final String INPUT_NAME = "Mul";

private static final String OUTPUT_NAME = "final_result";

private static final String MODEL_FILE = "file:///android_asset/optimized_graph.pb";

private static final String LABEL_FILE =  "file:///android_asset/retrained_labels.txt";

To port the app to iOS, I then used the iOS camera demo,

and used the same graph file and changed the settings in,

Not sure if this is the best way to resize, but this worked. But it seemed to make image classification even worse, not better...

Any ideas, or issues with the image conversion/resize?

1 Answer

0 votes
by (33.1k points)

For your problem, if I say you can use the NLTK library, then I’d also want to say that there is not any perfect method in machine learning that can fit your model properly. So you have to try some different techniques also to get the best accuracy on unknown data.

There is a class in NLTK called perceptron tagger, which can help your model to return correct parts of speech.

>>> import inspect 

>>> print inspect.getsource(pos_tag) 

def pos_tag(tokens, tagset=None): 

tagger = PerceptronTagger() 

return _pos_tag(tokens, tagset, tagger)

Still, it's better but not perfect:

>>> from nltk import pos_tag 

>>> pos_tag("The quick brown fox jumps over the lazy dog".split())

[('The', 'DT'), ('quick', 'JJ'), ('brown', 'NN'), ('fox', 'NN'), ('jumps', 'VBZ'), ('over', 'IN'), ('the', 'DT'), ('lazy', 'JJ'), ('dog', 'NN')]

The above code will improve the output of your model.

I hope this answer helps.

Browse Categories