Spaces:
Running
Running
File size: 962 Bytes
29f689c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import os
import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(__dir__)
sys.path.insert(0, os.path.abspath(os.path.join(__dir__, '..')))
from tools.engine import Config, Trainer
from tools.utility import ArgsParser
def parse_args():
parser = ArgsParser()
args = parser.parse_args()
return args
def main():
FLAGS = parse_args()
cfg = Config(FLAGS.config)
FLAGS = vars(FLAGS)
opt = FLAGS.pop('opt')
cfg.merge_dict(FLAGS)
cfg.merge_dict(opt)
trainer = Trainer(cfg, mode='eval')
best_model_dict = trainer.status.get('metrics', {})
trainer.logger.info('metric in ckpt ***************')
for k, v in best_model_dict.items():
trainer.logger.info('{}:{}'.format(k, v))
metric = trainer.eval()
trainer.logger.info('metric eval ***************')
for k, v in metric.items():
trainer.logger.info('{}:{}'.format(k, v))
if __name__ == '__main__':
main()
|