73 lines
1.4 KiB
Bash
Executable File
73 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -ex
|
|
|
|
width_height=24
|
|
file_num=100
|
|
slice_num=200
|
|
|
|
cd slice_image
|
|
python slice_image.py $width_height $width_height $file_num $slice_num
|
|
cd ..
|
|
|
|
rm -rf posdata_400/*.jpg
|
|
cp -r slice_image/output/*.jpg posdata_400
|
|
echo "slice done"
|
|
|
|
cd negdata_wo_beach
|
|
# python _ReName.py
|
|
python ./_GenTXT.py
|
|
python ./_copy.py
|
|
num_of_neg_file=$(find . -type f -name "*.jpg" | wc -l)
|
|
cd ..
|
|
|
|
wc -l neg.txt
|
|
|
|
cd posdata_400
|
|
# python _ReName.py
|
|
python ./_GenTXT.py
|
|
python ./_copy.py
|
|
num_of_pos_file=$(find . -type f -name "*.jpg" | wc -l)
|
|
cd ..
|
|
|
|
echo "count pos file"
|
|
echo $num_of_pos_file
|
|
wc -l pos.txt
|
|
read -p "Press [Enter] key to continue..." tmp
|
|
|
|
|
|
python ./process_txt_files.py $width_height $width_height
|
|
|
|
# ./step1.sh
|
|
rm -rf pos.vec
|
|
opencv_createsamples \
|
|
-info pos.txt \
|
|
-vec pos.vec \
|
|
-num 200 \
|
|
-w $width_height -h $width_height
|
|
|
|
# ./step2_t1.sh
|
|
rm -rf xml_step2_t1/*.xml
|
|
|
|
echo "clean done"
|
|
|
|
opencv_traincascade \
|
|
-data xml_step2_t1 \
|
|
-vec pos.vec \
|
|
-bg neg.txt \
|
|
-numPos 200 \
|
|
-numNeg $num_of_neg_file \
|
|
-numStages 15 \
|
|
-numThreads 6 \
|
|
-maxFalseAlarmRate 0.5 \
|
|
-w $width_height -h $width_height \
|
|
-mode ALL \
|
|
| tee train_result.log
|
|
|
|
|
|
cp xml_step2_t1/cascade.xml test_case/beach_test/cascade.xml
|
|
cd test_case/beach_test
|
|
./sanity_test.sh | tee sanity_test_result.log
|
|
cd ..
|
|
|
|
echo "done"
|
|
exit 0 |