How to use the patchy.betweenness_centrality function in patchy

To help you get started, we’ve selected a few patchy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rusty1s / graph-based-image-classification / converter / patchy_san.py View on Github external
def convert_image_to_field(image):
    rep = image_to_slic_zero(image, 100)
    superpixels = extract_superpixels(image, rep)

    graph = create_superpixel_graph(superpixels, node_mapping, edge_mapping)
    fields = receptive_fields(graph, order, 1, 100, 10, betweenness_centrality,
                              node_features, 8)
    fields = fields.astype(np.float32)
    return fields
github rusty1s / graph-based-image-classification / new_data / patchy_san.py View on Github external
node_attributes['green'],
                    node_attributes['blue'],
                    node_attributes['y'],
                    node_attributes['x'],
                    node_attributes['count'],
                    node_attributes['height'],
                    node_attributes['width'],
                ]

            image = image.astype(np.int32)
            segmentation = image_to_slic_zero(image, 50)
            superpixels = extract_superpixels(image, segmentation)
            graph = create_superpixel_graph(superpixels, node_map, edge_map)

            conv = receptive_fields(graph, order, 2, 25, 10,
                                    betweenness_centrality, node_features, 8)
            return conv.astype(np.float32)