moved generating refimgs to once per import dir, rather than once per file (duh), and fixed BUG-18 (file counting wrong in ProcessAI)

This commit is contained in:
2021-01-25 10:42:25 +11:00
parent 49e9b05f59
commit 09b6863f0c
2 changed files with 9 additions and 6 deletions

1
BUGs
View File

@@ -1,4 +1,3 @@
### Next: 19
BUG-16: now we dont do dir level optimising for genfiledetails, need to stat the file / check dates that way to optimise
BUG-17: I think it won't handle me deleting files after scan
BUG-18: ProcessAI not counting files properly

View File

@@ -486,6 +486,11 @@ def JobProcessAI(job):
path = SymlinkName(path, '/')
d=session.query(Dir).filter(Dir.path_prefix==path).first()
job.num_files=d.num_files
people = session.query(Person).all()
for person in people:
generateKnownEncodings(person)
for e in FilesInDir( path ):
ProcessFilesInDir(job, e, ProcessAI)
FinishJob(job, "Finished Processesing AI")
@@ -508,13 +513,9 @@ def GenHashAndThumb(job, e):
def ProcessAI(job, e):
if e.type.name != 'Image':
job.current_file_num+=1
print("DDP: ProcessAI: adding 1 to current_file_num as we have a non-image file")
return
people = session.query(Person).all()
for person in people:
generateKnownEncodings(person)
file = e.in_dir[0].path_prefix + '/' + e.name
stat = os.stat(file)
# only find faces if we have not already OR file is newer than when we found faces before
@@ -530,10 +531,12 @@ def ProcessAI(job, e):
e.file_details[0].faces = flat_faces.tobytes()
else:
e.file_details[0].faces = None
job.current_file_num+=1
return
else:
if not e.file_details[0].faces:
print("OPTIM: This image has no faces, skip it")
job.current_file_num+=1
return
recover=numpy.frombuffer(e.file_details[0].faces,dtype=numpy.float64)
real_recover=numpy.reshape(recover,(-1,128))
@@ -541,6 +544,7 @@ def ProcessAI(job, e):
for el in real_recover:
l.append(numpy.array(el))
faces = l
people = session.query(Person).all()
for unknown_encoding in faces:
for person in people:
lookForPersonInImage(job, person, unknown_encoding, e)