feat: auto runnings
This commit is contained in:
29
README.md
29
README.md
@@ -49,3 +49,32 @@ python main.py --mode standalone --name test_route --lat 49.103814 --lon 55.7942
|
||||
- `--debug-landmark` - вывести отладку ориентиров.
|
||||
- `--use-sian-similarity` - выбирать ориентир через SiaN Similarity.
|
||||
- `--use-gan` - преобразовывать эталонные изображения через GAN.
|
||||
- `--interframe-method` - метод межкадрового сравнения: `optical-flow`, `orb`, `akaze`, `sift`, `brisk`.
|
||||
- `--landmark-method` - метод сравнения с эталонами: `orb`, `akaze`, `sift`, `brisk`.
|
||||
|
||||
## Автоматические серии запусков
|
||||
|
||||
Для прогона уже построенных маршрутов с разными параметрами:
|
||||
|
||||
```powershell
|
||||
.\run_batch.ps1 -Routes test_route -SimulationMaps yandex,google -InterframeMethods optical-flow,orb,akaze -LandmarkMethods orb,sift -RefMinDistances 75,100
|
||||
```
|
||||
|
||||
Если `-Routes` не указан, скрипт запустит все маршруты из `trajectories`.
|
||||
Маршруты можно указать списком:
|
||||
|
||||
```powershell
|
||||
.\run_batch.ps1 -Routes 2026-05-31_15-32-53,2026-05-31_15-21-17
|
||||
```
|
||||
|
||||
Или через текстовый файл, по одному маршруту на строку:
|
||||
|
||||
```powershell
|
||||
.\run_batch.ps1 -RouteListPath .\routes.txt
|
||||
```
|
||||
|
||||
Для проверки команд без запуска Selenium:
|
||||
|
||||
```powershell
|
||||
.\run_batch.ps1 -DryRun
|
||||
```
|
||||
|
||||
109
run_batch.ps1
Normal file
109
run_batch.ps1
Normal file
@@ -0,0 +1,109 @@
|
||||
param(
|
||||
[string[]]$Routes = @(),
|
||||
[string]$RouteListPath = "",
|
||||
[string[]]$SimulationMaps = @("yandex"),
|
||||
[string[]]$InterframeMethods = @("optical-flow", "orb", "akaze", "sift", "brisk"),
|
||||
[string[]]$LandmarkMethods = @("orb", "akaze", "sift", "brisk"),
|
||||
[double[]]$RefMinDistances = @(100),
|
||||
[switch]$UseSianSimilarity,
|
||||
[switch]$UseGan,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
Set-Location $ProjectRoot
|
||||
|
||||
function Expand-List {
|
||||
param([string[]]$Values)
|
||||
|
||||
$Expanded = @()
|
||||
foreach ($Value in $Values) {
|
||||
$Expanded += $Value -split "," | ForEach-Object { $_.Trim() } | Where-Object { $_ }
|
||||
}
|
||||
return $Expanded
|
||||
}
|
||||
|
||||
$Routes = Expand-List $Routes
|
||||
$SimulationMaps = Expand-List $SimulationMaps
|
||||
$InterframeMethods = Expand-List $InterframeMethods
|
||||
$LandmarkMethods = Expand-List $LandmarkMethods
|
||||
|
||||
if ($RouteListPath) {
|
||||
if (-not (Test-Path $RouteListPath)) {
|
||||
throw "Файл со списком маршрутов не найден: $RouteListPath"
|
||||
}
|
||||
|
||||
$RoutesFromFile = Get-Content -Path $RouteListPath |
|
||||
ForEach-Object { ($_ -split "#")[0].Trim() } |
|
||||
Where-Object { $_ }
|
||||
|
||||
$Routes += $RoutesFromFile
|
||||
$Routes = $Routes | Select-Object -Unique
|
||||
}
|
||||
|
||||
if ($Routes.Count -eq 0) {
|
||||
$Routes = Get-ChildItem -Path "trajectories" -Directory |
|
||||
Where-Object { Test-Path (Join-Path $_.FullName "positions.pkl") } |
|
||||
Sort-Object Name |
|
||||
Select-Object -ExpandProperty Name
|
||||
}
|
||||
|
||||
if ($Routes.Count -eq 0) {
|
||||
throw "Не найдено маршрутов в trajectories. Сначала выполните build хотя бы для одного маршрута."
|
||||
}
|
||||
|
||||
$Python = Join-Path $ProjectRoot ".venv\Scripts\python.exe"
|
||||
if (-not (Test-Path $Python)) {
|
||||
$Python = "python"
|
||||
}
|
||||
|
||||
$Total = $Routes.Count * $SimulationMaps.Count * $InterframeMethods.Count * $LandmarkMethods.Count * $RefMinDistances.Count
|
||||
$RunIndex = 0
|
||||
|
||||
Write-Host "Batch run started"
|
||||
Write-Host "Routes: $($Routes -join ', ')"
|
||||
Write-Host "Total runs: $Total"
|
||||
|
||||
foreach ($Route in $Routes) {
|
||||
foreach ($SimulationMap in $SimulationMaps) {
|
||||
foreach ($RefMinDistance in $RefMinDistances) {
|
||||
foreach ($InterframeMethod in $InterframeMethods) {
|
||||
foreach ($LandmarkMethod in $LandmarkMethods) {
|
||||
$RunIndex += 1
|
||||
$Args = @(
|
||||
"main.py",
|
||||
"--mode", "run",
|
||||
"--name", $Route,
|
||||
"--simulation", $SimulationMap,
|
||||
"--ref-min-distance", "$RefMinDistance",
|
||||
"--interframe-method", $InterframeMethod,
|
||||
"--landmark-method", $LandmarkMethod
|
||||
)
|
||||
|
||||
if ($UseSianSimilarity) {
|
||||
$Args += "--use-sian-similarity"
|
||||
}
|
||||
if ($UseGan) {
|
||||
$Args += "--use-gan"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[$RunIndex/$Total] route=$Route simulation=$SimulationMap ref=$RefMinDistance interframe=$InterframeMethod landmark=$LandmarkMethod"
|
||||
Write-Host "$Python $($Args -join ' ')"
|
||||
|
||||
if (-not $DryRun) {
|
||||
& $Python @Args
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Run failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Batch run finished. Results are saved by main.py into test_runs."
|
||||
Reference in New Issue
Block a user