digiKam
facepipeline_p.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-09-03
7  * Description : Integrated, multithread face detection / recognition
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FACE_PIPELINE_PRIVATE_H
26 #define DIGIKAM_FACE_PIPELINE_PRIVATE_H
27 
28 #include "facepipeline.h"
29 
30 // Qt includes
31 
32 #include <QExplicitlySharedDataPointer>
33 #include <QMetaMethod>
34 #include <QMutex>
35 #include <QSharedData>
36 #include <QWaitCondition>
37 
38 // Local includes
39 
40 #include "facedetector.h"
41 #include "faceutils.h"
42 #include "previewloadthread.h"
43 #include "thumbnailloadthread.h"
44 #include "workerobject.h"
45 
46 namespace Digikam
47 {
48 
49 class Q_DECL_HIDDEN FacePipeline::Private : public QObject
50 {
51  Q_OBJECT
52 
53 public:
54 
55  explicit Private(FacePipeline* const q);
56 
57  void processBatch(const QList<ItemInfo>& infos);
58  void sendFromFilter(const QList<FacePipelineExtendedPackage::Ptr>& packages);
59  void skipFromFilter(const QList<ItemInfo>& infosForSkipping);
60  void send(const FacePipelineExtendedPackage::Ptr& package);
61  bool senderFlowControl(const FacePipelineExtendedPackage::Ptr& package);
62  void receiverFlowControl();
63  FacePipelineExtendedPackage::Ptr buildPackage(const ItemInfo& info);
64  FacePipelineExtendedPackage::Ptr buildPackage(const ItemInfo& info,
66  const DImg& image);
67  FacePipelineExtendedPackage::Ptr buildPackage(const ItemInfo& info,
68  const FacePipelineFaceTagsIfaceList& faces,
69  const DImg& image);
70  FacePipelineExtendedPackage::Ptr filterOrBuildPackage(const ItemInfo& info);
71 
72  bool hasFinished();
73  void checkFinished();
74  void start();
75  void stop();
76  void wait();
77  void applyPriority();
78 
79  ThumbnailLoadThread* createThumbnailLoadThread();
80 
81 public:
82 
92 
94  QThread::Priority priority;
95 
97  bool started;
98  bool waiting;
103 
105 
106 public Q_SLOTS:
107 
108  void finishProcess(FacePipelineExtendedPackage::Ptr package);
109 
110 Q_SIGNALS:
111 
112  friend class FacePipeline;
114 
115  void accuracyAndModel(double accuracy, bool yolo);
116  void thresholdChanged(double threshold);
117 
118 private:
119 
120  FacePipeline* const q;
121 };
122 
123 } // namespace Digikam
124 
125 #endif // DIGIKAM_FACE_PIPELINE_PRIVATE_H
Definition: dimg.h:62
Definition: databasewriter.h:37
Definition: detectionbenchmarker.h:36
Definition: detectionworker.h:37
QExplicitlySharedDataPointer< FacePipelineExtendedPackage > Ptr
Definition: facepipelinepackage.h:168
Definition: facepipelinepackage.h:99
Definition: facepipelinepackage.h:58
Definition: facepipeline_p.h:50
int packagesOnTheRoad
Definition: facepipeline_p.h:100
RecognitionWorker * recognitionWorker
Definition: facepipeline_p.h:87
void accuracyAndModel(double accuracy, bool yolo)
void thresholdChanged(double threshold)
QList< QObject * > pipeline
Definition: facepipeline_p.h:93
QList< ThumbnailLoadThread * > thumbnailLoadThreads
Definition: facepipeline_p.h:96
void startProcess(FacePipelineExtendedPackage::Ptr package)
bool waiting
Definition: facepipeline_p.h:98
bool started
Definition: facepipeline_p.h:97
int maxPackagesOnTheRoad
Definition: facepipeline_p.h:101
QThread::Priority priority
Definition: facepipeline_p.h:94
RecognitionBenchmarker * recognitionBenchmarker
Definition: facepipeline_p.h:91
DetectionBenchmarker * detectionBenchmarker
Definition: facepipeline_p.h:90
ScanStateFilter * databaseFilter
Definition: facepipeline_p.h:83
TrainerWorker * trainerWorker
Definition: facepipeline_p.h:89
ParallelPipes * parallelDetectors
Definition: facepipeline_p.h:86
DetectionWorker * detectionWorker
Definition: facepipeline_p.h:85
DatabaseWriter * databaseWriter
Definition: facepipeline_p.h:88
QList< FacePipelineExtendedPackage::Ptr > delayedPackages
Definition: facepipeline_p.h:104
int totalPackagesAdded
Definition: facepipeline_p.h:102
FacePreviewLoader * previewThread
Definition: facepipeline_p.h:84
int infosForFiltering
Definition: facepipeline_p.h:99
Definition: facepipeline.h:36
Definition: facepreviewloader.h:35
Definition: iteminfo.h:78
Definition: parallelpipes.h:35
Definition: recognitionbenchmarker.h:36
Definition: recognitionworker.h:37
Definition: scanstatefilter.h:35
Definition: thumbnailloadthread.h:46
Definition: trainerworker.h:37
Definition: datefolderview.cpp:43