2593c5c7f473079153092e059ae18b253f33816d,pytorch/pytorchcv/models/simplepose_coco.py,,_test,#,500

Before Change


        assert ((y.shape[0] == batch) and (y.shape[1] == keypoints) and (y.shape[2] == x.shape[2] // 4) and
                (y.shape[3] == x.shape[3] // 4))

        center = torch.zeros((batch, 2))
        scale = torch.ones((batch, 2))
        z, _ = net.calc_pose(y, center, scale)
        assert (z.shape[0] == batch)


if __name__ == "__main__":

After Change


def _test():
    in_size = (256, 192)
    keypoints = 17
    return_heatmap = False
    pretrained = False

    models = [
        simplepose_resnet18_coco,
        simplepose_resnet50b_coco,
        simplepose_resnet101b_coco,
        simplepose_resnet152b_coco,
        simplepose_resneta50b_coco,
        simplepose_resneta101b_coco,
        simplepose_resneta152b_coco,
    ]

    for model in models:

        net = model(pretrained=pretrained, in_size=in_size, return_heatmap=return_heatmap)

        // net.train()
        net.eval()
        weight_count = _calc_width(net)
        print("m={}, {}".format(model.__name__, weight_count))
        assert (model != simplepose_resnet18_coco or weight_count == 15376721)
        assert (model != simplepose_resnet50b_coco or weight_count == 33999697)
        assert (model != simplepose_resnet101b_coco or weight_count == 52991825)
        assert (model != simplepose_resnet152b_coco or weight_count == 68635473)
        assert (model != simplepose_resneta50b_coco or weight_count == 34018929)
        assert (model != simplepose_resneta101b_coco or weight_count == 53011057)
        assert (model != simplepose_resneta152b_coco or weight_count == 68654705)

        batch = 14
        x = torch.randn(batch, 3, in_size[0], in_size[1])
        y = net(x)
        assert ((y.shape[0] == batch) and (y.shape[1] == keypoints))
        if return_heatmap:
            assert ((y.shape[2] == x.shape[2] // 4) and (y.shape[3] == x.shape[3] // 4))
        else:
            assert (y.shape[2] == 3)


if __name__ == "__main__":
    _test()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: osmr/imgclsmob
Commit Name: 2593c5c7f473079153092e059ae18b253f33816d
Time: 2020-02-15
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/simplepose_coco.py
Class Name:
Method Name: _test


Project Name: osmr/imgclsmob
Commit Name: 2593c5c7f473079153092e059ae18b253f33816d
Time: 2020-02-15
Author: osemery@gmail.com
File Name: tensorflow2/tf2cv/models/simplepose_coco.py
Class Name:
Method Name: _test


Project Name: osmr/imgclsmob
Commit Name: 2593c5c7f473079153092e059ae18b253f33816d
Time: 2020-02-15
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/simplepose_coco.py
Class Name:
Method Name: _test


Project Name: osmr/imgclsmob
Commit Name: 2593c5c7f473079153092e059ae18b253f33816d
Time: 2020-02-15
Author: osemery@gmail.com
File Name: chainer_/chainercv2/models/simplepose_coco.py
Class Name:
Method Name: _test