Incubator-mxnet: Correct Speedometer Callback Usage

Created on 12 Sep 2016  路  3Comments  路  Source: apache/incubator-mxnet

I tried to follow the example here on how to use the callback Speedometer:

https://github.com/dmlc/mxnet/blob/master/example/notebooks/tutorial.ipynb

But when I used it, it didn't produce anything throughout the entire training. I'm using my own images, approx 7000 training exemplars of (3, 256, 256). I used an epoch callback, and that saved things as I expected (every 10 epochs).

import mxnet
import symbol_alexnet

train_iter = mxnet.io.NDArrayIter(exemplars_train, labels_train, 100)
test_iter = mxnet.io.NDArrayIter(exemplars_test, labels_test, 100)

alexnet = symbol_alexnet.get_symbol(len(class_list))
epochs = 80

model = mxnet.model.FeedForward(
ctx = mxnet.gpu(0),
symbol=alexnet,
num_epoch=epochs,
learning_rate = 0.1,
momentum = 0.9)

model.fit(
X=train_iter,
eval_data=test_iter,
epoch_end_callback = mxnet.callback.do_checkpoint("chks/train", 10),
batch_end_callback = mxnet.callback.Speedometer(100,10))

Could anyone tell me what I got wrong? I presume it has to do with the batch_size, but I'm a little uncertain on it's exact meaning.

Most helpful comment

Can confirm this is working, just for future reference so people don't have to go searching on how to use logging:

import logging

logging.basicConfig(level=logging.DEBUG)

All 3 comments

import logging and set logging level to debug

I had same issue but it turns out the Spyder the python IDE that came with Anaconda sets a logger at startup and subsequent python configuration does not change that. So log messages go to console or in some cases disappear and not a file. After tinkering with the code in python folder of MXNET esp callback.py managed to get speedometer logs. I think should use log handlers .cleaner and can save to file

Can confirm this is working, just for future reference so people don't have to go searching on how to use logging:

import logging

logging.basicConfig(level=logging.DEBUG)
Was this page helpful?
0 / 5 - 0 ratings