Skip to content

Commit

Permalink
wjm-wjm
Browse files Browse the repository at this point in the history
  • Loading branch information
wjm-wjm committed Jul 30, 2022
1 parent 2f0e675 commit 77e81fc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ def main_worker(args, args_main):
resume_path = args_main.resume_path
if os.path.isfile(resume_path):
checkpoint = torch.load(resume_path)
if "n_class" in checkpoint.keys():
n_class = checkpoint["n_class"]
if "epoch" in checkpoint.keys():
epoch = checkpoint["epoch"]
if "main_net" in checkpoint.keys():
n_class = checkpoint["main_net"]["classifier.weight"].size(0)
elif "net" in checkpoint.keys():
n_class = checkpoint["net"]["classifier.weight"].size(0)
epoch = checkpoint["epoch"]
print("==> Loading checkpoint {} (epoch {}, number of classes {})".format(resume_path, epoch, n_class))
else:
print("==> No checkpoint is found at {} (epoch {}, number of classes {})".format(resume_path, epoch, n_class))
Expand Down

0 comments on commit 77e81fc

Please sign in to comment.