diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0d07051 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: Build and Publish + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Restore + run: dotnet restore + + - name: Build Release + env: + GITHUB_RUN_NUMBER: ${{ github.run_number }} + GITHUB_SHA: ${{ github.sha }} + run: dotnet build -c Release --no-restore + + - name: Publish Release + env: + GITHUB_RUN_NUMBER: ${{ github.run_number }} + GITHUB_SHA: ${{ github.sha }} + run: dotnet publish -c Release -r win-x64 --self-contained true --no-build + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: splitter-win-x64 + path: bin/Release/net10.0/win-x64/publish/ diff --git a/.gitignore b/.gitignore index 205d9ee..0882c33 100644 --- a/.gitignore +++ b/.gitignore @@ -363,4 +363,5 @@ MigrationBackup/ FodyWeavers.xsd # OpenCV models -models/*.* +splitter-cli/models/*.* +*.g.cs diff --git a/splitter-cli/BuildInfo.cs b/splitter-cli/BuildInfo.cs new file mode 100644 index 0000000..4ae6898 --- /dev/null +++ b/splitter-cli/BuildInfo.cs @@ -0,0 +1,8 @@ +namespace splitter; + +public static class BuildInfo +{ + public static string Version { get; } = ThisAssembly.Version; + public static string BuildNumber { get; } = ThisAssembly.BuildNumber; + public static string Commit { get; } = ThisAssembly.Commit; +} diff --git a/splitter-cli/BuildInfo.template b/splitter-cli/BuildInfo.template new file mode 100644 index 0000000..00ad47a --- /dev/null +++ b/splitter-cli/BuildInfo.template @@ -0,0 +1,9 @@ +// Auto-generated. Do not edit. +namespace splitter; + +internal static class ThisAssembly +{ + public const string Version = "@VERSION@"; + public const string BuildNumber = "@BUILDNUMBER@"; + public const string Commit = "@COMMIT@"; +} diff --git a/CameraController.cs b/splitter-cli/CameraController.cs similarity index 100% rename from CameraController.cs rename to splitter-cli/CameraController.cs diff --git a/CommandLine.cs b/splitter-cli/CommandLine.cs similarity index 98% rename from CommandLine.cs rename to splitter-cli/CommandLine.cs index 1e42b08..c2cf791 100644 --- a/CommandLine.cs +++ b/splitter-cli/CommandLine.cs @@ -323,9 +323,17 @@ public sealed class CommandLine throw new FormatException($"Invalid duration format: {text}"); } + + public static void PrintVersion() + { + Console.WriteLine($"...---=== splitter version {BuildInfo.Version} (commit {BuildInfo.Commit}, build {BuildInfo.BuildNumber}) ===---..."); + } + public static void PrintHelp() { + PrintVersion(); Console.WriteLine(@" + Usage: splitter [ ...] [options] [--] @@ -371,7 +379,7 @@ Options: --detect= Object detector to use for tracking. Values: face (UltraFace), body (YoloOnnx, default), none (no tracking, just a center) - --gravitate= Gravitate towards a specific point (x, y) in the video frame. + --gravitate= Gravitate towards a specific point (x, y) in the video frame when tracking. Coordinates are normalized (0.0 to 1.0). Example: --gravitate=0.2:0.5 (gravitate towards left-center) diff --git a/FileMaskExpander.cs b/splitter-cli/FileMaskExpander.cs similarity index 100% rename from FileMaskExpander.cs rename to splitter-cli/FileMaskExpander.cs diff --git a/ILogger.cs b/splitter-cli/ILogger.cs similarity index 100% rename from ILogger.cs rename to splitter-cli/ILogger.cs diff --git a/IObjectDetector.cs b/splitter-cli/IObjectDetector.cs similarity index 100% rename from IObjectDetector.cs rename to splitter-cli/IObjectDetector.cs diff --git a/ISegmentProcessor.cs b/splitter-cli/ISegmentProcessor.cs similarity index 100% rename from ISegmentProcessor.cs rename to splitter-cli/ISegmentProcessor.cs diff --git a/KalmanTracker.cs b/splitter-cli/KalmanTracker.cs similarity index 100% rename from KalmanTracker.cs rename to splitter-cli/KalmanTracker.cs diff --git a/LoggingBase.cs b/splitter-cli/LoggingBase.cs similarity index 100% rename from LoggingBase.cs rename to splitter-cli/LoggingBase.cs diff --git a/Point2f.cs b/splitter-cli/Point2f.cs similarity index 100% rename from Point2f.cs rename to splitter-cli/Point2f.cs diff --git a/ProbeVideo.cs b/splitter-cli/ProbeVideo.cs similarity index 100% rename from ProbeVideo.cs rename to splitter-cli/ProbeVideo.cs diff --git a/Properties/launchSettings.json b/splitter-cli/Properties/launchSettings.json similarity index 100% rename from Properties/launchSettings.json rename to splitter-cli/Properties/launchSettings.json diff --git a/SimpleSplitter.cs b/splitter-cli/SimpleSplitter.cs similarity index 100% rename from SimpleSplitter.cs rename to splitter-cli/SimpleSplitter.cs diff --git a/SingleTask.cs b/splitter-cli/SingleTask.cs similarity index 100% rename from SingleTask.cs rename to splitter-cli/SingleTask.cs diff --git a/SpectreConsoleLogger.cs b/splitter-cli/SpectreConsoleLogger.cs similarity index 100% rename from SpectreConsoleLogger.cs rename to splitter-cli/SpectreConsoleLogger.cs diff --git a/TextLogger.cs b/splitter-cli/TextLogger.cs similarity index 100% rename from TextLogger.cs rename to splitter-cli/TextLogger.cs diff --git a/TrackingSplitter.cs b/splitter-cli/TrackingSplitter.cs similarity index 100% rename from TrackingSplitter.cs rename to splitter-cli/TrackingSplitter.cs diff --git a/UltraFaceDetector.cs b/splitter-cli/UltraFaceDetector.cs similarity index 100% rename from UltraFaceDetector.cs rename to splitter-cli/UltraFaceDetector.cs diff --git a/YoloOnnxObjectDetector.cs b/splitter-cli/YoloOnnxObjectDetector.cs similarity index 100% rename from YoloOnnxObjectDetector.cs rename to splitter-cli/YoloOnnxObjectDetector.cs diff --git a/splitter-cli/models/slim_320.bin b/splitter-cli/models/slim_320.bin new file mode 100644 index 0000000..3378dc6 Binary files /dev/null and b/splitter-cli/models/slim_320.bin differ diff --git a/splitter-cli/models/slim_320.param b/splitter-cli/models/slim_320.param new file mode 100644 index 0000000..a78a72a --- /dev/null +++ b/splitter-cli/models/slim_320.param @@ -0,0 +1,102 @@ +7767517 +100 107 +Input input 0 1 input +Convolution 185 1 1 input 185 0=16 1=3 11=3 2=1 12=1 3=2 13=2 4=1 14=1 5=1 6=432 +ReLU 187 1 1 185 187 +ConvolutionDepthWise 188 1 1 187 188 0=16 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=144 7=16 +ReLU 190 1 1 188 190 +Convolution 191 1 1 190 191 0=32 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=512 +ReLU 193 1 1 191 193 +ConvolutionDepthWise 194 1 1 193 194 0=32 1=3 11=3 2=1 12=1 3=2 13=2 4=1 14=1 5=1 6=288 7=32 +ReLU 196 1 1 194 196 +Convolution 197 1 1 196 197 0=32 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=1024 +ReLU 199 1 1 197 199 +ConvolutionDepthWise 200 1 1 199 200 0=32 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=288 7=32 +ReLU 202 1 1 200 202 +Convolution 203 1 1 202 203 0=32 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=1024 +ReLU 205 1 1 203 205 +ConvolutionDepthWise 206 1 1 205 206 0=32 1=3 11=3 2=1 12=1 3=2 13=2 4=1 14=1 5=1 6=288 7=32 +ReLU 208 1 1 206 208 +Convolution 209 1 1 208 209 0=64 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=2048 +ReLU 211 1 1 209 211 +ConvolutionDepthWise 212 1 1 211 212 0=64 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=576 7=64 +ReLU 214 1 1 212 214 +Convolution 215 1 1 214 215 0=64 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=4096 +ReLU 217 1 1 215 217 +ConvolutionDepthWise 218 1 1 217 218 0=64 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=576 7=64 +ReLU 220 1 1 218 220 +Convolution 221 1 1 220 221 0=64 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=4096 +ReLU 223 1 1 221 223 +ConvolutionDepthWise 224 1 1 223 224 0=64 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=576 7=64 +ReLU 226 1 1 224 226 +Convolution 227 1 1 226 227 0=64 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=4096 +ReLU 229 1 1 227 229 +Split splitncnn_0 1 3 229 229_splitncnn_0 229_splitncnn_1 229_splitncnn_2 +ConvolutionDepthWise 230 1 1 229_splitncnn_2 230 0=64 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=576 7=64 +ReLU 231 1 1 230 231 +Convolution 232 1 1 231 232 0=6 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=384 +Permute 233 1 1 232 233 0=3 +Reshape 243 1 1 233 243 0=2 1=-1 +ConvolutionDepthWise 244 1 1 229_splitncnn_1 244 0=64 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=576 7=64 +ReLU 245 1 1 244 245 +Convolution 246 1 1 245 246 0=12 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=768 +Permute 247 1 1 246 247 0=3 +Reshape 257 1 1 247 257 0=4 1=-1 +ConvolutionDepthWise 258 1 1 229_splitncnn_0 258 0=64 1=3 11=3 2=1 12=1 3=2 13=2 4=1 14=1 5=1 6=576 7=64 +ReLU 260 1 1 258 260 +Convolution 261 1 1 260 261 0=128 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=8192 +ReLU 263 1 1 261 263 +ConvolutionDepthWise 264 1 1 263 264 0=128 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=1152 7=128 +ReLU 266 1 1 264 266 +Convolution 267 1 1 266 267 0=128 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=16384 +ReLU 269 1 1 267 269 +ConvolutionDepthWise 270 1 1 269 270 0=128 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=1152 7=128 +ReLU 272 1 1 270 272 +Convolution 273 1 1 272 273 0=128 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=16384 +ReLU 275 1 1 273 275 +Split splitncnn_1 1 3 275 275_splitncnn_0 275_splitncnn_1 275_splitncnn_2 +ConvolutionDepthWise 276 1 1 275_splitncnn_2 276 0=128 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=1152 7=128 +ReLU 277 1 1 276 277 +Convolution 278 1 1 277 278 0=4 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=512 +Permute 279 1 1 278 279 0=3 +Reshape 289 1 1 279 289 0=2 1=-1 +ConvolutionDepthWise 290 1 1 275_splitncnn_1 290 0=128 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=1152 7=128 +ReLU 291 1 1 290 291 +Convolution 292 1 1 291 292 0=8 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=1024 +Permute 293 1 1 292 293 0=3 +Reshape 303 1 1 293 303 0=4 1=-1 +ConvolutionDepthWise 304 1 1 275_splitncnn_0 304 0=128 1=3 11=3 2=1 12=1 3=2 13=2 4=1 14=1 5=1 6=1152 7=128 +ReLU 306 1 1 304 306 +Convolution 307 1 1 306 307 0=256 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=32768 +ReLU 309 1 1 307 309 +ConvolutionDepthWise 310 1 1 309 310 0=256 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=2304 7=256 +ReLU 312 1 1 310 312 +Convolution 313 1 1 312 313 0=256 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=65536 +ReLU 315 1 1 313 315 +Split splitncnn_2 1 3 315 315_splitncnn_0 315_splitncnn_1 315_splitncnn_2 +ConvolutionDepthWise 316 1 1 315_splitncnn_2 316 0=256 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=2304 7=256 +ReLU 317 1 1 316 317 +Convolution 318 1 1 317 318 0=4 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=1024 +Permute 319 1 1 318 319 0=3 +Reshape 329 1 1 319 329 0=2 1=-1 +ConvolutionDepthWise 330 1 1 315_splitncnn_1 330 0=256 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=2304 7=256 +ReLU 331 1 1 330 331 +Convolution 332 1 1 331 332 0=8 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=2048 +Permute 333 1 1 332 333 0=3 +Reshape 343 1 1 333 343 0=4 1=-1 +Convolution 344 1 1 315_splitncnn_0 344 0=64 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=16384 +ReLU 345 1 1 344 345 +ConvolutionDepthWise 346 1 1 345 346 0=64 1=3 11=3 2=1 12=1 3=2 13=2 4=1 14=1 5=1 6=576 7=64 +ReLU 347 1 1 346 347 +Convolution 348 1 1 347 348 0=256 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 5=1 6=16384 +ReLU 349 1 1 348 349 +Split splitncnn_3 1 2 349 349_splitncnn_0 349_splitncnn_1 +Convolution 350 1 1 349_splitncnn_1 350 0=6 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=13824 +Permute 351 1 1 350 351 0=3 +Reshape 361 1 1 351 361 0=2 1=-1 +Convolution 362 1 1 349_splitncnn_0 362 0=12 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 5=1 6=27648 +Permute 363 1 1 362 363 0=3 +Reshape 373 1 1 363 373 0=4 1=-1 +Concat 374 4 1 243 289 329 361 374 0=0 +Concat boxes 4 1 257 303 343 373 boxes 0=0 +Softmax scores 1 1 374 scores 0=1 1=1 diff --git a/splitter-cli/models/yolov8s.onnx b/splitter-cli/models/yolov8s.onnx new file mode 100644 index 0000000..8fbc42e Binary files /dev/null and b/splitter-cli/models/yolov8s.onnx differ diff --git a/splitter.cs b/splitter-cli/splitter.cs similarity index 100% rename from splitter.cs rename to splitter-cli/splitter.cs diff --git a/splitter.csproj b/splitter-cli/splitter.csproj similarity index 59% rename from splitter.csproj rename to splitter-cli/splitter.csproj index 1958ec5..df3a129 100644 --- a/splitter.csproj +++ b/splitter-cli/splitter.csproj @@ -24,24 +24,60 @@ true + true + none + false true true false - true - true - win-x64 + false + + 1.0.0 + $(GITHUB_SHA) + + + + $(GITHUB_RUN_NUMBER) + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest - + - diff --git a/splitter.sln b/splitter.sln deleted file mode 100644 index 0f1e65b..0000000 --- a/splitter.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 18 -VisualStudioVersion = 18.5.11716.220 stable -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "splitter", "splitter.csproj", "{D628372F-EA0D-4E59-EB15-96FD85D90AC4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D628372F-EA0D-4E59-EB15-96FD85D90AC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D628372F-EA0D-4E59-EB15-96FD85D90AC4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D628372F-EA0D-4E59-EB15-96FD85D90AC4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D628372F-EA0D-4E59-EB15-96FD85D90AC4}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A289E39A-C107-4125-9F2D-ADEE83CEE0B2} - EndGlobalSection -EndGlobal diff --git a/splitter.slnx b/splitter.slnx new file mode 100644 index 0000000..e438da8 --- /dev/null +++ b/splitter.slnx @@ -0,0 +1,3 @@ + + +