Skip to content

Commit

Permalink
Size fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Mar 8, 2024
1 parent 9fa7900 commit 4fe62a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Damselfly.Core/Services/ImageRecognitionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ public async Task<ICollection<IProcessJob>> GetPendingJobs(int maxJobs)
// Only pull out images where the metadata has already been scanned,
// and the AI hasn't been processed.
var images = await db.ImageMetaData.Where(x => x.LastUpdated >= x.Image.LastUpdated
&& x.AILastUpdated == null
&& x.Width > 0 && x.Height > 0)
&& x.AILastUpdated == null )
.OrderByDescending(x => x.LastUpdated)
.Take(maxJobs)
.Select(x => x.ImageId)
Expand Down Expand Up @@ -380,6 +379,12 @@ private async Task DetectObjects(ImageMetaData metadata)
if ( !fileName.Exists )
return;

if( metadata.Width == 0 || metadata.Height == 0 )
{
_logger.LogWarning($"Skipping AI detection for image {image.FullPath} - dimensions metadata was zero!!");
return;
}

try
{
var thumbSize = ThumbSize.Large;
Expand Down
3 changes: 0 additions & 3 deletions Damselfly.ML.FaceONNX/FaceONNXService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ public Task<List<ImageDetectResult>> DetectFaces(Image<Rgb24> image)
List<ImageDetectResult> detected = new();
var watch = new Stopwatch("FaceOnnxDetection");

if( image.Width == 0 || image.Height == 0 )
return Task.FromResult(detected);

try
{
var detectedFaces = GetFacesFromImage(image).ToList();
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/wwwroot/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const CACHE_VERSION='4.1.0-20240308222015'
const CACHE_VERSION='4.1.0-20240308225414'

0 comments on commit 4fe62a4

Please sign in to comment.