update,
This commit is contained in:
83
vinniesniper-54816/task1/_lab/020-cascade_tools-main/train.sh
Executable file
83
vinniesniper-54816/task1/_lab/020-cascade_tools-main/train.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
|
||||
python png_to_jpg.py
|
||||
|
||||
echo "Create vector file from positives, negatives and starts the training"
|
||||
echo "Parameters: posivies size, number of posties, "
|
||||
|
||||
|
||||
# Number of training stages
|
||||
nrStages=20
|
||||
|
||||
# detection types [HAAR,LBP]
|
||||
# fn=HAAR
|
||||
# object size, width, height
|
||||
imgw=24
|
||||
imgh=24
|
||||
|
||||
# number of images containg the object to detect (see pos directory content)
|
||||
nrf=0
|
||||
FILES=./pos/*.jpg
|
||||
for f in $FILES; do
|
||||
nrf=$((nrf+1))
|
||||
done
|
||||
|
||||
nrPos=$nrf
|
||||
nrPosThreeTimes=$(($nrPos * 3))
|
||||
|
||||
# number of images NOT containg the object to detect (see neg directory content)
|
||||
nrf=0
|
||||
FILES=./neg/*.jpg
|
||||
for f in $FILES; do
|
||||
nrf=$((nrf+1))
|
||||
done
|
||||
|
||||
nrNeg=$nrf
|
||||
|
||||
# # create positive dat file and negative txt file
|
||||
python3 ./prepare_data.py \
|
||||
-posWidthX 24 \
|
||||
-posWidthY 24 \
|
||||
-negWidthX 64 \
|
||||
-negWidthY 64
|
||||
|
||||
|
||||
# create vector file from positives
|
||||
opencv_createsamples \
|
||||
-info info.dat \
|
||||
-vec positives.vec \
|
||||
-bg neg.txt \
|
||||
-maxxangle 1.1 \
|
||||
-maxyangle 1.1 \
|
||||
-maxzangle 1.1 \
|
||||
-w $imgw -h $imgh \
|
||||
-num $nrPos
|
||||
|
||||
# create positives from a single image
|
||||
#opencv_createsamples \
|
||||
# -img object.jpg \
|
||||
# -bg neg.txt \
|
||||
# -info info/info.lst \
|
||||
# -pngoutput info \
|
||||
# -maxxangle 1.1 \
|
||||
# -maxyangle 1.1 \
|
||||
# -maxzangle 1.1 \
|
||||
# -num $nrPos \
|
||||
# -w $imgw -h $imgh
|
||||
|
||||
|
||||
# train cascade
|
||||
opencv_traincascade \
|
||||
-data data \
|
||||
-vec positives.vec \
|
||||
-bg neg.txt \
|
||||
-numPos $nrPos \
|
||||
-numNeg $nrNeg \
|
||||
-numStages $nrStages \
|
||||
-w $imgw \
|
||||
-h $imgh \
|
||||
-minHitRate 0.999 \
|
||||
-maxFalseAlarmRate 0.5 \
|
||||
-mode ALL \
|
||||
-numThreads 4 \
|
||||
-precalcValBufSize 8192 -precalcIdxBufSize 8192
|
||||
# -featureType $fn \
|
Reference in New Issue
Block a user