public async Task <State.Snapshot> ProcessAsync(State.Snapshot snapshot, CancellationToken cancellationToken) { var lastChangeToTrainingData = await _dataProvider.GetDateOfLastChangeAsync(cancellationToken); var faceData = _dataProvider.GetBalancedItems(cancellationToken); var model = await _recognitionEngine.TrainAsync(faceData, cancellationToken); await _modelPersistor.SaveModelAsync(model, cancellationToken); return(new State.Snapshot { LastTrainingDataUpdate = lastChangeToTrainingData }); }
public async Task <bool> RequiresProcessingAsync(State.Snapshot snapshot, CancellationToken cancellationToken) { var lastChangeToTrainingData = await _dataProvider.GetDateOfLastChangeAsync(cancellationToken); return((lastChangeToTrainingData ?? DateTimeOffset.MinValue) > (snapshot.LastTrainingDataUpdate ?? DateTimeOffset.MinValue)); }