Exemple #1
0
def plot(hist_type):
    plt.figure(figsize=(24, 16))

    i = 0
    for num_bins in [5, 10, 30, 50]:
        i += 1
        print("Computing %s with %d bins..." % (hist_type, num_bins))

        plt.subplot(2, 2, i)
        plt.subplots_adjust(hspace=0.5)
        plt.title(str(num_bins) + " bins", {'fontsize': 24})
        rpc_module.compare_dist_rpc(model_images, query_images,
                                    ['chi2', 'intersect', 'l2'], hist_type,
                                    num_bins, ['r', 'g', 'b'])

    # plt.savefig("./plots/plt_" + hist_type + ".png")
    plt.show()
Exemple #2
0
    model_images = fp.readlines()
model_images = [x.strip() for x in model_images]

with open('query.txt') as fp:
    query_images = fp.readlines()
query_images = [x.strip() for x in query_images]

num_bins = 20

# %%

plt.figure(1, figsize=(15, 10))

dist_type = ['chi2', 'intersect', 'l2']
hist_model = ['rg', 'rgb', 'dxdy']
Binss = [10, 20, 30, 40]
for bins in Binss:
    cols = ['r', 'g', 'b']
    for i in range(1, 4):
        plt.subplot(1, 3, i)
        if i != 2:
            rpc_module.compare_dist_rpc(model_images, query_images, dist_type,
                                        hist_model[i - 1], bins, cols)
            plt.title(hist_model[i - 1] + ' histograms')
        else:
            rpc_module.compare_dist_rpc(model_images, query_images, dist_type,
                                        hist_model[i - 1], bins // 2, cols)
            plt.title(hist_model[i - 1] + ' histograms')
    plt.savefig("hist_bins" + str(bins) + ".png", format='png', dpi=600)
    plt.show()
Exemple #3
0
print('number of correct matches: %d (%f)\n' %
      (num_correct, 1.0 * num_correct / len(query_images)))

# plot recall_precision curves (Question 4)

with open('model.txt') as fp:
    model_images = fp.readlines()
model_images = [x.strip() for x in model_images]

with open('query.txt') as fp:
    query_images = fp.readlines()
query_images = [x.strip() for x in query_images]

plt.figure()
rpc_module.compare_dist_rpc(model_images, query_images,
                            ['chi2', 'intersect', 'l2'], 'rg', eval_num_bins,
                            ['r', 'g', 'b'])
plt.title('RG histograms')
plt.show()

plt.figure()
rpc_module.compare_dist_rpc(model_images, query_images,
                            ['chi2', 'intersect', 'l2'], 'rgb',
                            int(eval_num_bins / 2), ['r', 'g', 'b'])
plt.title('RGB histograms')
plt.show()

plt.figure()
rpc_module.compare_dist_rpc(model_images, query_images,
                            ['chi2', 'intersect', 'l2'], 'dxdy', eval_num_bins,
                            ['r', 'g', 'b'])
with open('model.txt') as fp:
    model_images = fp.readlines()
model_images = [x.strip() for x in model_images] 

with open('query.txt') as fp:
    query_images = fp.readlines()
query_images = [x.strip() for x in query_images] 


num_bins = [5,10,20,30,40,50]


for bin_ in num_bins:
    plt.figure(8)
    rpc_module.compare_dist_rpc(model_images, query_images, ['chi2', 'intersect', 'l2'], 'rg', bin_, ['r', 'g', 'b'])
    plt.title('RG histograms '+ str(bin_))
    plt.show()
 
for bin_ in num_bins:
    plt.figure(9)
    rpc_module.compare_dist_rpc(model_images, query_images, ['chi2', 'intersect', 'l2'], 'rgb', bin_, ['r', 'g', 'b'])
    plt.title('RGB histograms '+ str(bin_))
    plt.show()


for bin_ in num_bins:
    plt.figure(10)
    rpc_module.compare_dist_rpc(model_images, query_images, ['chi2', 'intersect', 'l2'], 'dxdy', bin_, ['r', 'g', 'b'])
    plt.title('dx/dy histograms '+ str(bin_))
    plt.show()