aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--evaluate.py24
1 files changed, 24 insertions, 0 deletions
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