NervanaSystems / ngraph-mxnet

MXNet - nGraph integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretrain SSD-MobileNetv1 model

mbrookhart opened this issue · comments

We should be able to reuse https://github.com/apache/incubator-mxnet/tree/master/example/ssd with the mobilenetv1 symbol.

Acceptance Criteria:

  1. Train model to the default number of epochs and within 10% expected accuracy (on GPU)
  2. Upload saved model symbol json and parameters to deepmark
  3. Provide a script for testing model accuracy on test data.

Made the following changes to run SSD example with MobileNetV2 symbol (MXNet repo revision c792c9f). Am currently training the model on Pascal VOC.

  1. Moved example/image-classification/symbols/mobilenetv2.py to example/ssd/symbol
  2. Added the following code to example/ssd/symbol/symbol_factory.py get_config function if statement:
elif network == 'mobilenetv2':
        num_layers = 1 + 17*3 + 2  # conv layers
        network = 'mobilenetv2'
        from_layers = ['seq-5-block1-exp-relu6', 'last-1x1-conv-relu6', '', '', '', '']
        num_filters = [-1, -1, 512, 256, 256, 128]
        strides = [-1, -1, 2, 2, 2, 2]
        pads = [-1, -1, 1, 1, 1, 1]
        sizes = [[.1, .141], [.2,.272], [.37, .447], [.54, .619], [.71, .79], [.88, .961]]
        ratios = [[1,2,.5], [1,2,.5,3,1./3], [1,2,.5,3,1./3], [1,2,.5,3,1./3], \
            [1,2,.5], [1,2,.5]]
        normalizations = -1
        steps = []
        return locals()
  1. In ssd/train/train_net.py line 222 hack: changed elif pretained to elif False
  2. In ssd/config/config.py line 19: changed from config.utils import to from utils import
  3. add **kwargs to get_symbol function in mobilenetv2.py

Then from ssd folder run
python train.py --train-path <path to created train.rec> --val-path <path to created val.rec> --network mobilenetv2 --prefix <path to model save dir>/ssd

Where train.rec and val.rec were created for Pascal VOC following the README

I just realized this ticket requests MobileNet v1, not v2. Will change accordingly.

Model files, data, test script and README have been saved to /nfs/fm/disks/aipg_trained_models_01/mxnet/ssd-mobilenet-v1