add altitude + camera spec component and calc tile size by this

also restrict detections to be no bigger than in classes.json
This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-09-23 01:48:10 +03:00
parent b0e4b467c1
commit fde9a9f418
36 changed files with 715 additions and 222 deletions
@@ -7,7 +7,7 @@ namespace Azaion.Common.Services.Inference;
public interface IInferenceService
{
Task RunInference(List<string> mediaPaths, int tileSize, CancellationToken ct = default);
Task RunInference(List<string> mediaPaths, CameraConfig cameraConfig, CancellationToken ct = default);
CancellationTokenSource InferenceCancelTokenSource { get; set; }
CancellationTokenSource CheckAIAvailabilityTokenSource { get; set; }
void StopInference();
@@ -44,14 +44,16 @@ public class InferenceService : IInferenceService
}
}
public async Task RunInference(List<string> mediaPaths, int tileSize, CancellationToken ct = default)
public async Task RunInference(List<string> mediaPaths, CameraConfig cameraConfig, CancellationToken ct = default)
{
InferenceCancelTokenSource = new CancellationTokenSource();
_client.Send(RemoteCommand.Create(CommandType.Login, _azaionApi.Credentials));
var aiConfig = _aiConfigOptions.Value;
aiConfig.Paths = mediaPaths;
aiConfig.TileSize = tileSize;
aiConfig.Altitude = (double)cameraConfig.Altitude;
aiConfig.CameraFocalLength = (double)cameraConfig.CameraFocalLength;
aiConfig.CameraSensorWidth = (double)cameraConfig.CameraSensorWidth;
_client.Send(RemoteCommand.Create(CommandType.Inference, aiConfig));
using var combinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(ct, InferenceCancelTokenSource.Token);