digiKam
Digikam::FacePipeline Class Reference
+ Inheritance diagram for Digikam::FacePipeline:

Classes

class  Private
 

Public Types

enum  FilterMode {
  ScanAll , SkipAlreadyScanned , ReadUnconfirmedFaces , ReadFacesForTraining ,
  ReadConfirmedFaces
}
 
enum  WriteMode { NormalWrite , OverwriteUnconfirmed }
 

Public Slots

FaceTagsIface addManually (const ItemInfo &info, const DImg &image, const TagRegion &assignedRegion)
 
FaceTagsIface confirm (const ItemInfo &info, const FaceTagsIface &face, const DImg &image, int assignedTagId=0, const TagRegion &assignedRegion=TagRegion())
 
FaceTagsIface confirm (const ItemInfo &info, const FaceTagsIface &face, int assignedTagId=0, const TagRegion &assignedRegion=TagRegion())
 
FaceTagsIface editRegion (const ItemInfo &info, const DImg &image, const FaceTagsIface &databaseFace, const TagRegion &newRegion)
 
FaceTagsIface editTag (const ItemInfo &info, const FaceTagsIface &databaseFace, int newTagId)
 
bool process (const ItemInfo &info)
 
bool process (const ItemInfo &info, const DImg &image)
 
void process (const QList< ItemInfo > &infos)
 
void remove (const ItemInfo &info, const FaceTagsIface &face)
 
void setAccuracyAndModel (double accuracy, bool yolo)
 
void train (const ItemInfo &info, const QList< FaceTagsIface > &faces)
 
void train (const ItemInfo &info, const QList< FaceTagsIface > &faces, const DImg &image)
 

Signals

void finished ()
 Emitted when the last package has finished processing. More...
 
void processed (const FacePipelinePackage &package)
 Emitted when one package has finished processing. More...
 
void processing (const FacePipelinePackage &package)
 Emitted when one package begins processing. More...
 
void progressValueChanged (float progress)
 
void scheduled ()
 Emitted when processing is scheduled. More...
 
void skipped (const QList< ItemInfo > &skippedInfos)
 Emitted when one or several packages were skipped, usually because they have already been scanned. More...
 
void started (const QString &message)
 Emitted when processing has started. More...
 

Public Member Functions

QString benchmarkResult () const
 
void cancel ()
 
void construct ()
 
 FacePipeline ()
 
bool hasFinished () const
 
void plugDatabaseEditor ()
 
void plugDatabaseFilter (FilterMode mode)
 
void plugDatabaseWriter (WriteMode mode)
 
void plugDetectionBenchmarker ()
 
void plugFaceDetector ()
 
void plugFacePreviewLoader ()
 
void plugFaceRecognizer ()
 
void plugParallelFaceDetectors ()
 
void plugRecognitionBenchmarker ()
 
void plugRerecognizingDatabaseFilter ()
 
void plugRetrainingDatabaseFilter ()
 
void plugTrainer ()
 
QThread::Priority priority () const
 
void setPriority (QThread::Priority priority)
 
void shutDown ()
 
 ~FacePipeline () override
 

Friends

class Private
 

Member Enumeration Documentation

◆ FilterMode

Enumerator
ScanAll 

Will read any given image.

SkipAlreadyScanned 

Will skip any image that is already marked as scanned.

ReadUnconfirmedFaces 

Will read unconfirmed faces for recognition.

ReadFacesForTraining 

Will read faces marked for training.

ReadConfirmedFaces 

Will read faces which are confirmed.

◆ WriteMode

Enumerator
NormalWrite 

Write results. Merge with existing entries.

OverwriteUnconfirmed 

Add new results. Previous unconfirmed results will be cleared.

Constructor & Destructor Documentation

◆ FacePipeline()

Digikam::FacePipeline::FacePipeline ( )
explicit

◆ ~FacePipeline()

Member Function Documentation

◆ addManually

◆ benchmarkResult()

◆ cancel()

void Digikam::FacePipeline::cancel ( )

Cancels all processing

References Digikam::FacePipeline::Private::stop().

Referenced by shutDown().

◆ confirm [1/2]

◆ confirm [2/2]

FaceTagsIface Digikam::FacePipeline::confirm ( const ItemInfo info,
const FaceTagsIface face,
int  assignedTagId = 0,
const TagRegion assignedRegion = TagRegion() 
)
slot

Confirm the face. Pass the original face, and additionally tag id or region if they changed. Returns the confirmed face entry immediately purely for convenience, it is not yet in the database (connect to signal processed() to react when the processing finished). If a trainer is plugged, the face will be trained.

Referenced by Digikam::DigikamItemView::confirmFaces(), and Digikam::FaceGroup::slotAssigned().

◆ construct()

◆ editRegion

FaceTagsIface Digikam::FacePipeline::editRegion ( const ItemInfo info,
const DImg image,
const FaceTagsIface databaseFace,
const TagRegion newRegion 
)
slot

◆ editTag

FaceTagsIface Digikam::FacePipeline::editTag ( const ItemInfo info,
const FaceTagsIface databaseFace,
int  newTagId 
)
slot

◆ finished

void Digikam::FacePipeline::finished ( )
signal

Emitted when the last package has finished processing.

◆ hasFinished()

bool Digikam::FacePipeline::hasFinished ( ) const

◆ plugDatabaseEditor()

void Digikam::FacePipeline::plugDatabaseEditor ( )

◆ plugDatabaseFilter()

void Digikam::FacePipeline::plugDatabaseFilter ( FilterMode  mode)

You can plug these four different steps in the working pipeline. 1) Call any of the four plug...() methods. See below for supported combinations. 2) Call construct() to set up the pipeline.

  • Database filter: Prepares database records and/or filters out items. See FilterMode for specification.
  • Preview loader: If no preview loader is plugged, you must provide a DImg for face detection and recognition
  • Face Detector: If no recognizer is plugged, all detected face are marked as the unknown person
  • Face Recognizer: If no detector is plugged, only already scanned faces marked as unknown will be processed. They are implicitly read from the database.
  • DatabaseWriter: Writes the detection and recognition results to the database. The trainer works on a completely different storage and is not affected by the database writer.
  • DatabaseEditor: Can confirm or reject faces

PlugParallel: You can call this instead of the simple plugging method. Depending on the number of processor cores of the machine and the memory cost, more than one element may be plugged and process parallelly for this part of the pipeline.

Supported combinations: (Database Filter ->) (Preview Loader ->) Detector -> Recognizer (-> DatabaseWriter) (Database Filter ->) (Preview Loader ->) Detector (-> DatabaseWriter) (Database Filter ->) (Preview Loader ->) Recognizer (-> DatabaseWriter) DatabaseEditor Trainer DatabaseEditor -> Trainer

References Digikam::FacePipeline::Private::databaseFilter.

Referenced by plugRerecognizingDatabaseFilter(), and plugRetrainingDatabaseFilter().

◆ plugDatabaseWriter()

void Digikam::FacePipeline::plugDatabaseWriter ( WriteMode  mode)

◆ plugDetectionBenchmarker()

void Digikam::FacePipeline::plugDetectionBenchmarker ( )

◆ plugFaceDetector()

void Digikam::FacePipeline::plugFaceDetector ( )

◆ plugFacePreviewLoader()

void Digikam::FacePipeline::plugFacePreviewLoader ( )

◆ plugFaceRecognizer()

void Digikam::FacePipeline::plugFaceRecognizer ( )

◆ plugParallelFaceDetectors()

void Digikam::FacePipeline::plugParallelFaceDetectors ( )

◆ plugRecognitionBenchmarker()

void Digikam::FacePipeline::plugRecognitionBenchmarker ( )

◆ plugRerecognizingDatabaseFilter()

◆ plugRetrainingDatabaseFilter()

◆ plugTrainer()

void Digikam::FacePipeline::plugTrainer ( )

◆ priority()

◆ process [1/3]

bool Digikam::FacePipeline::process ( const ItemInfo info)
slot

Processes the given image info. If a filter is installed, returns false if the info is skipped, or true if it is processed. If no preview loader is plugged, you must provide a DImg for detection or recognition. Any of the signals below will only be emitted if true is returned.

References Digikam::ItemInfo::filePath().

Referenced by construct().

◆ process [2/3]

bool Digikam::FacePipeline::process ( const ItemInfo info,
const DImg image 
)
slot

◆ process [3/3]

void Digikam::FacePipeline::process ( const QList< ItemInfo > &  infos)
slot

Batch processing. If a filter is installed, the skipped() signal will inform about skipped infos. Filtering is done in a thread, returns immediately. Some of the signals below will be emitted in any case.

References Digikam::FacePipeline::Private::processBatch().

◆ processed

void Digikam::FacePipeline::processed ( const FacePipelinePackage package)
signal

Emitted when one package has finished processing.

Referenced by construct().

◆ processing

void Digikam::FacePipeline::processing ( const FacePipelinePackage package)
signal

Emitted when one package begins processing.

◆ progressValueChanged

void Digikam::FacePipeline::progressValueChanged ( float  progress)
signal

◆ remove

void Digikam::FacePipeline::remove ( const ItemInfo info,
const FaceTagsIface face 
)
slot

◆ scheduled

void Digikam::FacePipeline::scheduled ( )
signal

Emitted when processing is scheduled.

◆ setAccuracyAndModel

void Digikam::FacePipeline::setAccuracyAndModel ( double  accuracy,
bool  yolo 
)
slot

◆ setPriority()

void Digikam::FacePipeline::setPriority ( QThread::Priority  priority)

Set the priority of the threads used by this pipeline. The default setting is QThread::LowPriority.

References Digikam::FacePipeline::Private::applyPriority(), priority(), and Digikam::FacePipeline::Private::priority.

◆ shutDown()

void Digikam::FacePipeline::shutDown ( )

Cancels and waits for the pipeline to finish

References cancel(), and Digikam::FacePipeline::Private::wait().

Referenced by ~FacePipeline().

◆ skipped

void Digikam::FacePipeline::skipped ( const QList< ItemInfo > &  skippedInfos)
signal

Emitted when one or several packages were skipped, usually because they have already been scanned.

◆ started

void Digikam::FacePipeline::started ( const QString &  message)
signal

Emitted when processing has started.

Referenced by Digikam::FacePipeline::Private::start(), and Digikam::FacePipeline::Private::stop().

◆ train [1/2]

void Digikam::FacePipeline::train ( const ItemInfo info,
const QList< FaceTagsIface > &  faces 
)
slot

Train the given faces.

◆ train [2/2]

void Digikam::FacePipeline::train ( const ItemInfo info,
const QList< FaceTagsIface > &  faces,
const DImg image 
)
slot

Friends And Related Function Documentation

◆ Private

friend class Private
friend

The documentation for this class was generated from the following files: