MXnet 微调保存模型

MXnet fine-tune save model

我正在使用 mxnet 的微调示例通过以下代码微调我自己的数据:

https://github.com/dmlc/mxnet/blob/master/example/image-classification/fine-tune.py

看了common/fit.py,不知道微调的时候怎么保存临时模型

例如,我想每5000次迭代保存一次.params文件,我该怎么做? 谢谢!

http://mxnet.io/api/python/callback.html

尝试使用 mx.callback API.

module.fit(iterator, num_epoch=n_epoch,
... epoch_end_callback  = mx.callback.do_checkpoint("mymodel", 1))
Start training with [cpu(0)]
Epoch[0] Resetting Data Iterator
Epoch[0] Time cost=0.100
Saved checkpoint to "mymodel-0001.params"
Epoch[1] Resetting Data Iterator
Epoch[1] Time cost=0.060
Saved checkpoint to "mymodel-0002.params"