7ce6642f777e9da6249bd5b05330d57fa09ea37a,example/mpii.py,,validate,#Any#Any#Any#Any#Any#Any#,206
Before Change
target = target.cuda(async=True)
input_var = torch.autograd.Variable(inputs.cuda(), volatile=True)
target_var = torch.autograd.Variable(target, volatile=True)
// compute output
output = model(input_var)
score_map = output[-1].data.cpu()
if flip:
flip_input_var = torch.autograd.Variable(
torch.from_numpy(fliplr(inputs.clone().numpy())).float().cuda(),
volatile=True
)
flip_output_var = model(flip_input_var)
flip_output = flip_back(flip_output_var[-1].data.cpu())
score_map += flip_output
loss = 0
for o in output:
loss += criterion(o, target_var)
acc = accuracy(score_map, target.cpu(), idx)
// generate predictions
preds = final_preds(score_map, meta["center"], meta["scale"], [64, 64])
for n in range(score_map.size(0)):
predictions[meta["index"][n], :, :] = preds[n, :, :]
if debug:
gt_batch_img = batch_with_heatmap(inputs, target)
pred_batch_img = batch_with_heatmap(inputs, score_map)
if not gt_win or not pred_win:
plt.subplot(121)
gt_win = plt.imshow(gt_batch_img)
plt.subplot(122)
pred_win = plt.imshow(pred_batch_img)
else:
gt_win.set_data(gt_batch_img)
pred_win.set_data(pred_batch_img)
plt.pause(.05)
plt.draw()
// measure accuracy and record loss
losses.update(loss.data[0], inputs.size(0))
acces.update(acc[0], inputs.size(0))
// measure elapsed time
After Change
target = target.cuda(async=True)
input = input.to(device, non_blocking=True)
target = target.to(device, non_blocking=True)
// compute output
output = model(input)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: bearpaw/pytorch-pose
Commit Name: 7ce6642f777e9da6249bd5b05330d57fa09ea37a
Time: 2019-01-07
Author: platero.yang@gmail.com
File Name: example/mpii.py
Class Name:
Method Name: validate
Project Name: bearpaw/pytorch-pose
Commit Name: 7ce6642f777e9da6249bd5b05330d57fa09ea37a
Time: 2019-01-07
Author: platero.yang@gmail.com
File Name: example/mpii.py
Class Name:
Method Name: train
Project Name: bearpaw/pytorch-pose
Commit Name: 585303417c3f4641f61ac5a916a51505a67cc507
Time: 2019-01-24
Author: platero.yang@gmail.com
File Name: example/mscoco.py
Class Name:
Method Name: train