def get_iter_stats(self, cur_epoch, cur_iter): mem_usage = metrics.gpu_mem_usage() iter_stats = { '_type': 'Val_iter', 'epoch': '{}/{}'.format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), 'iter': '{}/{}'.format(cur_iter + 1, self.max_iter), 'top1_err': self.mb_top1_err.get_win_median(), } return iter_stats
def get_epoch_stats(self, cur_epoch): top1_err = self.num_top1_mis / self.num_samples self.min_top1_err = min(self.min_top1_err, top1_err) mem_usage = metrics.gpu_mem_usage() stats = { '_type': 'Val_epoch', 'epoch': '{}/{}'.format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), 'top1_err': top1_err, 'min_top1_err': self.min_top1_err } return stats
def get_iter_stats(self, cur_epoch, cur_iter): mem_usage = metrics.gpu_mem_usage() iter_stats = { '_type': 'test_iter', 'epoch': '{}/{}'.format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), 'iter': '{}/{}'.format(cur_iter + 1, self.max_iter), 'time_avg': self.iter_timer.average_time, 'time_diff': self.iter_timer.diff, 'top1_err': self.mb_top1_err.get_win_median(), 'top5_err': self.mb_top5_err.get_win_median(), 'mem': int(np.ceil(mem_usage)) } return iter_stats
def get_iter_stats(self, cur_epoch, cur_iter): mem_usage = metrics.gpu_mem_usage() iter_stats = { "_type": "test_iter", "epoch": "{}/{}".format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), "iter": "{}/{}".format(cur_iter + 1, self.max_iter), "time_avg": self.iter_timer.average_time, "time_diff": self.iter_timer.diff, "top1_err": self.mb_top1_err.get_win_median(), "top5_err": self.mb_top5_err.get_win_median(), "mem": int(np.ceil(mem_usage)), } return iter_stats
def get_iter_stats(self, cur_epoch, cur_iter): eta_sec = self.iter_timer.average_time * ( self.max_iter - (cur_epoch * self.epoch_iters + cur_iter + 1)) eta_td = datetime.timedelta(seconds=int(eta_sec)) mem_usage = metrics.gpu_mem_usage() stats = { '_type': 'train_iter', 'epoch': '{}/{}'.format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), 'iter': '{}/{}'.format(cur_iter + 1, self.epoch_iters), 'top1_err': self.mb_top1_err.get_win_median(), 'loss': self.loss.get_win_median(), 'lr': self.lr, } return stats
def get_epoch_stats(self, cur_epoch): eta_sec = self.iter_timer.average_time * ( self.max_iter - (cur_epoch + 1) * self.epoch_iters) eta_td = datetime.timedelta(seconds=int(eta_sec)) mem_usage = metrics.gpu_mem_usage() top1_err = self.num_top1_mis / self.num_samples avg_loss = self.loss_total / self.num_samples stats = { '_type': 'train_epoch', 'epoch': '{}/{}'.format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), 'top1_err': top1_err, 'loss': avg_loss, 'lr': self.lr, } return stats
def get_epoch_stats(self, cur_epoch): top1_err = self.num_top1_mis / self.num_samples top5_err = self.num_top5_mis / self.num_samples self.min_top1_err = min(self.min_top1_err, top1_err) self.min_top5_err = min(self.min_top5_err, top5_err) mem_usage = metrics.gpu_mem_usage() stats = { '_type': 'test_epoch', 'epoch': '{}/{}'.format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), 'time_avg': self.iter_timer.average_time, 'top1_err': top1_err, 'top5_err': top5_err, 'min_top1_err': self.min_top1_err, 'min_top5_err': self.min_top5_err, 'mem': int(np.ceil(mem_usage)) } return stats
def get_epoch_stats(self, cur_epoch): top1_err = self.num_top1_mis / self.num_samples top5_err = self.num_top5_mis / self.num_samples self.min_top1_err = min(self.min_top1_err, top1_err) self.min_top5_err = min(self.min_top5_err, top5_err) mem_usage = metrics.gpu_mem_usage() stats = { "_type": "test_epoch", "epoch": "{}/{}".format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), "time_avg": self.iter_timer.average_time, "top1_err": top1_err, "top5_err": top5_err, "min_top1_err": self.min_top1_err, "min_top5_err": self.min_top5_err, "mem": int(np.ceil(mem_usage)), } return stats
def get_iter_stats(self, cur_epoch, cur_iter): eta_sec = self.iter_timer.average_time * ( self.max_iter - (cur_epoch * self.epoch_iters + cur_iter + 1)) eta_td = datetime.timedelta(seconds=int(eta_sec)) mem_usage = metrics.gpu_mem_usage() stats = { "_type": "train_iter", "epoch": "{}/{}".format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), "iter": "{}/{}".format(cur_iter + 1, self.epoch_iters), "time_avg": self.iter_timer.average_time, "time_diff": self.iter_timer.diff, "eta": eta_str(eta_td), "top1_err": self.mb_top1_err.get_win_median(), "top5_err": self.mb_top5_err.get_win_median(), "loss": self.loss.get_win_median(), "lr": self.lr, "mem": int(np.ceil(mem_usage)), } return stats
def get_epoch_stats(self, cur_epoch): eta_sec = self.iter_timer.average_time * ( self.max_iter - (cur_epoch + 1) * self.epoch_iters) eta_td = datetime.timedelta(seconds=int(eta_sec)) mem_usage = metrics.gpu_mem_usage() top1_err = self.num_top1_mis / self.num_samples top5_err = self.num_top5_mis / self.num_samples avg_loss = self.loss_total / self.num_samples stats = { "_type": "train_epoch", "epoch": "{}/{}".format(cur_epoch + 1, cfg.OPTIM.MAX_EPOCH), "time_avg": self.iter_timer.average_time, "eta": eta_str(eta_td), "top1_err": top1_err, "top5_err": top5_err, "loss": avg_loss, "lr": self.lr, "mem": int(np.ceil(mem_usage)), } return stats