{{ t('recognize', 'You can delete all tags that no longer have any files associated with them with the following command:') }}
occ recognize:cleanup-tags
+
{{ t('recognize', 'To find and remove face detections that describe the same face of the same user in the same file more than once, run the following. Add --dry-run to only count them without changing anything.') }}
+occ recognize:remove-duplicate-faces --dry-run
+
{{ t('recognize', 'To remove tags that were created by Recognize version 2 from all files run the following on the terminal:') }}
occ recognize:remove-legacy-tags
@@ -531,6 +546,8 @@ export default {
ffmpeg: undefined,
cron: undefined,
modelsDownloaded: null,
+ modelsDownloadScheduled: false,
+ modelsPoll: null,
imagenetJobs: null,
facesJobs: null,
landmarksJobs: null,
@@ -589,6 +606,7 @@ export default {
},
async created() {
this.modelsDownloaded = loadState('recognize', 'modelsDownloaded')
+ this.getModelsStatus()
this.tagsEnabled = loadState('recognize', 'tagsEnabled')
this.recognizeBackendInstalled = loadState('recognize', 'recognizeBackendInstalled', false)
this.faceEmbeddingDimensions = loadState('recognize', 'faceEmbeddingDimensions', null)
@@ -654,7 +672,49 @@ export default {
}
},
+ beforeUnmount() {
+ if (this.modelsPoll) {
+ clearInterval(this.modelsPoll)
+ }
+ },
+
methods: {
+ async onDownloadModels() {
+ this.loading = true
+ try {
+ await axios.get(generateUrl('/apps/recognize/admin/downloadModels'))
+ this.modelsDownloadScheduled = true
+ this.startModelsPolling()
+ } catch (e) {
+ this.error = this.t('recognize', 'Failed to schedule the model download')
+ } finally {
+ this.loading = false
+ }
+ },
+ async getModelsStatus() {
+ try {
+ const resp = await axios.get(generateUrl('/apps/recognize/admin/modelsStatus'))
+ this.modelsDownloaded = resp.data.downloaded
+ this.modelsDownloadScheduled = resp.data.scheduled
+ if (!this.modelsDownloaded && this.modelsDownloadScheduled) {
+ this.startModelsPolling()
+ }
+ } catch (e) {
+ console.error(e)
+ }
+ },
+ startModelsPolling() {
+ if (this.modelsPoll) {
+ return
+ }
+ this.modelsPoll = setInterval(async () => {
+ await this.getModelsStatus()
+ if (this.modelsDownloaded || !this.modelsDownloadScheduled) {
+ clearInterval(this.modelsPoll)
+ this.modelsPoll = null
+ }
+ }, 10 * 1000)
+ },
async onReset() {
this.loading = true
await axios.get(generateUrl('/apps/recognize/admin/reset'))
diff --git a/tests/Controller/AdminControllerTest.php b/tests/Controller/AdminControllerTest.php
new file mode 100644
index 00000000..8479c782
--- /dev/null
+++ b/tests/Controller/AdminControllerTest.php
@@ -0,0 +1,178 @@
+markTestSkipped('The models directory exists in this checkout');
+ }
+
+ $eventDispatcher = $this->createMock(IEventDispatcher::class);
+ $jobList = $this->createMock(IJobList::class);
+ $appConfig = $this->createMock(IAppConfig::class);
+ $db = $this->createMock(IDBConnection::class);
+ $systemConfig = $this->createMock(IConfig::class);
+
+ $this->jobList = $jobList;
+ $this->jobRuns = $this->createMock(IJobRuns::class);
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
+
+ $settingsService = new SettingsService($appConfig, $jobList, $eventDispatcher, $db);
+ $queueService = new QueueService(new QueueMapper($db), $jobList, $appConfig, $eventDispatcher);
+ $clusterMapper = new FaceClusterMapper($db, $eventDispatcher);
+ $detectionMapper = new FaceDetectionMapper($db, $systemConfig, $settingsService, $eventDispatcher);
+ $tagManager = new TagManager(
+ $this->createMock(ISystemTagManager::class),
+ $this->createMock(ISystemTagObjectMapper::class),
+ $eventDispatcher,
+ );
+
+ $this->controller = new AdminController(
+ 'recognize',
+ $this->createMock(IRequest::class),
+ $tagManager,
+ $jobList,
+ $settingsService,
+ $queueService,
+ $clusterMapper,
+ $detectionMapper,
+ $appConfig,
+ $detectionMapper,
+ $this->createMock(IBinaryFinder::class),
+ $this->jobRuns,
+ $this->timeFactory,
+ );
+ }
+
+ /**
+ * @param list