def TSNE_sift(name):
    conn = sqlite3.connect(dirm.sqlite_file)
    c = conn.cursor()
    dist = sift_cb_handler.get_distributions()
    X_Ids = []
    X_data = []
    for d in dist:
        x_id = d[0]
        x_data = d[1:]
        X_Ids.append(x_id)
        X_data.append(x_data)
    X_data = np.array(X_data)
    model = TSNE(n_components=2)
    tsne_x = model.fit_transform(X_data)
    tsneHandler.storeTsneValsWIds(name, tsne_x, X_Ids)
    return tsne_x, X_Ids
def TSNE_sift(name):
    conn = sqlite3.connect(dirm.sqlite_file)
    c = conn.cursor()
    dist = sift_cb_handler.get_distributions()
    X_Ids = []
    X_data = []
    for d in dist:
        x_id = d[0]
        x_data = d[1:]
        X_Ids.append(x_id)
        X_data.append(x_data)
    X_data = np.array(X_data)
    model = TSNE(n_components=2)
    tsne_x = model.fit_transform(X_data)
    tsneHandler.storeTsneValsWIds(name, tsne_x, X_Ids)
    return tsne_x, X_Ids
def perform():
    #imagesHandler.load_images()
    #colourHandler.extract_colour_distribution_from_all_images("RGB")
    RGB_data = colourHandler.getColourDistForAllImages("RGB")
    RGB_data = np.array(RGB_data,dtype=None)
    RGB_data= np.delete(RGB_data,0,1)
    
    LAB_data = colourHandler.getColourDistForAllImages("LAB")
    LAB_data = np.array(RGB_data,dtype=None)
    LAB_data= np.delete(RGB_data,0,1)
    
    gistVals = util.loadCSV("gistvals")
    gist_data = np.array(gistVals)
    
    #hogHandler.extract_hog_from_all_images()
    hog_data = hogHandler.getHogValsforAllImages()
    hog_data = np.array(hog_data,dtype=None)
    hog_data= np.delete(hog_data,0,1)
    hog_data = np.array(hog_data)
    
    #surfCodebook.run_codebook(n_clusters,400, 0.3, cv2.INTER_CUBIC, 0)
    surf_data = surf_cb_handler.get_distributions()
    surf_data = np.array(surf_data,dtype=None)
    surf_data= np.delete(surf_data,0,1)
    
    sift_data = sift_cb_handler.get_distributions()
    sift_data = np.array(sift_data,dtype=None)
    sift_data= np.delete(sift_data,0,1)
    
    orb_data = orb_cb_handler.get_distributions()
    orb_data = np.array(surf_data,dtype=None)
    orb_data= np.delete(surf_data,0,1)
    
    
    
    
    est = KMeans(n_clusters=30)
    
    print(79 * '_')
    print('% 9s' % 'init'
          '    time  inertia    h**o   compl  v-meas     ARI AMI  silhouette')
    
    bench_k_means(est, "colourPerfomanceVmeta", colour_data)
    bench_k_means(est, "hogPerfomanceVmeta", hog_data)
    #bench_k_means(est, "surfPerfomanceVmeta", surf_data)
Example #4
0
def perform():
    #imagesHandler.load_images()
    #colourHandler.extract_colour_distribution_from_all_images("RGB")
    RGB_data = colourHandler.getColourDistForAllImages("RGB")
    RGB_data = np.array(RGB_data, dtype=None)
    RGB_data = np.delete(RGB_data, 0, 1)

    LAB_data = colourHandler.getColourDistForAllImages("LAB")
    LAB_data = np.array(RGB_data, dtype=None)
    LAB_data = np.delete(RGB_data, 0, 1)

    gistVals = util.loadCSV("gistvals")
    gist_data = np.array(gistVals)

    #hogHandler.extract_hog_from_all_images()
    hog_data = hogHandler.getHogValsforAllImages()
    hog_data = np.array(hog_data, dtype=None)
    hog_data = np.delete(hog_data, 0, 1)
    hog_data = np.array(hog_data)

    #surfCodebook.run_codebook(n_clusters,400, 0.3, cv2.INTER_CUBIC, 0)
    surf_data = surf_cb_handler.get_distributions()
    surf_data = np.array(surf_data, dtype=None)
    surf_data = np.delete(surf_data, 0, 1)

    sift_data = sift_cb_handler.get_distributions()
    sift_data = np.array(sift_data, dtype=None)
    sift_data = np.delete(sift_data, 0, 1)

    orb_data = orb_cb_handler.get_distributions()
    orb_data = np.array(surf_data, dtype=None)
    orb_data = np.delete(surf_data, 0, 1)

    est = KMeans(n_clusters=30)

    print(79 * '_')
    print(
        '% 9s' % 'init'
        '    time  inertia    h**o   compl  v-meas     ARI AMI  silhouette')

    bench_k_means(est, "colourPerfomanceVmeta", colour_data)
    bench_k_means(est, "hogPerfomanceVmeta", hog_data)
Example #5
0
gistVals = util.loadCSV("gistvals")
gist_data = np.array(gistVals)

#hogHandler.extract_hog_from_all_images()
hog_data = hogHandler.getHogValsforAllImages()
hog_data = np.array(hog_data, dtype=None)
hog_data = np.delete(hog_data, 0, 1)
hog_data = np.array(hog_data)

#surfCodebook.run_codebook(n_clusters,400, 0.3, cv2.INTER_CUBIC, 0)
surf_data = surf_cb_handler.get_distributions()
surf_data = np.array(surf_data, dtype=None)
surf_data = np.delete(surf_data, 0, 1)

sift_data = sift_cb_handler.get_distributions()
sift_data = np.array(sift_data, dtype=None)
sift_data = np.delete(sift_data, 0, 1)

orb_data = orb_cb_handler.get_distributions()
orb_data = np.array(orb_data, dtype=None)
orb_data = np.delete(orb_data, 0, 1)


def perLabel(label_name, labels, sample_size, n_clusters):
    print(79 * '_')
    print label_name
    print(
        '% 9s' % 'feature'
        '    time  inertia    h**o   compl  v-meas     ARI AMI  silhouette')
    #print "number of distinct classes for true labels for ",label_name, len(Counter(labels))
gistVals = util.loadCSV("gistvals")
gist_data = np.array(gistVals)

#hogHandler.extract_hog_from_all_images()
hog_data = hogHandler.getHogValsforAllImages()
hog_data = np.array(hog_data,dtype=None)
hog_data= np.delete(hog_data,0,1)
hog_data = np.array(hog_data)

#surfCodebook.run_codebook(n_clusters,400, 0.3, cv2.INTER_CUBIC, 0)
surf_data = surf_cb_handler.get_distributions()
surf_data = np.array(surf_data,dtype=None)
surf_data= np.delete(surf_data,0,1)

sift_data = sift_cb_handler.get_distributions()
sift_data = np.array(sift_data,dtype=None)
sift_data= np.delete(sift_data,0,1)

orb_data = orb_cb_handler.get_distributions()
orb_data = np.array(orb_data,dtype=None)
orb_data= np.delete(orb_data,0,1)


def perLabel(label_name,labels,sample_size,n_clusters):
    print(79 * '_')
    print label_name
    print('% 9s' % 'feature'
          '    time  inertia    h**o   compl  v-meas     ARI AMI  silhouette')
    #print "number of distinct classes for true labels for ",label_name, len(Counter(labels))
    estimator = KMeans(n_clusters=n_clusters)