How to change the model parameter saving location when training with DefaultTrainer in detectron2

240 Views Asked by At

my code is like following:


cfg = get_cfg()

...
trainer = DefaultTrainer(cfg)
trainer.resume_or_load(resume=False)
trainer.train()

After training, the model is automatically saved in./output/model_final.pth. I found the folder where the model is saved, but I couldn't find an interface to change the model filename

What can I do to change the saved filename? I would really appreciate it if you could help me

1

There are 1 best solutions below

0
On

I've been spending ages trying to figure this out and still haven't got there. But a workaround I've used is by just changing the path itself rather than the file name.

cfg.OUTPUT_DIR = "./path/to/"

So I've got output/hands/model_final.pth and output/feet/model_final.pth instead of different filenames.