aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVasil Zlatanov <vasko@e4-pattern-vm.europe-west4-a.c.electric-orbit-223819.internal>2018-12-05 18:39:52 +0000
committerVasil Zlatanov <vasko@e4-pattern-vm.europe-west4-a.c.electric-orbit-223819.internal>2018-12-05 18:39:52 +0000
commit689ab1f6e0f9923d06507d6835f2d0d068a83d22 (patch)
tree704207204665392c2c95d847306ffabb96cc8dd7 /lib
parent0066c5e6d027713e94dff750828eba9d72f0ea47 (diff)
downloadvz215_np1915-689ab1f6e0f9923d06507d6835f2d0d068a83d22.tar.gz
vz215_np1915-689ab1f6e0f9923d06507d6835f2d0d068a83d22.tar.bz2
vz215_np1915-689ab1f6e0f9923d06507d6835f2d0d068a83d22.zip
Replace verbose with logging
Diffstat (limited to 'lib')
-rw-r--r--lib/kmean.py2
-rw-r--r--lib/rerank.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/kmean.py b/lib/kmean.py
index 58309bc..f041b19 100644
--- a/lib/kmean.py
+++ b/lib/kmean.py
@@ -1,3 +1,4 @@
+from logging import debug
import numpy as np
from sklearn.cluster import KMeans
@@ -39,6 +40,7 @@ def create_kmean_clusters(feature_vectors, labels, gallery_idx, camId):
cllab.append(km_labels[i][j])
train_data = np.array(cl)
+ debug("Kmean data has shape", train_data.shape)
train_label = np.array(cllab)
train_cam = np.array([clustercam[i] for i in range(2)]).reshape(train_label.shape[0])
return train_data, train_label, train_cam
diff --git a/lib/rerank.py b/lib/rerank.py
index 6b20f53..6fb5b7b 100644
--- a/lib/rerank.py
+++ b/lib/rerank.py
@@ -1,5 +1,6 @@
from scipy.spatial.distance import cdist
import numpy as np
+from logging import debug
def re_ranking(probFea,galFea,k1,k2,lambda_value, MemorySave = False, Minibatch = 2000):
@@ -7,7 +8,7 @@ def re_ranking(probFea,galFea,k1,k2,lambda_value, MemorySave = False, Minibatch
all_num = query_num + galFea.shape[0]
feat = np.append(probFea,galFea,axis = 0)
feat = feat.astype(np.float16)
- print('computing original distance')
+ debug('computing original distance')
if MemorySave:
original_dist = np.zeros(shape = [all_num,all_num],dtype = np.float16)
i = 0
@@ -29,7 +30,7 @@ def re_ranking(probFea,galFea,k1,k2,lambda_value, MemorySave = False, Minibatch
initial_rank = np.argsort(original_dist).astype(np.int32)
- print('starting re_ranking')
+ debug('starting re_ranking')
for i in range(all_num):
# k-reciprocal neighbors
forward_k_neigh_index = initial_rank[i,:k1+1]