Skip to content

Commit

Permalink
validate_topn save should makedir if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dhodcz2 committed Jul 30, 2024
1 parent 842efdb commit 99318fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tile2net/tileseg/utils/trnval_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,12 @@ def validate_topn(val_loader, net, criterion, optim, epoch, args, dump_assets=Tr

output_data = torch.nn.functional.softmax(output, dim=1).cpu().data
op = output_data.cpu().detach().numpy()
np.save(f'{cfg.RESULT_DIR}/output_{epoch}_{val_idx}.npy', op)
path = os.path.join(
cfg.RESULT_DIR,
f'output_{epoch}_{val_idx}.npy'
)
os.makedirs(cfg.RESULT_DIR, exist_ok=True)
np.save(path, op)
prob_mask, predictions = output_data.max(1)
#define assests based on the eval_minibatch function
assets = {}
Expand Down

0 comments on commit 99318fd

Please sign in to comment.