diff --git a/Damselfly.Core/Services/ImageRecognitionService.cs b/Damselfly.Core/Services/ImageRecognitionService.cs index b5b33927..543bea07 100644 --- a/Damselfly.Core/Services/ImageRecognitionService.cs +++ b/Damselfly.Core/Services/ImageRecognitionService.cs @@ -409,24 +409,24 @@ private async Task DetectObjects(ImageMetaData metadata) try { - var thumbSize = ThumbSize.Large; - var medThumb = new FileInfo(_thumbService.GetThumbPath(fileName, thumbSize)); + var thumbSize = ThumbSize.ExtraLarge; + var imgThumb = new FileInfo(_thumbService.GetThumbPath(fileName, thumbSize)); // We need a large thumbnail to do AI processing. Ensure it's been created. - if( ! medThumb.Exists ) + if( ! imgThumb.Exists ) { await _thumbService.CreateThumb(image.ImageId, thumbSize); - if( ! File.Exists( medThumb.FullName ) ) + if( ! File.Exists( imgThumb.FullName ) ) { // If we couldn't create the thumb, bail out. throw new InvalidOperationException( - $"Unable to run AI processing - {thumbSize} thumbnail doesn't exist: {medThumb}"); + $"Unable to run AI processing - {thumbSize} thumbnail doesn't exist: {imgThumb}"); } } var enableAIProcessing = _configService.GetBool(ConfigSettings.EnableAIProcessing, true); - MetaDataService.GetImageSize(medThumb.FullName, out var thumbWidth, out var thumbHeight); + MetaDataService.GetImageSize(imgThumb.FullName, out var thumbWidth, out var thumbHeight); var foundObjects = new List(); var foundFaces = new List(); @@ -434,11 +434,11 @@ private async Task DetectObjects(ImageMetaData metadata) if ( enableAIProcessing ) Logging.Log($"Processing AI image detection for {fileName.Name}..."); - if ( !File.Exists(medThumb.FullName) ) + if ( !File.Exists(imgThumb.FullName) ) // The thumb isn't ready yet. return; - using var theImage = SixLabors.ImageSharp.Image.Load(medThumb.FullName); + using var theImage = SixLabors.ImageSharp.Image.Load(imgThumb.FullName); if ( _imageClassifier != null && enableAIProcessing ) { diff --git a/Damselfly.ML.ObjectDetection.ML/ObjectDetector.cs b/Damselfly.ML.ObjectDetection.ML/ObjectDetector.cs index edaf116e..831fd70a 100644 --- a/Damselfly.ML.ObjectDetection.ML/ObjectDetector.cs +++ b/Damselfly.ML.ObjectDetection.ML/ObjectDetector.cs @@ -44,19 +44,21 @@ public Task> DetectObjects(Image image) { if( scorer != null ) { - var watch = new Stopwatch( "DetectObjects" ); - var predictions = scorer.Predict( image ); - - watch.Stop(); + // There's a min of 640x640 for the model. + if( image.Width > 640 && image.Height > 640 ) + { + var predictions = scorer.Predict( image ); - var objectsFound = predictions.Where( x => x.Score > predictionThreshold ) - .Select( x => MakeResult( x ) ) - .ToList(); + watch.Stop(); - result = objectsFound; + var objectsFound = predictions.Where( x => x.Score > predictionThreshold ) + .Select( x => MakeResult( x ) ) + .ToList(); + result = objectsFound; + } } } catch ( Exception ex ) diff --git a/VERSION b/VERSION index 627a3f43..4d0dcda0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.1 +4.1.2