WGU-Capstone/generate_datasets.ps1

45 lines
3.4 KiB
PowerShell
Raw Normal View History

2023-10-05 22:05:38 -07:00
if (-Not (Test-Path -Path ".\training_data\negatives")) {
Write-Host "The negatives folder is not where it was expected"
return
}
if (-Not (Test-Path -Path ".\training_data\positives")) {
Write-Host "The positives folder is not where it was expected"
return
}
if (-Not (Test-Path -Path ".\training_data\1_positive_info")) {
New-Item -ItemType Directory -Force -Path ".\training_data\1_positive_info"
}
if (-Not (Test-Path -Path ".\training_data\2_positive_info")) {
New-Item -ItemType Directory -Force -Path ".\training_data\2_positive_info"
}
if (-Not (Test-Path -Path ".\training_data\5_positive_info")) {
New-Item -ItemType Directory -Force -Path ".\training_data\5_positive_info"
}
Set-Location .\training_data
python .\dat_file_setup.py
.\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_1.png -bg .\backgrounds.txt -info 1_positive_info/info.lst -pngoutput 1_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
.\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_1.png -bg .\backgrounds.txt -info 2_positive_info/info.lst -pngoutput 2_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
.\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_2.png -bg .\backgrounds.txt -info 2_positive_info/info.lst -pngoutput 2_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_1.png -bg .\backgrounds.txt -info 5_positive_info/info.lst -pngoutput 5_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_2.png -bg .\backgrounds.txt -info 5_positive_info/info.lst -pngoutput 5_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_3.png -bg .\backgrounds.txt -info 5_positive_info/info.lst -pngoutput 5_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_4.png -bg .\backgrounds.txt -info 5_positive_info/info.lst -pngoutput 5_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -img .\positives\face_5.png -bg .\backgrounds.txt -info 5_positive_info/info.lst -pngoutput 5_positive_info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -info .\1_positive_info\info.lst -num 1950 -w 20 -h 20 -vec positives_1.vec
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -info .\2_positive_info\info.lst -num 3900 -w 20 -h 20 -vec positives_2.vec
& .\opencv\build\x64\vc15\bin\opencv_createsamples.exe -info .\5_positive_info\info.lst -num 9750 -w 20 -h 20 -vec positives_5.vec
Write-Host "Ready for"
Write-Host ".\opencv\build\x64\vc15\bin\opencv_traincascade.exe -data data -vec .\positives-1.vec -bg .\backgrounds.txt -numPos 1500 -numNeg 900 -numStages 15 -w 20 -h 20"
Write-Host ".\opencv\build\x64\vc15\bin\opencv_traincascade.exe -data data -vec .\positives-2.vec -bg .\backgrounds.txt -numPos 3000 -numNeg 1500 -numStages 15 -w 20 -h 20"
Write-Host ".\opencv\build\x64\vc15\bin\opencv_traincascade.exe -data data -vec .\positives-5.vec -bg .\backgrounds.txt -numPos 9000 -numNeg 1950 -numStages 15 -w 20 -h 20"