未验证 提交 83f11ba0 编写于 作者: G Guanghua Yu 提交者: GitHub

fix init_metrics and prune (#2153)

上级 b6987706
...@@ -110,6 +110,9 @@ class Trainer(object): ...@@ -110,6 +110,9 @@ class Trainer(object):
self._compose_callback = None self._compose_callback = None
def _init_metrics(self): def _init_metrics(self):
if self.mode == 'test':
self._metrics = []
return
if self.cfg.metric == 'COCO': if self.cfg.metric == 'COCO':
self._metrics = [COCOMetric(anno_file=self.dataset.get_anno())] self._metrics = [COCOMetric(anno_file=self.dataset.get_anno())]
elif self.cfg.metric == 'VOC': elif self.cfg.metric == 'VOC':
......
...@@ -49,6 +49,9 @@ class Pruner(object): ...@@ -49,6 +49,9 @@ class Pruner(object):
self.print_params = print_params self.print_params = print_params
def __call__(self, model): def __call__(self, model):
# FIXME: adapt to network graph when Training and inference are
# inconsistent, now only supports prune inference network graph.
model.eval()
paddleslim = try_import('paddleslim') paddleslim = try_import('paddleslim')
from paddleslim.analysis import dygraph_flops as flops from paddleslim.analysis import dygraph_flops as flops
input_spec = [{ input_spec = [{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册