赞
踩
作者,你好,我有几个问题想请教一下:
我发现目前工程只在训练完全结束后才会保存模型,请问如何阶段性保存模型呢?我通过pip install安装了detectron2,随后在detectron2.engine.defaults.py中的DefaultTrainer增加train函数(以期覆盖TrainerBase中的train函数),具体代码如下(基于TrainerBase.train(), 增加了一行print, 以及阶段性保存模型的代码):
` def train(self, start_iter: int, max_iter: int):
"""
Args:
start_iter, max_iter (int): See docs above
"""
logger = logging.getLogger(name)
logger.info("Starting training from iteration {}".format(start_iter))
import ipdb; ipdb.set_trace()
self.iter = self.start_iter = start_iter
self.max_iter = max_iter
with EventStorage(start_iter) as self.storage:
try:
self.before_train()
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',start_iter, max_iter)
for self.iter in range(start_iter
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。