Skip to content

Commit

Permalink
fix gps proximity searching
Browse files Browse the repository at this point in the history
  • Loading branch information
PJDude committed Jan 5, 2025
1 parent 0d610dc commit 5c6b5d3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = {}
Expand All @@ -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}')

Expand Down

0 comments on commit 5c6b5d3

Please sign in to comment.