2593c5c7f473079153092e059ae18b253f33816d,tensorflow2/tf2cv/models/simplepose_coco.py,,_test,#,621

Before Change


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

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

        weight_count = sum([np.prod(K.get_value(w).shape) for w in net.trainable_weights])
        print("m={}, {}".format(model.__name__, weight_count))

After Change


    // data_format = "channels_first"
    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, data_format=data_format)

        batch = 14
        x = tf.random.normal((batch, 3, in_size[0], in_size[1]) if is_channels_first(data_format) else
                             (batch, in_size[0], in_size[1], 3))
        y = net(x)
        assert (y.shape[0] == batch)
        if return_heatmap:
            if is_channels_first(data_format):
                assert ((y.shape[1] == keypoints) and (y.shape[2] == x.shape[2] // 4) and
                        (y.shape[3] == x.shape[3] // 4))
            else:
                assert ((y.shape[3] == keypoints) and (y.shape[1] == x.shape[1] // 4) and
                        (y.shape[2] == x.shape[2] // 4))
        else:
            assert ((y.shape[1] == keypoints) and (y.shape[2] == 3))

        weight_count = sum([np.prod(K.get_value(w).shape) for w in net.trainable_weights])
        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)
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: 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: 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: gluon/gluoncv2/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