From 82d295c4693e17b71c52632740f4f98e141f8d49 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Mon, 4 Feb 2019 16:28:36 +0000 Subject: Add base evaluate.py --- evaluate.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 evaluate.py diff --git a/evaluate.py b/evaluate.py new file mode 100644 index 0000000..6504ec1 --- /dev/null +++ b/evaluate.py @@ -0,0 +1,24 @@ +# EE4 Selected Topics From Computer Vision Coursework +# Vasil Zlatanov, Nunzio Pucci + +CLUSTER_CNT = 1337 +KMEAN_PART = 33 + +import numpy as np +import matplotlib.pyplot as plt + +from sklearn.cluster import KMeans + +train = [] +test = [] + +train_part = np.hstack(train[0:KMEAN_PART]) + +kmeans = KMeans(n_clusters=CLUSTER_CNT, random_state=0).fit(train_part) + +codewords = [] +i = 0 + +for image in train: + codewords.append(np.bincount(kmeans.predict(image) + print codewords[i].shape -- cgit v1.2.3-54-g00ecf