From 7d873ee5dfeb7d24341472ba67d26931c6f7565b Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:05:38 -0700 Subject: [PATCH] added dataset generator script --- generate_datasets.ps1 | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 generate_datasets.ps1 diff --git a/generate_datasets.ps1 b/generate_datasets.ps1 new file mode 100644 index 0000000..c57a7da --- /dev/null +++ b/generate_datasets.ps1 @@ -0,0 +1,45 @@ +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" \ No newline at end of file