Skip to content

Commit

Permalink
Bugfix found during regression
Browse files Browse the repository at this point in the history
  • Loading branch information
saddam213 committed May 22, 2024
1 parent 8993731 commit e17e737
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions OnnxStack.Core/Config/OnnxModelPrecision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public enum OnnxModelPrecision
{
F32 = 0,
F16 = 1
F16 = 0,
F32 = 1
}
}
6 changes: 5 additions & 1 deletion OnnxStack.Core/Video/VideoInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ private float GetFramesPerSecond()
if (FrameCount == 0 || DurationSeconds == 0)
return 0;

return FrameCount / DurationSeconds;
var framesPerSec = FrameCount / DurationSeconds;
if (framesPerSec < 1)
return MathF.Round(framesPerSec, 2);

return MathF.Round(framesPerSec, 0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ public async Task<OnnxVideo> RunAsync(OnnxVideo video, Action<OnnxImage, OnnxIma
var featureFrames = new List<OnnxImage>();
foreach (var videoFrame in video.Frames)
{
var result = await RunAsync(videoFrame, cancellationToken);
var result = await ExtractImageAsync(videoFrame, cancellationToken);
featureFrames.Add(result);
progressCallback?.Invoke(videoFrame, result);
}

_logger?.LogEnd("Extracting OnnxVideo features complete.", timestamp);
return new OnnxVideo(video.Info, featureFrames);
}
Expand Down

0 comments on commit e17e737

Please sign in to comment.