forked from sergiomsilva/alpr-unconstrained
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·87 lines (71 loc) · 1.26 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
check_file()
{
if [ ! -f "$1" ]
then
return 0
else
return 1
fi
}
check_dir()
{
if [ ! -d "$1" ]
then
return 0
else
return 1
fi
}
# Check if Darknet is compiled
check_file "darknet/libdarknet.so"
retval=$?
if [ $retval -eq 0 ]
then
echo "Darknet is not compiled! Go to 'darknet' directory and 'make'!"
exit 0
fi
# Check # of arguments
if [ ! $# -eq 3 ]
then
echo ""
echo " Required arguments:"
echo ""
echo " 1. Input dir path (containing JPG or PNG images)"
echo " 2. Output dir path"
echo " 3. Output CSV file path"
echo ""
exit 1
fi
read -n1 -r -p "Press any key to continue..." key
# Download all networks
bash get-networks.sh
# Check if input dir exists
check_dir $1
retval=$?
if [ $retval -eq 0 ]
then
echo "Input directory ($1) does not exist"
exit 0
fi
# Check if output dir exists, if not, create it
check_dir $2
retval=$?
if [ $retval -eq 0 ]
then
mkdir -p $2
fi
# Detect vehicles
python vehicle-detection.py $1 $2
# Detect license plates
python license-plate-detection.py $2 data/lp-detector/wpod-net.h5
# OCR
python license-plate-ocr.py $2
# Draw output and generate list
python gen-outputs.py $1 $2 > $3
# Clean files and draw output
rm $2/*_lp.png
rm $2/*car.png
rm $2/*_cars.txt
rm $2/*_lp.txt
rm $2/*_str.txt