From 5c6b5d3a1dac4fa89c728f816c59285985570fe9 Mon Sep 17 00:00:00 2001 From: xy Date: Sun, 5 Jan 2025 21:03:40 +0100 Subject: [PATCH] fix gps proximity searching --- src/core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core.py b/src/core.py index 903c248..0dd5bb4 100755 --- a/src/core.py +++ b/src/core.py @@ -867,6 +867,7 @@ def images_processing(self,operation_mode,hash_size,all_rotations,image_min_size if dict_key_proximity in self.images_data_cache['gps']: if val := self.images_data_cache['gps'][dict_key_proximity]: self_scan_results_image_to_gps[(dev,inode,mtime)] = val + #print('setting_1:',dev,inode,mtime,val) continue @@ -946,7 +947,10 @@ def images_processing(self,operation_mode,hash_size,all_rotations,image_min_size anything_new=True if gps_mode: # and gps brak danych gps tez mozna cacheowac self.images_data_cache['gps'][(dev,inode,mtime)]=gps - self_scan_results_image_to_gps[(dev,inode,mtime)] = gps + if gps: + #..ale nie ustawiać + self_scan_results_image_to_gps[(dev,inode,mtime)] = gps + #print('setting_2:',dev,inode,mtime,gps) anything_new=True if width and height: @@ -1056,9 +1060,8 @@ def gps_clustering(self,distance): for (path_nr,subpath,name,mtime,ctime,dev,ino,size) in sorted(self.scan_results_images, key=lambda x :[6],reverse = True) : dict_key = (dev,ino,mtime) - #print(f'{self_scan_results_image_to_gps=}') if dict_key in self_scan_results_image_to_gps: - pool.append( numpy_array(self_scan_results_image_to_gps[(dev,ino,mtime)] ) ) + pool.append( numpy_array(self_scan_results_image_to_gps[dict_key] ) ) keys.append( (path_nr,subpath,name,ctime,dev,ino,size) ) self_files_of_images_groups = self.files_of_images_groups = {} @@ -1070,7 +1073,8 @@ def gps_clustering(self,distance): t0=perf_counter() self.log.info(f'start DBSCAN') - labels = DBSCAN(eps=de_norm_distance, min_samples=2,n_jobs=-1,metric='euclidean',algorithm='auto').fit(pool).labels_ + #labels = DBSCAN(eps=de_norm_distance, min_samples=2,n_jobs=-1,metric='euclidean',algorithm='auto').fit(pool).labels_ + labels = DBSCAN(eps=de_norm_distance, min_samples=2,n_jobs=-1,metric='manhattan',algorithm='kd_tree').fit(pool).labels_ t1=perf_counter() self.log.info(f'DBSCAN end. Time:{t1-t0}')