if we use run_ai_on_path, then we remove all existing matches on the path, then go again -- allows us to change threshold and reset

This commit is contained in:
2022-02-04 22:03:04 +11:00
parent 8ef3a97eb7
commit 694aef038b

View File

@@ -1449,6 +1449,7 @@ def JobRunAIOnPath(job):
path_cnt=0
for p in paths:
d = session.query(Dir).join(PathDirLink).filter(PathDirLink.path_id==p.id).filter(Dir.rel_path=='').first()
DelMatchesForDir( job, d.eid )
job.extra.append( JobExtra( name=f"eid-{path_cnt}", value=f"{d.eid}" ) )
path_cnt+=1
JobRunAIOn(job)
@@ -1927,6 +1928,28 @@ def AddFaceToFile( locn_data, face_data, file_eid, model_id, settings ):
session.commit()
return
####################################################################################################################################
# DelMatchesForDir(): quick func to delete any matched faces in the specified dir
####################################################################################################################################
def DelMatchesForDir( job, eid ):
print("Recurse through dirs deleting face per file" )
dir=session.query(Entry).get(eid)
ProcessFilesInDir( job, dir, DelMatchesForFile, False )
session.commit()
return
####################################################################################################################################
# DelMatchesForFile(): quick func to delete any matched faces associated with the specified file
####################################################################################################################################
def DelMatchesForFile( job, ent ):
if DEBUG:
AddLogForJob(job, f'Remove any old matches in {ent.name}')
session.execute( f"delete from face_refimg_link where face_id in (select face_id from face_file_link where file_eid = {ent.id})" )
ent.file_details.last_ai_scan=0
session.add(ent)
return
####################################################################################################################################
# DelFacesForFile(): quick func to delete any faces associated with the specified file
####################################################################################################################################