585303417c3f4641f61ac5a916a51505a67cc507,example/mscoco.py,,train,#,125
Before Change
// measure data loading time
data_time.update(time.time() - end)
input_var = torch.autograd.Variable(inputs.cuda())
target_var = torch.autograd.Variable(target.cuda(async=True))
// compute output
output = model(input_var)
score_map = output[-1].data.cpu()
loss = criterion(output[0], target_var)
for j in range(1, len(output)):
loss += criterion(output[j], target_var)
acc = accuracy(score_map, target, idx)
if debug: // visualize groundtruth and predictions
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:
ax1 = plt.subplot(121)
ax1.title.set_text("Groundtruth")
gt_win = plt.imshow(gt_batch_img)
ax2 = plt.subplot(122)
ax2.title.set_text("Prediction")
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))
// compute gradient and do SGD step
After Change
// measure data loading time
data_time.update(time.time() - end)
input, target = input.to(device), target.to(device, non_blocking=True)
// compute output
output = model(input)
score_map = output[-1].data.cpu()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
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
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