use new shared version of GenThumb, add face / thumb into refimg class - still need much more to optimise refimg usage/creation in AI jobs, but it works
This commit is contained in:
@@ -216,6 +216,8 @@ class Refimg(Base):
|
|||||||
__tablename__ = "refimg"
|
__tablename__ = "refimg"
|
||||||
id = Column(Integer, Sequence('refimg_id_seq'), primary_key=True )
|
id = Column(Integer, Sequence('refimg_id_seq'), primary_key=True )
|
||||||
fname = Column(String(256), unique=True, nullable=False)
|
fname = Column(String(256), unique=True, nullable=False)
|
||||||
|
face = Column(LargeBinary)
|
||||||
|
thumbnail = Column(String, unique=False, nullable=True)
|
||||||
encodings = Column(LargeBinary)
|
encodings = Column(LargeBinary)
|
||||||
created_on = Column(Float)
|
created_on = Column(Float)
|
||||||
|
|
||||||
@@ -969,7 +971,7 @@ def JobRunAIOn(job):
|
|||||||
else:
|
else:
|
||||||
ppl=session.query(Person).filter(Person.tag==which_person).all()
|
ppl=session.query(Person).filter(Person.tag==which_person).all()
|
||||||
|
|
||||||
# FIXME: probably shouldbe elsewhere, but this is optmised so if refimgs exist for ppl, then it wont regen them
|
# FIXME: probably should be elsewhere, but this is optmised so if refimgs exist for ppl, then it wont regen them
|
||||||
for person in ppl:
|
for person in ppl:
|
||||||
generateKnownEncodings(person)
|
generateKnownEncodings(person)
|
||||||
|
|
||||||
@@ -1140,8 +1142,7 @@ def isImage(file):
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def GenImageThumbnail(job, file):
|
def GenThumb(file):
|
||||||
ProcessFileForJob( job, "Generate Thumbnail from Image file: {}".format( file ), file )
|
|
||||||
try:
|
try:
|
||||||
im_orig = Image.open(file)
|
im_orig = Image.open(file)
|
||||||
im = ImageOps.exif_transpose(im_orig)
|
im = ImageOps.exif_transpose(im_orig)
|
||||||
@@ -1154,10 +1155,14 @@ def GenImageThumbnail(job, file):
|
|||||||
img_bytearray = img_bytearray.getvalue()
|
img_bytearray = img_bytearray.getvalue()
|
||||||
thumbnail = base64.b64encode(img_bytearray)
|
thumbnail = base64.b64encode(img_bytearray)
|
||||||
thumbnail = str(thumbnail)[2:-1]
|
thumbnail = str(thumbnail)[2:-1]
|
||||||
|
return thumbnail
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
AddLogForJob(job, f"WARNING: No EXIF TAF found for: {file} - error={e}")
|
AddLogForJob(job, f"WARNING: No EXIF TAF found for: {file} - error={e}")
|
||||||
return None
|
return None
|
||||||
return thumbnail
|
|
||||||
|
def GenImageThumbnail(job, file):
|
||||||
|
ProcessFileForJob( job, "Generate Thumbnail from Image file: {}".format( file ), file )
|
||||||
|
return GenThumb(file)
|
||||||
|
|
||||||
def GenVideoThumbnail(job, file):
|
def GenVideoThumbnail(job, file):
|
||||||
ProcessFileForJob( job, "Generate Thumbnail from Video file: {}".format( file ), file )
|
ProcessFileForJob( job, "Generate Thumbnail from Video file: {}".format( file ), file )
|
||||||
@@ -1371,6 +1376,7 @@ def InitialValidationChecks():
|
|||||||
if not rbp_exists or not sp_exists or not ip_exists:
|
if not rbp_exists or not sp_exists or not ip_exists:
|
||||||
FinishJob(job,"ERROR: Job manager EXITing until above errors are fixed by paths being created or settings being updated to valid paths", "Failed" )
|
FinishJob(job,"ERROR: Job manager EXITing until above errors are fixed by paths being created or settings being updated to valid paths", "Failed" )
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
FinishJob(job,"Finished Initial Validation Checks")
|
FinishJob(job,"Finished Initial Validation Checks")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user