diff --git a/lib/Command/CleanupTags.php b/lib/Command/CleanupTags.php
new file mode 100644
index 0000000000..1300b433c7
--- /dev/null
+++ b/lib/Command/CleanupTags.php
@@ -0,0 +1,55 @@
+tagManager = $tagManager;
+ }
+
+ /**
+ * Configure the command
+ *
+ * @return void
+ */
+ protected function configure() {
+ $this->setName('recognize:cleanup-tags')
+ ->setDescription('Delete all tags that have no files associated with them anymore');
+ }
+
+ /**
+ * Execute the command
+ *
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ *
+ * @return int
+ */
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ try {
+ $this->tagManager->removeEmptyTags();
+ } catch (\Exception $ex) {
+ $output->writeln('Failed to clean up tags');
+ $output->writeln($ex->getMessage());
+ return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/lib/Command/ResetTags.php b/lib/Command/ResetTags.php
new file mode 100644
index 0000000000..b5a90671d9
--- /dev/null
+++ b/lib/Command/ResetTags.php
@@ -0,0 +1,55 @@
+tagManager = $tagManager;
+ }
+
+ /**
+ * Configure the command
+ *
+ * @return void
+ */
+ protected function configure() {
+ $this->setName('recognize:reset-tags')
+ ->setDescription('Remove all tags from previously classified files');
+ }
+
+ /**
+ * Execute the command
+ *
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ *
+ * @return int
+ */
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ try {
+ $this->tagManager->resetClassifications();
+ } catch (\Exception $ex) {
+ $output->writeln('Failed to reset tags');
+ $output->writeln($ex->getMessage());
+ return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/lib/Service/TagManager.php b/lib/Service/TagManager.php
index 511d649aca..720c7bf552 100644
--- a/lib/Service/TagManager.php
+++ b/lib/Service/TagManager.php
@@ -90,7 +90,6 @@ public function resetClassifications(): void {
$tagIds = $this->objectMapper->getTagIdsForObjects($id, 'files');
$this->objectMapper->unassignTags($id, 'files', $tagIds[$id]);
}
- $this->removeEmptyTags();
}
public function removeEmptyTags(): void {
diff --git a/src/components/ViewAdmin.vue b/src/components/ViewAdmin.vue
index 8c174a714f..66acf0ce4f 100644
--- a/src/components/ViewAdmin.vue
+++ b/src/components/ViewAdmin.vue
@@ -58,6 +58,13 @@
occ recognize:classify-images
occ recognize:classify-audio
+
+ You can reset the tags of all files that have been previously classified by recognize with the following command:
+
+ occ recognize:reset-tags
+ You can delete all tags that no longer have any files associated with them with the following command:
+
+ occ recognize:cleanup-tags