Skip to content

Commit

Permalink
Revise some confusing lines in localization code
Browse files Browse the repository at this point in the history
  • Loading branch information
kyuyeonpooh authored Jun 11, 2021
1 parent 55ec1cd commit 9620315
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions localize_sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ def localize_sound(model_path):
print("Loading from previous checkpoint.")

model.eval()
for i, data in enumerate(dataloader):
# 0: True, 1: False correspondence
# Audio-visual localization map on true positive pairs
for i, data in enumerate(dataloader):
img, aud, res = data
if res.item() == 0:
if res.item() != 0: # Exclude false pairs
continue
with torch.no_grad():
res, loc = model(img, aud)
if res.item() == 0:
if res.item() != 0: # Exclude false negative pairs
continue
img, aud = reverseTransform(img, aud)
img = bgr2rgb(img)
Expand Down

0 comments on commit 9620315

Please sign in to comment.