Example #1
0
    def find_duplicates(self):
        if IMAGE_PATH_DICT == {}:
            self.statusBar.setStyleSheet("color: red")
            self.statusBar.showMessage("Please process your media files first")
            return None

        self.duplicateButton.setDisabled(True)
        self.processButton.setDisabled(True)
        self.reindexButton.setDisabled(True)
        self.statusBar.setStyleSheet("color: black")
        self.statusBar.showMessage("Finding duplicates...")

        with db_session():
            # get all images descriptors
            image_files_query = Image.get_descriptors()

        pairs_amount = int(
            len(image_files_query) * (len(image_files_query) - 1) / 2)

        QMessageBox.information(
            self,
            "Find duplicates",
            f"""
            Similar images search start. Please wait!\n
            You have ~{pairs_amount} images pairs;
            Work will get ~{round(pairs_amount*0.00006, 2)} sec.
            """,
            QMessageBox.Ok,
            QMessageBox.Ok,
        )

        # run function to find duplicates
        result = feature_description(images_list=image_files_query)
        with db_session():
            # save duplicates to DB
            save_images_duplicates(result)

        QMessageBox.information(self, "Find duplicates", "Success!",
                                QMessageBox.Ok, QMessageBox.Ok)
        # set all buttons able
        self.duplicateButton.setEnabled(True)
        self.reindexButton.setEnabled(True)
        self.processButton.setEnabled(True)
Example #2
0
print(time.time() - start_time)

# get photo and video files lists
image_files_list, video_files_list = index_folder_files(path=path,
                                                        max_depth=4,
                                                        indexing_type="all")

# print(image_files_list)
# print(video_files_list)

print("Files indexed")

# video_processing(video_files_list)
print(len(image_files_list))
image_processing(image_files_list)
print((time.time() - start_time) / len(image_files_list))

with db_session():
    image_files_query = Image.get_descriptors()

feature_description(images_list=image_files_query)
print((time.time() - start_time) / len(image_files_query))
raise Exception

print(len(image_files_list))
print(len(image_files_query))

# get certain image all duplicates
result = get_image_duplicates(image_id=8, similarity_threshold=150)
print(result)