Extracting features generated by MobileNet V2
You have already learned how to extract features generated by Inception V3, and now it is time to cover the faster architecture—MobileNet V2.
Preparing the network
Loading MobileNet V2 is in no way different from loading Inception V3. We just need to pay attention to the epoch
number when loading the checkpoint. Consider the following code:
using Images, MXNet
const MODEL_NAME = "weights/mobilenet-v2/mobilenet_v2"
const MODEL_CLASS_NAMES = "weights/mobilenet-v2/synset.txt"
nnet = mx.load_checkpoint(MODEL_NAME, 0, mx.FeedForward);
Removing the last Softmax and FullyConnected layers
We will proceed by looking into the MobileNet V2 structure and understanding which layers we need to keep or remove. We do this by first running the print
function on a neural network architecture. This is shown as follows:
Op:Pooling, Name=pool6
Inputs:
arg[0]=relu6_4(0)
Attrs:
global_pool=True
kernel=(1, 1)
pool_type=avg
pooling_convention...