You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/08/30 18:38:18 UTC
[incubator-mxnet] branch master updated: remove self-implemented
speedometer (#7430)
This is an automated email from the ASF dual-hosted git repository.
jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new b7efd68 remove self-implemented speedometer (#7430)
b7efd68 is described below
commit b7efd68290311c45da74564d79c44e59ee8efbd6
Author: Ziyue Huang <zy...@gmail.com>
AuthorDate: Thu Aug 31 02:38:15 2017 +0800
remove self-implemented speedometer (#7430)
---
example/rcnn/rcnn/core/callback.py | 35 -----------------------------------
example/rcnn/rcnn/tools/train_rcnn.py | 2 +-
example/rcnn/rcnn/tools/train_rpn.py | 2 +-
example/rcnn/train_end2end.py | 2 +-
4 files changed, 3 insertions(+), 38 deletions(-)
diff --git a/example/rcnn/rcnn/core/callback.py b/example/rcnn/rcnn/core/callback.py
index bacff96..06eb262 100644
--- a/example/rcnn/rcnn/core/callback.py
+++ b/example/rcnn/rcnn/core/callback.py
@@ -15,44 +15,9 @@
# specific language governing permissions and limitations
# under the License.
-import time
-import logging
import mxnet as mx
-class Speedometer(object):
- def __init__(self, batch_size, frequent=50):
- self.batch_size = batch_size
- self.frequent = frequent
- self.init = False
- self.tic = 0
- self.last_count = 0
-
- def __call__(self, param):
- """Callback to Show speed."""
- count = param.nbatch
- if self.last_count > count:
- self.init = False
- self.last_count = count
-
- if self.init:
- if count % self.frequent == 0:
- speed = self.frequent * self.batch_size / (time.time() - self.tic)
- if param.eval_metric is not None:
- name, value = param.eval_metric.get()
- s = "Epoch[%d] Batch [%d]\tSpeed: %.2f samples/sec\tTrain-" % (param.epoch, count, speed)
- for n, v in zip(name, value):
- s += "%s=%f,\t" % (n, v)
- logging.info(s)
- else:
- logging.info("Iter[%d] Batch [%d]\tSpeed: %.2f samples/sec",
- param.epoch, count, speed)
- self.tic = time.time()
- else:
- self.init = True
- self.tic = time.time()
-
-
def do_checkpoint(prefix, means, stds):
def _callback(iter_no, sym, arg, aux):
arg['bbox_pred_weight_test'] = (arg['bbox_pred_weight'].T * mx.nd.array(stds)).T
diff --git a/example/rcnn/rcnn/tools/train_rcnn.py b/example/rcnn/rcnn/tools/train_rcnn.py
index c5417b3..0761891 100644
--- a/example/rcnn/rcnn/tools/train_rcnn.py
+++ b/example/rcnn/rcnn/tools/train_rcnn.py
@@ -118,7 +118,7 @@ def train_rcnn(network, dataset, image_set, root_path, dataset_path,
for child_metric in [eval_metric, cls_metric, bbox_metric]:
eval_metrics.add(child_metric)
# callback
- batch_end_callback = callback.Speedometer(train_data.batch_size, frequent=frequent)
+ batch_end_callback = mx.callback.Speedometer(train_data.batch_size, frequent=frequent, auto_reset=false)
epoch_end_callback = callback.do_checkpoint(prefix, means, stds)
# decide learning rate
base_lr = lr
diff --git a/example/rcnn/rcnn/tools/train_rpn.py b/example/rcnn/rcnn/tools/train_rpn.py
index aaaf570..8cd0994 100644
--- a/example/rcnn/rcnn/tools/train_rpn.py
+++ b/example/rcnn/rcnn/tools/train_rpn.py
@@ -119,7 +119,7 @@ def train_rpn(network, dataset, image_set, root_path, dataset_path,
for child_metric in [eval_metric, cls_metric, bbox_metric]:
eval_metrics.add(child_metric)
# callback
- batch_end_callback = callback.Speedometer(train_data.batch_size, frequent=frequent)
+ batch_end_callback = mx.callback.Speedometer(train_data.batch_size, frequent=frequent, auto_reset=false)
epoch_end_callback = mx.callback.do_checkpoint(prefix)
# decide learning rate
base_lr = lr
diff --git a/example/rcnn/train_end2end.py b/example/rcnn/train_end2end.py
index 5c94293..34fb5b3 100644
--- a/example/rcnn/train_end2end.py
+++ b/example/rcnn/train_end2end.py
@@ -126,7 +126,7 @@ def train_net(args, ctx, pretrained, epoch, prefix, begin_epoch, end_epoch,
for child_metric in [rpn_eval_metric, rpn_cls_metric, rpn_bbox_metric, eval_metric, cls_metric, bbox_metric]:
eval_metrics.add(child_metric)
# callback
- batch_end_callback = callback.Speedometer(train_data.batch_size, frequent=args.frequent)
+ batch_end_callback = mx.callback.Speedometer(train_data.batch_size, frequent=args.frequent, auto_reset=false)
means = np.tile(np.array(config.TRAIN.BBOX_MEANS), config.NUM_CLASSES)
stds = np.tile(np.array(config.TRAIN.BBOX_STDS), config.NUM_CLASSES)
epoch_end_callback = callback.do_checkpoint(prefix, means, stds)
--
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].