def get_coco_sample(
        img_shape=(240, 320),
        img_fill: Optional[int] = None,
        num_instances=1,
        with_bbox_cs=True,
        with_img_mask=False,
        random_keypoints_visible=False,
        non_occlusion=False):
    """Create a dummy data sample in COCO style."""
    rng = np.random.RandomState(0)
    h, w = img_shape
    if img_fill is None:
        img = np.random.randint(0, 256, (h, w, 3), dtype=np.uint8)
    else:
        img = np.full((h, w, 3), img_fill, dtype=np.uint8)

    if non_occlusion:
        bbox = _rand_bboxes(rng, num_instances, w / num_instances, h)
        for i in range(num_instances):
            bbox[i, 0::2] += w / num_instances * i
    else:
        bbox = _rand_bboxes(rng, num_instances, w, h)

    keypoints = _rand_keypoints(rng, bbox, 17)
    if random_keypoints_visible:
        keypoints_visible = np.random.randint(0, 2, (num_instances,
                                                     17)).astype(np.float32)
    else:
        keypoints_visible = np.full((num_instances, 17), 1, dtype=np.float32)

    upper_body_ids = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    lower_body_ids = [11, 12, 13, 14, 15, 16]
    flip_pairs = [[2, 1], [1, 2], [4, 3], [3, 4], [6, 5], [5, 6], [8, 7],
                  [7, 8], [10, 9], [9, 10], [12, 11], [11, 12], [14, 13],
                  [13, 14], [16, 15], [15, 16]]
    flip_indices = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]
    dataset_keypoint_weights = np.array([
        1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
        1.5
    ]).astype(np.float32)

    data = {
        'img': img,
        'img_shape': img_shape,
        'ori_shape': img_shape,
        'bbox': bbox,
        'keypoints': keypoints,
        'keypoints_visible': keypoints_visible,
        'upper_body_ids': upper_body_ids,
        'lower_body_ids': lower_body_ids,
        'flip_pairs': flip_pairs,
        'flip_indices': flip_indices,
        'dataset_keypoint_weights': dataset_keypoint_weights,
        'invalid_segs': [],
    }

    if with_bbox_cs:
        data['bbox_center'], data['bbox_scale'] = bbox_xyxy2cs(data['bbox'])

    if with_img_mask:
        data['img_mask'] = np.random.randint(0, 2, (h, w), dtype=np.uint8)

    return data
Create a dummy data sample in COCO style.
mmpose/mmpose/testing/_utils.py