Exemplo n.º 1
0
def _cluster_images(cluster_size, file_path):
    images = []
    positions = []
    #print("in cluster images")
    #print("cluster size: " + str(cluster_size))
    for image, lat, lon in images_with_gps(file_path):
        images.append(image)
        positions.append([lat, lon])

    positions = np.array(positions, np.float32)
    images = np.array(images).reshape((len(images), 1))
    #print('images')
    #print(images)
    #print('positions')
    #print(positions)

    #print(images.shape)

    K = float(images.shape[0]) / cluster_size
    K = int(np.ceil(K))
    #print('K')
    #print(K)
    #print('labels')

    labels, centers = tools.kmeans(positions, K)[1:]
    #print(labels)
    #print(centers)

    images = images.ravel()

    #print(images)
    labels = labels.ravel()
    #print(labels)

    save_clusters(file_path, images, positions, labels, centers)
Exemplo n.º 2
0
    def _cluster_images(self, meta_data, cluster_size):
        images = []
        positions = []
        for image, lat, lon in meta_data.images_with_gps():
            images.append(image)
            positions.append([lat, lon])

        positions = np.array(positions, np.float32)
        images = np.array(images).reshape((len(images), 1))

        K = float(images.shape[0]) / cluster_size
        K = int(np.ceil(K))

        labels, centers = tools.kmeans(positions, K)[1:]

        meta_data.save_clusters(images, positions, labels, centers)
Exemplo n.º 3
0
    def _cluster_images(self, meta_data, cluster_size):
        images = []
        positions = []
        for image, lat, lon in meta_data.images_with_gps():
            images.append(image)
            positions.append([lat, lon])

        positions = np.array(positions, np.float32)
        images = np.array(images).reshape((len(images), 1))

        K = float(images.shape[0]) / cluster_size
        K = int(np.ceil(K))

        labels, centers = tools.kmeans(positions, K)[1:]

        meta_data.save_clusters(images, positions, labels, centers)
Exemplo n.º 4
0
    def _cluster_images(self, meta_data, cluster_size):
        images = []
        positions = []

        print("in cluster here images")
        print("cluster size: " + str(cluster_size))
        print(meta_data)
        for image, lat, lon in meta_data.images_with_gps():
            images.append(image)
            positions.append([lat, lon])

        positions = np.array(positions, np.float32)
        images = np.array(images).reshape((len(images), 1))
        print('images')
        print(images)
        print('positions')
        print(positions)

        print(images.shape)

        K = float(images.shape[0]) / cluster_size
        K = int(np.ceil(K))
        print('K')
        print(K)
        print('labels')

        labels, centers = tools.kmeans(positions, K)[1:]
        print(labels)
        print(centers)

        images = images.ravel()

        print(images)
        labels = labels.ravel()
        print(labels)

        meta_data.save_clusters(images, positions, labels, centers)