def build_sample_with_masks(components, y_size):
    """
    Builds a sample for a model.

    :param components: components
    :return: list of final components of a sample.
    """
    img = components[10]
    mask = components[11]
    aug_joints = components[13]

    if mask is None:
        mask_paf = np.repeat(np.ones((y_size, y_size, 1), dtype=np.uint8), 38, axis=2)
        mask_heatmap = np.repeat(np.ones((y_size, y_size, 1), dtype=np.uint8), 19, axis=2)
    else:
        mask_paf = create_all_mask(mask, 38, stride=8)
        mask_heatmap = create_all_mask(mask, 19, stride=8)

    heatmap = create_heatmap(JointsLoader.num_joints_and_bkg, y_size, y_size,
                             aug_joints, 7.0, stride=8)

    pafmap = create_paf(JointsLoader.num_connections, y_size, y_size,
                        aug_joints, 1, stride=8)

    return [img.astype(np.float32),
            mask_paf.astype(np.float32),
            mask_heatmap.astype(np.float32),
            pafmap,
            heatmap]
コード例 #2
0
ファイル: dataflows.py プロジェクト: RimonAdel/openpose2
def build_sample(components, y_size):
    """
    Builds a sample for a model.

    :param components: components
    :return: list of final components of a sample.
    """
    img = components[10]
    aug_joints = components[13]

    heatmap = create_heatmap(JointsLoader.num_joints_and_bkg,
                             y_size,
                             y_size,
                             aug_joints,
                             7.0,
                             stride=8)

    pafmap = create_paf(JointsLoader.num_connections,
                        y_size,
                        y_size,
                        aug_joints,
                        1,
                        stride=8)

    return [img, pafmap, heatmap]
コード例 #3
0
def build_sample(components, y_size):
    """
    Builds a sample for a model.

    :param components: components
    :return: list of final components of a sample.
    """
    # img = components[10]
    # aug_joints = components[13]
    img = components[10]
    aug_joints = components[13]
    # print(img.shape)
    # print('aug_joints=',aug_joints)
    # aug_joints[6:]=None
    # print('aug_joints=',aug_joints)
    heatmap = create_heatmap(JointsLoader.num_joints_and_bkg,
                             y_size,
                             y_size,
                             aug_joints,
                             5.0,
                             stride=8)
    # create_heatmap(num_maps, height, width, all_joints, sigma, stride):
    pafmap = create_paf(JointsLoader.num_connections,
                        y_size,
                        y_size,
                        aug_joints,
                        0.8,
                        stride=8)

    return [img, pafmap, heatmap]