提交 333b1b48 编写于 作者: F FlyingQianMM

getattr(self, 'use_ema', False) in base.py

上级 4a7cb725
......@@ -548,7 +548,7 @@ class BaseAPI:
current_save_dir = osp.join(save_dir, "epoch_{}".format(i + 1))
if not osp.isdir(current_save_dir):
os.makedirs(current_save_dir)
if hasattr(self, 'use_ema') and self.use_ema:
if getattr(self, 'use_ema', False):
self.exe.run(self.ema.apply_program)
if eval_dataset is not None and eval_dataset.num_samples > 0:
self.eval_metrics, self.eval_details = self.evaluate(
......@@ -576,7 +576,7 @@ class BaseAPI:
log_writer.add_scalar(
"Metrics/Eval(Epoch): {}".format(k), v, i + 1)
self.save_model(save_dir=current_save_dir)
if hasattr(self, 'use_ema') and self.use_ema:
if getattr(self, 'use_ema', False):
self.exe.run(self.ema.restore_program)
time_eval_one_epoch = time.time() - eval_epoch_start_time
eval_epoch_start_time = time.time()
......
......@@ -60,7 +60,7 @@ class YOLOv3(PPYOLO):
]
assert backbone in backbones, "backbone should be one of {}".format(
backbones)
super(YOLOv3, self).__init__('detector')
super(PPYOLO, self).__init__('detector')
self.backbone = backbone
self.num_classes = num_classes
self.anchors = anchors
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册