To reduce overfitting, you may apply dropout before the readout layer. If try to use frozen graph with dropout in ios app, you will get such error:
Invalid argument: No OpKernel was registered to support Op 'RandomUniform' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[Node: dropout/random_uniform/RandomUniform = RandomUniform[T=DT_INT32, dtype=DT_FLOAT, seed=0, seed2=0](dropout/Shape)]]
Tested on tensorflow v0.12.1
We need to remove dropout from frozen graph to fix it.
Let’s create frozen_model.pb as shown below:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
And remove dropout from frozen graph.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
In cell #4 you can see that accuracy is the same, but we don’t need to use keep_prob:0 in feed_dict anymore. Error about missing OpKernel should go away in your ios app. Cheers!