digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::FacePipeline Class Reference
+ Inheritance diagram for Digikam::FacePipeline:

Public Types

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

Public Slots

FaceTagsIface addManually (const ItemInfo &info, const DImg &image, const TagRegion &assignedRegion)
 Add an entry manually.
 
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())
 Confirm the face.
 
FaceTagsIface editRegion (const ItemInfo &info, const DImg &image, const FaceTagsIface &databaseFace, const TagRegion &newRegion)
 Change the given face's region to newRegion.
 
FaceTagsIface editTag (const ItemInfo &info, const FaceTagsIface &databaseFace, int newTagId)
 Changes the given face's tagId to newTagId.
 
bool process (const ItemInfo &info)
 Processes the given image info.
 
bool process (const ItemInfo &info, const DImg &image)
 
void process (const QList< ItemInfo > &infos)
 Batch processing.
 
void remove (const ItemInfo &info, const FaceTagsIface &face)
 Remove the given face.
 
void setAccuracyAndModel (int detectAccuracy, FaceScanSettings::FaceDetectionModel detectModel, FaceScanSettings::FaceDetectionSize detectSize, int recognizeAccuracy, FaceScanSettings::FaceRecognitionModel recognizeModel)
 
void train (const ItemInfo &info, const QList< FaceTagsIface > &faces)
 Train the given faces.
 
void train (const ItemInfo &info, const QList< FaceTagsIface > &faces, const DImg &image)
 

Signals

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

Public Member Functions

QString benchmarkResult () const
 
void cancel ()
 Cancels all processing.
 
void construct ()
 
bool hasFinished () const
 
void plugDatabaseEditor ()
 
void plugDatabaseFilter (FilterMode mode)
 You can plug these four different steps in the working pipeline.
 
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)
 Set the priority of the threads used by this pipeline.
 
void shutDown ()
 Cancels and waits for the pipeline to finish.
 

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.

OverwriteAllFaces 

Add new results. Previous all results will be cleared.

OverwriteUnconfirmed 

Add new results. Previous unconfirmed results will be cleared.

Member Function Documentation

◆ confirm

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

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.

◆ editRegion

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

Does not care for training atm.

◆ editTag

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

Used to Reject Facial Recognition suggestions, since the tag needs to be converted from Unconfirmed to Unknown.

◆ plugDatabaseFilter()

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

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

◆ process [1/2]

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

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.

◆ process [2/2]

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

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.

◆ setPriority()

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

The default setting is QThread::LowPriority.