7ce6642f777e9da6249bd5b05330d57fa09ea37a,example/mpii.py,,train,#,131

Before Change


        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



        if debug: // visualize groundtruth and predictions
            gt_batch_img = batch_with_heatmap(input, target)
            pred_batch_img = batch_with_heatmap(input, output[0])
            if not gt_win or not pred_win:
                ax1 = plt.subplot(121)
                ax1.title.set_text("Groundtruth")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: train


Project Name: pytorch/contrib
Commit Name: 1e3564915cd6ce0b05fd656274768393372b49b9
Time: 2018-08-30
Author: tongzhou.wang.1994@gmail.com
File Name: torchcontrib/optim/swa.py
Class Name: SWA
Method Name: bn_update


Project Name: ClementPinard/FlowNetPytorch
Commit Name: d95f630a7b7f88621bc4abb4ac92692647f03781
Time: 2018-08-23
Author: clement.pinard@parrot.com
File Name: main.py
Class Name:
Method Name: validate