bbox_metric = metric.RPNL1LossMetric() rceval_metric = metric.RCNNAccMetric(config) rccls_metric = metric.RCNNLogLossMetric(config) rcbbox_metric = metric.RCNNL1LossCRCNNMetric(config) eval_metrics = mx.metric.CompositeEvalMetric() eval_metrics.add(eval_metric) eval_metrics.add(cls_metric) eval_metrics.add(bbox_metric) eval_metrics.add(rceval_metric) eval_metrics.add(rccls_metric) eval_metrics.add(rcbbox_metric) if config.TRAIN.WITH_MASK: mask_metric = metric.MaskLogLossMetric(config) eval_metrics.add(mask_metric) optimizer_params = get_optim_params(config, len(train_iter), batch_size) print ('Optimizer params: {}'.format(optimizer_params)) # Checkpointing prefix = os.path.join(output_path, args.save_prefix) batch_end_callback = mx.callback.Speedometer(batch_size, args.display) epoch_end_callback = [mx.callback.module_checkpoint(mod, prefix, period=1, save_optimizer_states=True), eval('{}.checkpoint_callback'.format(config.symbol))(sym_inst.get_bbox_param_names(), prefix, bbox_means, bbox_stds)] train_iter = PrefetchingIter(train_iter) mod.fit(train_iter, optimizer='sgd', optimizer_params=optimizer_params, eval_metric=eval_metrics, num_epoch=config.TRAIN.end_epoch, kvstore=config.default.kvstore, batch_end_callback=batch_end_callback, epoch_end_callback=epoch_end_callback, arg_params=arg_params, aux_params=aux_params)