From 4f6f1b25b8f58508c3191bf68cbdfd9cda0a2499 Mon Sep 17 00:00:00 2001 From: Pandapowr <144907656+PandapowrTR@users.noreply.github.com> Date: Sat, 3 Feb 2024 21:01:19 +0300 Subject: [PATCH] optimized deleteSimilarDetections --- Data/Dominate/DominateLabeledImage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Data/Dominate/DominateLabeledImage.py b/Data/Dominate/DominateLabeledImage.py index 2ac2e00..f2761ed 100644 --- a/Data/Dominate/DominateLabeledImage.py +++ b/Data/Dominate/DominateLabeledImage.py @@ -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")) @@ -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)