clean postbuild script

clean warnings
This commit is contained in:
Alex Bezdieniezhnykh
2025-04-28 10:20:06 +03:00
parent 47aa8b862b
commit babcbc0fc7
12 changed files with 56 additions and 51 deletions
+3 -2
View File
@@ -253,10 +253,10 @@ public partial class Annotator
ShowAnnotations(res.Annotation, showImage: true); ShowAnnotations(res.Annotation, showImage: true);
} }
private async Task SaveUserSettings() private Task SaveUserSettings()
{ {
if (_suspendLayout) if (_suspendLayout)
return; return Task.CompletedTask;
_appConfig.UIConfig.LeftPanelWidth = MainGrid.ColumnDefinitions.FirstOrDefault()!.Width.Value; _appConfig.UIConfig.LeftPanelWidth = MainGrid.ColumnDefinitions.FirstOrDefault()!.Width.Value;
_appConfig.UIConfig.RightPanelWidth = MainGrid.ColumnDefinitions.LastOrDefault()!.Width.Value; _appConfig.UIConfig.RightPanelWidth = MainGrid.ColumnDefinitions.LastOrDefault()!.Width.Value;
@@ -266,6 +266,7 @@ public partial class Annotator
_configUpdater.Save(_appConfig); _configUpdater.Save(_appConfig);
return Task.CompletedTask; return Task.CompletedTask;
}, SaveConfigTaskId, TimeSpan.FromSeconds(5)); }, SaveConfigTaskId, TimeSpan.FromSeconds(5));
return Task.CompletedTask;
} }
private void ShowTimeAnnotations(TimeSpan time) private void ShowTimeAnnotations(TimeSpan time)
+5 -4
View File
@@ -178,12 +178,13 @@ namespace Azaion.Annotator.Controls
void ForceUpdateText() void ForceUpdateText()
{ {
_fText = new FormattedText(_text, _fText = new FormattedText(_text,
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
FlowDirection.LeftToRight, FlowDirection.LeftToRight,
Font, Font,
FontSize, FontSize,
Foreground); Foreground, 1.0);
IsChanged = true; IsChanged = true;
} }
@@ -207,7 +208,7 @@ namespace Azaion.Annotator.Controls
Visual _child = null!; Visual _child = null!;
public virtual Visual Child public virtual Visual? Child
{ {
get => _child; get => _child;
set set
@@ -228,7 +229,7 @@ namespace Azaion.Annotator.Controls
} }
// cache the new child // cache the new child
_child = value; _child = value!;
InvalidateVisual(); InvalidateVisual();
} }
@@ -295,7 +296,7 @@ namespace Azaion.Annotator.Controls
} }
} }
protected override Visual GetVisualChild(int index) protected override Visual? GetVisualChild(int index)
{ {
return Child; return Child;
} }
+7 -3
View File
@@ -46,8 +46,11 @@ public partial class MapMatcher : UserControl
private async Task OpenGpsLocation(int gpsFilesIndex) private async Task OpenGpsLocation(int gpsFilesIndex)
{ {
var media = GpsFiles.Items[gpsFilesIndex] as MediaFileInfo; //var media = GpsFiles.Items[gpsFilesIndex] as MediaFileInfo;
var ann = _annotations.GetValueOrDefault(gpsFilesIndex); var ann = _annotations.GetValueOrDefault(gpsFilesIndex);
if (ann == null)
return;
GpsImageEditor.Background = new ImageBrush GpsImageEditor.Background = new ImageBrush
{ {
ImageSource = await Path.Combine(_currentDir, ann.Name).OpenImage() ImageSource = await Path.Combine(_currentDir, ann.Name).OpenImage()
@@ -110,9 +113,9 @@ public partial class MapMatcher : UserControl
await _gpsMatcherService.RunGpsMatching(dir.FullName, initialLat, initialLon, async res => await SetMarker(res)); await _gpsMatcherService.RunGpsMatching(dir.FullName, initialLat, initialLon, async res => await SetMarker(res));
} }
private async Task SetMarker(GpsMatchResult result) private Task SetMarker(GpsMatchResult result)
{ {
await Dispatcher.Invoke(async () => Dispatcher.Invoke(() =>
{ {
var marker = new GMapMarker(new PointLatLng(result.Latitude, result.Longitude)); var marker = new GMapMarker(new PointLatLng(result.Latitude, result.Longitude));
var ann = _annotations[result.Index]; var ann = _annotations[result.Index];
@@ -126,6 +129,7 @@ public partial class MapMatcher : UserControl
SatelliteMap.Position = new PointLatLng(result.Latitude, result.Longitude); SatelliteMap.Position = new PointLatLng(result.Latitude, result.Longitude);
SatelliteMap.ZoomAndCenterMarkers(null); SatelliteMap.ZoomAndCenterMarkers(null);
}); });
return Task.CompletedTask;
} }
private async Task SetFromCsv(List<MediaFileInfo> mediaFiles) private async Task SetFromCsv(List<MediaFileInfo> mediaFiles)
+3 -3
View File
@@ -27,9 +27,9 @@ public class Constants
public static readonly AnnotationConfig DefaultAnnotationConfig = new() public static readonly AnnotationConfig DefaultAnnotationConfig = new()
{ {
DetectionClasses = DefaultAnnotationClasses, DetectionClasses = DefaultAnnotationClasses!,
VideoFormats = DefaultVideoFormats, VideoFormats = DefaultVideoFormats!,
ImageFormats = DefaultImageFormats, ImageFormats = DefaultImageFormats!,
AnnotationsDbFile = DEFAULT_ANNOTATIONS_DB_FILE AnnotationsDbFile = DEFAULT_ANNOTATIONS_DB_FILE
}; };
@@ -51,7 +51,7 @@ public class SatelliteDownloader(
Directory.CreateDirectory(_satDirectory); Directory.CreateDirectory(_satDirectory);
var downloadTilesResult = await DownloadTiles(centerLat, centerLon, radiusM, zoomLevel, token); var downloadTilesResult = await DownloadTiles(centerLat, centerLon, radiusM, zoomLevel, token);
var image = await ComposeTiles(downloadTilesResult.Tiles, token); var image = ComposeTiles(downloadTilesResult.Tiles, token);
if (image != null) if (image != null)
await SplitToTiles(image, downloadTilesResult, token); await SplitToTiles(image, downloadTilesResult, token);
} }
@@ -104,7 +104,7 @@ public class SatelliteDownloader(
await Task.Run(() => Parallel.ForEach(cropTasks, action => action()), token); await Task.Run(() => Parallel.ForEach(cropTasks, action => action()), token);
} }
private async Task<Image<Rgba32>?> ComposeTiles(ConcurrentDictionary<(int x, int y), byte[]> downloadedTiles, CancellationToken token = default) private Image<Rgba32>? ComposeTiles(ConcurrentDictionary<(int x, int y), byte[]> downloadedTiles, CancellationToken token = default)
{ {
if (downloadedTiles.IsEmpty) if (downloadedTiles.IsEmpty)
return null; return null;
@@ -148,8 +148,6 @@ public class SatelliteDownloader(
} }
}); });
// await largeImage.SaveAsync(Path.Combine(_satDirectory, "full_map.tif"),
// new TiffEncoder { Compression = TiffCompression.Deflate }, token);
return largeImage; return largeImage;
} }
@@ -109,9 +109,9 @@ public class DatasetExplorerEventHandler(
} }
} }
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken) public Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken)
{ {
datasetExplorer.Dispatcher.Invoke(async () => datasetExplorer.Dispatcher.Invoke(() =>
{ {
var annotation = notification.Annotation; var annotation = notification.Annotation;
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber; var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
@@ -133,6 +133,7 @@ public class DatasetExplorerEventHandler(
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb); datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
} }
}); });
return Task.CompletedTask;
} }
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken) public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken)
+2 -2
View File
@@ -79,9 +79,9 @@ cdef class ApiClient:
try: try:
r = requests.post(url, headers=headers, files=files, allow_redirects=True) r = requests.post(url, headers=headers, files=files, allow_redirects=True)
r.raise_for_status() r.raise_for_status()
print(f"Uploaded {filename} to {constants.API_URL}/{folder} successfully: {r.status_code}.") constants.log(f"Uploaded {filename} to {constants.API_URL}/{folder} successfully: {r.status_code}.")
except Exception as e: except Exception as e:
print(f"Upload fail: {e}") constants.log(f"Upload fail: {e}")
cdef load_bytes(self, str filename, str folder): cdef load_bytes(self, str filename, str folder):
hardware_service = HardwareService() hardware_service = HardwareService()
+3 -4
View File
@@ -7,7 +7,7 @@ import tensorrt as trt
import pycuda.driver as cuda import pycuda.driver as cuda
import pycuda.autoinit # required for automatically initialize CUDA, do not remove. import pycuda.autoinit # required for automatically initialize CUDA, do not remove.
import pynvml import pynvml
cimport constants
cdef class InferenceEngine: cdef class InferenceEngine:
def __init__(self, model_bytes: bytes, batch_size: int = 1, **kwargs): def __init__(self, model_bytes: bytes, batch_size: int = 1, **kwargs):
@@ -51,7 +51,6 @@ cdef class OnnxEngine(InferenceEngine):
cdef class TensorRTEngine(InferenceEngine): cdef class TensorRTEngine(InferenceEngine):
def __init__(self, model_bytes: bytes, batch_size: int = 4, **kwargs): def __init__(self, model_bytes: bytes, batch_size: int = 4, **kwargs):
super().__init__(model_bytes, batch_size) super().__init__(model_bytes, batch_size)
print('Enter init TensorRT')
try: try:
logger = trt.Logger(trt.Logger.WARNING) logger = trt.Logger(trt.Logger.WARNING)
@@ -142,7 +141,7 @@ cdef class TensorRTEngine(InferenceEngine):
return None return None
if builder.platform_has_fast_fp16: if builder.platform_has_fast_fp16:
print('Converting to supported fp16') constants.log('Converting to supported fp16')
config.set_flag(trt.BuilderFlag.FP16) config.set_flag(trt.BuilderFlag.FP16)
else: else:
print('Converting to supported fp32. (fp16 is not supported)') print('Converting to supported fp32. (fp16 is not supported)')
@@ -151,7 +150,7 @@ cdef class TensorRTEngine(InferenceEngine):
if plan is None: if plan is None:
print('Conversion failed.') print('Conversion failed.')
return None return None
print('conversion done!') constants.log('conversion done!')
return bytes(plan) return bytes(plan)
cdef tuple get_input_shape(self): cdef tuple get_input_shape(self):
+1 -1
View File
@@ -66,7 +66,7 @@ cdef class RemoteCommandHandler:
self._on_command(cmd) self._on_command(cmd)
except Exception as e: except Exception as e:
if not self._shutdown_event.is_set(): if not self._shutdown_event.is_set():
print(f"Worker error: {e}") constants.log(f"Worker error: {e}")
import traceback import traceback
traceback.print_exc() traceback.print_exc()
finally: finally:
+26
View File
@@ -0,0 +1,26 @@
rem Inference
set INFERENCE_PATH=%cd%\..\Azaion.Inference
xcopy /E /Y %INFERENCE_PATH%\dist\azaion-inference %SUITE_FOLDER%
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_10.dll %SUITE_FOLDER%
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_plugin_10.dll %SUITE_FOLDER%
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvonnxparser_10.dll %SUITE_FOLDER%
copy %INFERENCE_PATH%\config.yaml %SUITE_FOLDER%
rem Gps Denied
set DESTINATION=%SUITE_FOLDER%\gps-denied
set GPS_DENIED=%cd%\..\..\gps-denied\
rmdir %DESTINATION% /s /q
mkdir %DESTINATION%
copy %GPS_DENIED%\image-matcher\build\Desktop_Qt_6_9_0_MSVC2022_64bit-Release\release\image-matcher.exe %DESTINATION%
copy %GPS_DENIED%\.libs\libzmq\build\dist\bin\libzmq-v143-mt-4_3_6.dll %DESTINATION%
copy %GPS_DENIED%\.libs\onnxruntime\lib\onnxruntime.dll %DESTINATION%
copy %GPS_DENIED%\.libs\onnxruntime\lib\onnxruntime_providers_cuda.dll %DESTINATION%
copy %GPS_DENIED%\.libs\onnxruntime\lib\onnxruntime_providers_shared.dll %DESTINATION%
copy %GPS_DENIED%\.libs\opencv\build\x64\vc16\bin\opencv_world4110.dll %DESTINATION%
copy C:\Qt\6.9.0\msvc2022_64\bin\Qt6Core.dll %DESTINATION%
mkdir %DESTINATION%\models
copy ..\..\gps-denied-work\models\* %DESTINATION%\models
-26
View File
@@ -11,29 +11,3 @@ call upload-file %FILE2_TO_UPLOAD% %RESOURCES_FOLDER%
set SUITE_FOLDER=%cd%\bin\%CONFIG%\net8.0-windows\ set SUITE_FOLDER=%cd%\bin\%CONFIG%\net8.0-windows\
rem Inference
set INFERENCE_PATH=%cd%\..\Azaion.Inference
xcopy /E /Y %INFERENCE_PATH%\dist\azaion-inference %SUITE_FOLDER%
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_10.dll %SUITE_FOLDER%
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_plugin_10.dll %SUITE_FOLDER%
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvonnxparser_10.dll %SUITE_FOLDER%
copy %INFERENCE_PATH%\config.yaml %SUITE_FOLDER%
rem Gps Denied
set DESTINATION=%SUITE_FOLDER%\gps-denied
set GPS_DENIED=%cd%\..\..\gps-denied\
rmdir %DESTINATION% /s /q
mkdir %DESTINATION%
copy %GPS_DENIED%\image-matcher\build\Desktop_Qt_6_9_0_MSVC2022_64bit-Release\release\image-matcher.exe %DESTINATION%
copy %GPS_DENIED%\.libs\libzmq\build\dist\bin\libzmq-v143-mt-4_3_6.dll %DESTINATION%
copy %GPS_DENIED%\.libs\onnxruntime\lib\onnxruntime.dll %DESTINATION%
copy %GPS_DENIED%\.libs\onnxruntime\lib\onnxruntime_providers_cuda.dll %DESTINATION%
copy %GPS_DENIED%\.libs\onnxruntime\lib\onnxruntime_providers_shared.dll %DESTINATION%
copy %GPS_DENIED%\.libs\opencv\build\x64\vc16\bin\opencv_world4110.dll %DESTINATION%
copy C:\Qt\6.9.0\msvc2022_64\bin\Qt6Core.dll %DESTINATION%
mkdir %DESTINATION%\models
copy ..\..\gps-denied-work\models\* %DESTINATION%\models
+1
View File
@@ -12,6 +12,7 @@ UninstallDisplayName=Azaion Suite
UninstallDisplayIcon={app}\Azaion.Suite.exe UninstallDisplayIcon={app}\Azaion.Suite.exe
Compression=lzma2/fast Compression=lzma2/fast
SolidCompression=yes SolidCompression=yes
DiskSpanning=yes
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"