Skip to content

Commit

Permalink
optimized deleteSimilarDetections
Browse files Browse the repository at this point in the history
  • Loading branch information
PandapowrTR authored Feb 3, 2024
1 parent f3fddb2 commit 4f6f1b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Data/Dominate/DominateLabeledImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def processFile(args):
uu = str(uuid.uuid1())
cutDetection = os.path.join(tempFolder, "temp-" + uu + file)
cv2.imwrite(cutDetection, img)

foundSimilar = False
for checkFile in files.copy():
if (
checkFile.lower().endswith((".png", ".jpeg", ".jpg"))
Expand Down Expand Up @@ -279,6 +279,10 @@ def processFile(args):
if imgAreSimilar(
cutDetection, checkCutDetection, maxSimilarity
):
if not foundSimilar:
foundSimilar = True
else:
continue
os.remove(os.path.join(root, checkFile))
deletedFiles.append(checkFile)
os.remove(checkCutDetection)
Expand Down

0 comments on commit 4f6f1b2

Please sign in to comment.