digiKam
Digikam::FacialRecognitionWrapper Class Reference

Classes

class  Private
 

Public Member Functions

Identity addIdentity (const QMultiMap< QString, QString > &attributes)
 
void addIdentityAttribute (int id, const QString &attribute, const QString &value)
 
void addIdentityAttributes (int id, const QMultiMap< QString, QString > &attributes)
 
Identity addIdentityDebug (const QMultiMap< QString, QString > &attributes)
 
QList< IdentityallIdentities () const
 NOTE: For the documentation of standard attributes, see identity.h. More...
 
void clearAllTraining (const QString &trainingContext=QString())
 
void clearTraining (const QList< Identity > &identitiesToClean, const QString &trainingContext=QString())
 
void deleteIdentities (QList< Identity > identitiesToBeDeleted)
 
void deleteIdentity (const Identity &identityToBeDeleted)
 
 FacialRecognitionWrapper ()
 
 FacialRecognitionWrapper (const FacialRecognitionWrapper &)
 
Identity findIdentity (const QMultiMap< QString, QString > &attributes) const
 
Identity findIdentity (const QString &attribute, const QString &value) const
 
Identity identity (int id) const
 
bool integrityCheck ()
 
QVariantMap parameters () const
 
Identity recognizeFace (QImage *const image)
 
QList< IdentityrecognizeFaces (const QList< QImage * > &images)
 
QList< IdentityrecognizeFaces (ImageListProvider *const images)
 
void setIdentityAttributes (int id, const QMultiMap< QString, QString > &attributes)
 
void setParameter (const QString &parameter, const QVariant &value)
 
void setParameters (const QVariantMap &parameters)
 
void train (const Identity &identityToBeTrained, const QList< QImage * > &images, const QString &trainingContext)
 
void train (const Identity &identityToBeTrained, QImage *image, const QString &trainingContext)
 
void train (const Identity &identityToBeTrained, TrainingDataProvider *const data, const QString &trainingContext)
 
void train (const QList< Identity > &identitiesToBeTrained, TrainingDataProvider *const data, const QString &trainingContext)
 
void vacuum ()
 
 ~FacialRecognitionWrapper ()
 

Constructor & Destructor Documentation

◆ FacialRecognitionWrapper() [1/2]

Digikam::FacialRecognitionWrapper::FacialRecognitionWrapper ( )
explicit

◆ FacialRecognitionWrapper() [2/2]

Digikam::FacialRecognitionWrapper::FacialRecognitionWrapper ( const FacialRecognitionWrapper other)

◆ ~FacialRecognitionWrapper()

Digikam::FacialRecognitionWrapper::~FacialRecognitionWrapper ( )

Member Function Documentation

◆ addIdentity()

◆ addIdentityAttribute()

void Digikam::FacialRecognitionWrapper::addIdentityAttribute ( int  id,
const QString &  attribute,
const QString &  value 
)

◆ addIdentityAttributes()

void Digikam::FacialRecognitionWrapper::addIdentityAttributes ( int  id,
const QMultiMap< QString, QString > &  attributes 
)

◆ addIdentityDebug()

Identity Digikam::FacialRecognitionWrapper::addIdentityDebug ( const QMultiMap< QString, QString > &  attributes)

This is the debug version of addIdentity, so the identity is only added to identityCache, but not into the recognition database.

References Digikam::Identity::id(), identity(), Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::Identity::setAttribute(), Digikam::Identity::setAttributesMap(), and Digikam::Identity::setId().

◆ allIdentities()

QList< Identity > Digikam::FacialRecognitionWrapper::allIdentities ( ) const

NOTE: For the documentation of standard attributes, see identity.h.

Returns all identities known to the database

References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, and Digikam::FacialRecognitionWrapper::Private::mutex.

Referenced by Digikam::DatabaseTask::run().

◆ clearAllTraining()

void Digikam::FacialRecognitionWrapper::clearAllTraining ( const QString &  trainingContext = QString())

◆ clearTraining()

void Digikam::FacialRecognitionWrapper::clearTraining ( const QList< Identity > &  identitiesToClean,
const QString &  trainingContext = QString() 
)

Deletes the training data for the given identity, leaving the identity as such in the database.

References Digikam::FacialRecognitionWrapper::Private::clear(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, and Digikam::FacialRecognitionWrapper::Private::mutex.

◆ deleteIdentities()

void Digikam::FacialRecognitionWrapper::deleteIdentities ( QList< Identity identitiesToBeDeleted)

Deletes a list of identities from the database.

References deleteIdentity(), and identity().

◆ deleteIdentity()

◆ findIdentity() [1/2]

Identity Digikam::FacialRecognitionWrapper::findIdentity ( const QMultiMap< QString, QString > &  attributes) const

Finds the identity matching the given attributes. Attributes are first checked with knowledge of their meaning. Secondly, all unknown attributes are used. Returns a null Identity if no match is possible or the map is empty.

References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::findByAttribute(), Digikam::FacialRecognitionWrapper::Private::findByAttributes(), Digikam::Identity::isNull(), and Digikam::FacialRecognitionWrapper::Private::mutex.

◆ findIdentity() [2/2]

Identity Digikam::FacialRecognitionWrapper::findIdentity ( const QString &  attribute,
const QString &  value 
) const

Finds the first identity with matching attribute - value. Returns a null identity if no match is found or attribute is empty.

References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::findByAttribute(), Digikam::FacialRecognitionWrapper::Private::mutex, and value.

Referenced by addIdentity().

◆ identity()

◆ integrityCheck()

bool Digikam::FacialRecognitionWrapper::integrityCheck ( )

◆ parameters()

◆ recognizeFace()

Identity Digikam::FacialRecognitionWrapper::recognizeFace ( QImage *const  image)

References recognizeFaces().

◆ recognizeFaces() [1/2]

QList< Identity > Digikam::FacialRecognitionWrapper::recognizeFaces ( const QList< QImage * > &  images)

◆ recognizeFaces() [2/2]

QList< Identity > Digikam::FacialRecognitionWrapper::recognizeFaces ( ImageListProvider *const  images)

Returns the recommended size if you want to scale face images for recognition. Larger images can be passed, but may be downscaled. Performs recognition. The face details to be recognized are passed by the provider. For each entry in the provider, in 1-to-1 mapping, a recognized identity or the null identity is returned.

References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::ImageListProvider::images(), Digikam::FacialRecognitionWrapper::Private::mutex, Digikam::OpenCVDNNFaceRecognizer::recognize(), and Digikam::FacialRecognitionWrapper::Private::recognizer.

Referenced by Digikam::RecognitionWorker::process(), recognizeFace(), and recognizeFaces().

◆ setIdentityAttributes()

void Digikam::FacialRecognitionWrapper::setIdentityAttributes ( int  id,
const QMultiMap< QString, QString > &  attributes 
)

◆ setParameter()

void Digikam::FacialRecognitionWrapper::setParameter ( const QString &  parameter,
const QVariant &  value 
)

Tunes backend parameters. Available parameters: "accuracy", synonymous: "threshold", range: 0-1, type: float Determines recognition threshold, 0->accept very insecure recognitions, 1-> be very sure about a recognition.

"k-nearest" : limit the number of nearest neighbors for KNN

References Digikam::FacialRecognitionWrapper::Private::applyParameters(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::mutex, Digikam::FacialRecognitionWrapper::Private::parameters, and value.

Referenced by Digikam::RecognitionWorker::setThreshold().

◆ setParameters()

◆ train() [1/4]

void Digikam::FacialRecognitionWrapper::train ( const Identity identityToBeTrained,
const QList< QImage * > &  images,
const QString &  trainingContext 
)

References train().

◆ train() [2/4]

void Digikam::FacialRecognitionWrapper::train ( const Identity identityToBeTrained,
QImage *  image,
const QString &  trainingContext 
)

Performs training by using image data directly.

These are convenience functions for simple setups. If you want good performance and/or a more versatile implementation, be sure to implement your own TrainingDataProvider and use one of the above functions.

References train().

◆ train() [3/4]

void Digikam::FacialRecognitionWrapper::train ( const Identity identityToBeTrained,
TrainingDataProvider *const  data,
const QString &  trainingContext 
)

References train().

◆ train() [4/4]

void Digikam::FacialRecognitionWrapper::train ( const QList< Identity > &  identitiesToBeTrained,
TrainingDataProvider *const  data,
const QString &  trainingContext 
)

Performs training. The identities which have new images to be trained are given. An empty list means that all identities are checked.

All needed data will be queried from the provider.

An identifier for the current training context is given, which can identify the application or group of collections. (It is assumed that training from different contexts is based on non-overlapping collections of images. Keep it always constant for your app.)

References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::mutex, and Digikam::FacialRecognitionWrapper::Private::trainIdentityBatch().

Referenced by train().

◆ vacuum()


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