digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::AIToolsPipeline Class Reference

A class to handle AI tools processing pipeline.

+ Inheritance diagram for Digikam::AIToolsPipeline:

Signals

void signalProcessingFinished (const QString &filePath, bool success)
 Signal emitted when processing has finished.
 
void signalProcessingStarted (const QString &filePath)
 Signal emitted when processing has started.
 
void signalTransform (const QList< ItemInfo > &infos, MetaEngineRotation::TransformationAction action)
 Signal emitted to transform an image.
 
- Signals inherited from Digikam::MLPipelineFoundation
void finished ()
 Emitted when the last package has finished processing.
 
void processed (const MLPipelinePackageNotify::Ptr &package)
 Emitted when one package has finished processing.
 
void processing (const MLPipelinePackageNotify::Ptr &package)
 Emitted when one package begins processing.
 
void progressValueChanged (float progress)
 
void scheduled ()
 Emitted when processing is scheduled.
 
void signalAddMoreWorkers ()
 
void signalUpdateItemCount (const qlonglong itemCount)
 
void skipped (const MLPipelinePackageNotify::Ptr &package)
 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

 AIToolsPipeline (QObject *const parent=nullptr)
 Constructor.
 
 ~AIToolsPipeline () override
 Destructor.
 
bool autoRotate (const ItemInfo &info, ProgressItem *const progress=nullptr)
 Auto-rotate an image using AI-based rotation detection.
 
bool start () override
 Start the pipeline processing.
 
- Public Member Functions inherited from Digikam::MLPipelineFoundation
virtual void cancel ()
 
bool hasFinished () const
 

Static Public Member Functions

static AIToolsPipelineinstance ()
 Returns the global AIToolsPipeline instance.
 

Protected Member Functions

void addMoreWorkers () override
 Implementation of the addMoreWorkers method.
 
bool classifier () override
 Implementation of the classifier stage.
 
bool extractor () override
 Implementation of the extractor stage.
 
bool finder () override
 Implementation of the finder stage.
 
ProgressItemgetProgressItem ()
 Check if there's an existing progress item for AIToolPipeline or create a new one.
 
bool loader () override
 Implementation of the loader stage.
 
bool process (const DImg &image, AIToolsPipelinePackage::AITool tool, ProgressItem *const progress=nullptr)
 Process a pre-loaded image with the AI tools pipeline.
 
bool process (const ItemInfo &info, AIToolsPipelinePackage::AITool tool, ProgressItem *const progress=nullptr)
 Process an item with the AI tools pipeline.
 
bool trainer () override
 Implementation of the trainer stage.
 
bool writer () override
 Implementation of the writer stage.
 
- Protected Member Functions inherited from Digikam::MLPipelineFoundation
bool addWorker (const MLPipelineStage &stage)
 
bool checkMoreWorkers (int totalItemCount, int currentItemCount, bool useFullCpu)
 
void clearAllQueues ()
 
virtual MLPipelinePackageFoundationdequeue (MLPipelineQueue *thisQueue)
 
void emitSignalUpdateItemCount (const qlonglong itemCount)
 Helper methods to perform signal emitting through the MLPIPELINE_FINDER_END mocro with the moc processor.
 
virtual bool enqueue (MLPipelineQueue *thisQueue, MLPipelinePackageFoundation *package)
 
virtual void notify (MLPipelineNotification notification, const QString &_name, const QString &_path, const QString &_displayData, int _processed, const DImg &_thumbnail)
 
virtual void notify (MLPipelineNotification notification, const QString &_name, const QString &_path, const QString &_displayData, int _processed, const QIcon &_thumbnail)
 
virtual void notify (MLPipelineNotification notification, const QString &_name, const QString &_path, const QString &_displayData, int _processed, const QImage &_thumbnail)
 
void pipelinePerformanceEnd (const MLPipelineStage &stage, int totalItemCount, QElapsedTimer &timer)
 
void pipelinePerformanceEnd (const MLPipelineStage &stage, QElapsedTimer &timer)
 
void pipelinePerformanceStart (const MLPipelineStage &stage, QElapsedTimer &timer)
 Methods to profile the Pipeline performance.
 
MLPipelinePackageFoundationqueueEndSignal () const
 Queue helper functions.
 
void showPipelinePerformance () const
 
void stageEnd (MLPipelineStage thisStage, MLPipelineStage nextStage)
 
void stageStart (QThread::Priority threadPriority, MLPipelineStage thisStage, MLPipelineStage nextStage, MLPipelineQueue *&thisQueue, MLPipelineQueue *&nextQueue)
 
void waitForStart ()
 

Friends

class AIToolsPipelineCreator
 

Additional Inherited Members

- Public Types inherited from Digikam::MLPipelineFoundation
enum  MLPipelineNotification { notifySkipped , notifyProcessed }
 
typedef struct Digikam::MLPipelineFoundation::_MLPipelinePerformanceProfile MLPipelinePerformanceProfile
 
typedef SharedQueue< MLPipelinePackageFoundation * > MLPipelineQueue
 
enum  MLPipelineStage {
  Finder , Loader , Extractor , Classifier ,
  Trainer , Writer , None
}
 
- Protected Attributes inherited from Digikam::MLPipelineFoundation
bool cancelled = false
 
QAtomicInteger< int > itemsProcessed = 0
 
quint64 maxBufferSize = 2147483648
 2 GB default
 
QIcon missingIcon = QIcon::fromTheme(QLatin1String("image-missing"))
 
QMutex mutex
 
QMap< MLPipelineStage, MLPipelinePerformanceProfileperformanceProfileList
 
QElapsedTimer pipelineTimer
 
QMap< MLPipelineStage, MLPipelineQueue * > queues
 
QThreadPool * threadPool = nullptr
 
QMutex threadStageMutex
 
const int throttledQueueDepth = 1
 
QAtomicInteger< int > totalItemCount = 0
 
quint64 usedBufferSize = 0
 
QList< QFutureWatcher< bool > * > watchList
 

Constructor & Destructor Documentation

◆ AIToolsPipeline()

Digikam::AIToolsPipeline::AIToolsPipeline ( QObject *const  parent = nullptr)
explicit
Parameters
parentParent object

Member Function Documentation

◆ addMoreWorkers()

void Digikam::AIToolsPipeline::addMoreWorkers ( )
overrideprotectedvirtual

◆ autoRotate()

bool Digikam::AIToolsPipeline::autoRotate ( const ItemInfo info,
ProgressItem *const  progress = nullptr 
)
Parameters
infoThe item information for the image to process
progressOptional progress item for tracking progress
Returns
True if the item was successfully submitted for processing

◆ classifier()

bool Digikam::AIToolsPipeline::classifier ( )
overrideprotectedvirtual
Returns
True if the stage completed successfully

Implements Digikam::MLPipelineFoundation.

◆ extractor()

bool Digikam::AIToolsPipeline::extractor ( )
inlineoverrideprotectedvirtual
Returns
True if the stage completed successfully

Implements Digikam::MLPipelineFoundation.

◆ finder()

bool Digikam::AIToolsPipeline::finder ( )
inlineoverrideprotectedvirtual
Returns
True if the stage completed successfully

Implements Digikam::MLPipelineFoundation.

◆ getProgressItem()

ProgressItem * Digikam::AIToolsPipeline::getProgressItem ( )
protected
Returns
The existing or newly created ProgressItem

◆ instance()

AIToolsPipeline * Digikam::AIToolsPipeline::instance ( )
static
Returns
Static instance of AIToolsPipeline

◆ loader()

bool Digikam::AIToolsPipeline::loader ( )
overrideprotectedvirtual
Returns
True if the stage completed successfully

Implements Digikam::MLPipelineFoundation.

◆ process() [1/2]

bool Digikam::AIToolsPipeline::process ( const DImg image,
AIToolsPipelinePackage::AITool  tool,
ProgressItem *const  progress = nullptr 
)
protected
Parameters
imageThe pre-loaded image to process
toolThe AI tool to use for processing
progressOptional progress item for tracking progress
Returns
True if the image was successfully submitted for processing

◆ process() [2/2]

bool Digikam::AIToolsPipeline::process ( const ItemInfo info,
AIToolsPipelinePackage::AITool  tool,
ProgressItem *const  progress = nullptr 
)
protected
Parameters
infoThe item information to process
toolThe AI tool to use for processing
progressOptional progress item for tracking progress
Returns
True if the item was successfully submitted for processing

◆ signalProcessingFinished

void Digikam::AIToolsPipeline::signalProcessingFinished ( const QString &  filePath,
bool  success 
)
signal
Parameters
filePathPath of the image that was processed
successWhether the processing was successful

◆ signalProcessingStarted

void Digikam::AIToolsPipeline::signalProcessingStarted ( const QString &  filePath)
signal
Parameters
filePathPath of the image being processed

◆ signalTransform

void Digikam::AIToolsPipeline::signalTransform ( const QList< ItemInfo > &  infos,
MetaEngineRotation::TransformationAction  action 
)
signal
Parameters
infosList of ItemInfos to transform
actionTransformation action to apply

◆ start()

bool Digikam::AIToolsPipeline::start ( )
overridevirtual
Returns
True if the pipeline was started successfully

Reimplemented from Digikam::MLPipelineFoundation.

◆ trainer()

bool Digikam::AIToolsPipeline::trainer ( )
inlineoverrideprotectedvirtual
Returns
True if the stage completed successfully

Implements Digikam::MLPipelineFoundation.

◆ writer()

bool Digikam::AIToolsPipeline::writer ( )
overrideprotectedvirtual
Returns
True if the stage completed successfully

Implements Digikam::MLPipelineFoundation.