diff --git a/dygraph/ppdet/engine/trainer.py b/dygraph/ppdet/engine/trainer.py index 691c92c6aa01f5b1ba15917953ff5e5fedae0bb8..b32d74a8cb8329db758c4ca9172d891855a5886c 100644 --- a/dygraph/ppdet/engine/trainer.py +++ b/dygraph/ppdet/engine/trainer.py @@ -97,8 +97,8 @@ class Trainer(object): def _init_metrics(self): if self.mode == 'eval': if self.cfg.metric == 'COCO': - mask_resolution = self.model.mask_post_process.mask_resolution if hasattr( - self.model, 'mask_post_process') else None + mask_resolution = self.model.mask_post_process.mask_resolution if getattr( + self.model, 'mask_post_process', None) else None self._metrics = [ COCOMetric( anno_file=self.dataset.get_anno(),