Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,16 +970,16 @@ def validate(

with amp_autocast():
output = model(input)
if isinstance(output, (tuple, list)):
output = output[0]
if isinstance(output, (tuple, list)):
output = output[0]

# augmentation reduction
reduce_factor = args.tta
if reduce_factor > 1:
output = output.unfold(0, reduce_factor, reduce_factor).mean(dim=2)
target = target[0:target.size(0):reduce_factor]
# augmentation reduction
reduce_factor = args.tta
if reduce_factor > 1:
output = output.unfold(0, reduce_factor, reduce_factor).mean(dim=2)
target = target[0:target.size(0):reduce_factor]

loss = loss_fn(output, target)
loss = loss_fn(output, target)
acc1, acc5 = utils.accuracy(output, target, topk=(1, 5))

if args.distributed:
Expand Down
6 changes: 3 additions & 3 deletions validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ def validate(args):
with amp_autocast():
output = model(input)

if valid_labels is not None:
output = output[:, valid_labels]
loss = criterion(output, target)
if valid_labels is not None:
output = output[:, valid_labels]
loss = criterion(output, target)

if real_labels is not None:
real_labels.add_result(output)
Expand Down