Esempio n. 1
0
        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
            });
        }
Esempio n. 2
0
        public async Task <bool> RequiresProcessingAsync(State.Snapshot snapshot, CancellationToken cancellationToken)
        {
            var lastChangeToTrainingData = await _dataProvider.GetDateOfLastChangeAsync(cancellationToken);

            return((lastChangeToTrainingData ?? DateTimeOffset.MinValue) > (snapshot.LastTrainingDataUpdate ?? DateTimeOffset.MinValue));
        }