首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在mmdetection中运行train_detector后如何保存模型权重?

在mmdetection中运行train_detector后如何保存模型权重?
EN

Stack Overflow用户
提问于 2021-06-13 16:15:19
回答 1查看 179关注 0票数 1
代码语言:javascript
复制
cfg.optimizer.lr = 0.02 / 8
cfg.lr_config.warmup = None
cfg.log_config.interval = 600
# Change the evaluation metric since we use customized dataset.
cfg.evaluation.metric = 'bbox'
# We can set the evaluation interval to reduce the evaluation times
cfg.evaluation.interval = 3
# We can set the checkpoint saving interval to reduce the storage cost
cfg.checkpoint_config.interval = 3
# Set seed thus the results are more reproducible
cfg.seed = 0
set_random_seed(0, deterministic=False)
cfg.gpu_ids = range(1)

cfg.load_from = 'gdrive/My Drive/mmdetection/checkpoints/vfnet_r50_fpn_mdconv_c3- 
c5_mstrain_2x_coco_20201027pth-6879c318.pth'
cfg.work_dir = "../vinbig"
cfg.runner.max_epochs = 6
cfg.total_epochs = 6model = build_detector(cfg.model)
datasets = [build_dataset(cfg.data.train)]
train_detector(model, datasets[0], cfg, distributed=False, validate=True)

现在,我的问题是,一旦我在自定义数据集上对模型进行了微调,我如何使用它进行测试?微调的模型存储在哪里?在大多数地方,模型都会立即用于测试,但是如何保存优化后的模型以便稍后测试呢?

代码语言:javascript
复制
img = mmcv.imread('kitti_tiny/training/image_2/000068.jpeg')

model.cfg = cfg
result = inference_detector(model, img)
show_result_pyplot(model, img, result)

上述情况主要发生在训练阶段之后。但那是因为模型已经在runtime.How中了,我可以创建我自己的mmdetection模型检查点吗?我一直在做Google colab。

EN

回答 1

Stack Overflow用户

发布于 2021-06-20 06:54:27

嗯,我不知道怎么手动操作,但是你的检查点会自动保存在cfg.work_dir = "../vinbig"中。在那里,您可以找到'latest.pth'文件作为您的最终检查点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67956196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档