1 | #!/bin/bash
|
---|
2 |
|
---|
3 | if [ $# != 4 ] ; then
|
---|
4 | echo "Usage: ./testClassifier.sh folder/file classifier_type output_filename type(-a:all -test:100 -single:1)" 1>&2
|
---|
5 | exit 1
|
---|
6 | fi
|
---|
7 |
|
---|
8 | source=$1
|
---|
9 | classifier_type=$2
|
---|
10 | output=$3
|
---|
11 | i=0
|
---|
12 | j=0
|
---|
13 | case "$4" in
|
---|
14 | #________________________________________________________________________________________________________________________________________________________________________________________
|
---|
15 |
|
---|
16 | -all)
|
---|
17 | #Runs javaImageClassifier on ALL images
|
---|
18 | for file in $source/*/*.png; do
|
---|
19 | echo $file
|
---|
20 | echo $output
|
---|
21 | echo $i
|
---|
22 | echo ""
|
---|
23 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaImageClassifier $file $classifier_type $output
|
---|
24 | i=$[$i+1]
|
---|
25 | done
|
---|
26 | ;;
|
---|
27 | #________________________________________________________________________________________________________________________________________________________________________________________
|
---|
28 |
|
---|
29 | -allNew)
|
---|
30 | for file in $source/*/*.png; do
|
---|
31 | echo $file
|
---|
32 | echo $output
|
---|
33 | #echo $i
|
---|
34 | echo ""
|
---|
35 |
|
---|
36 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaClassifierComparison $file $classifier_type $output
|
---|
37 | i=$[$i+1]
|
---|
38 | done
|
---|
39 | ;;
|
---|
40 | #________________________________________________________________________________________________________________________________________________________________________________________
|
---|
41 |
|
---|
42 | -test)
|
---|
43 | #Runs javaImageClassifier on 100 images of each
|
---|
44 | for file in $source/SheetMusic/*.png; do
|
---|
45 | if [ $i -lt 10 ] ; then
|
---|
46 | echo $file
|
---|
47 | echo $output
|
---|
48 | echo $i
|
---|
49 | echo ""
|
---|
50 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaImageClassifier $file $classifier_type $output
|
---|
51 | i=$[$i+1]
|
---|
52 | fi
|
---|
53 | done
|
---|
54 | for file in $source/NotSheetMusic/*.png; do
|
---|
55 | if [ $j -lt 10 ] ; then
|
---|
56 | echo $file
|
---|
57 | echo $output
|
---|
58 | echo $j
|
---|
59 | echo ""
|
---|
60 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaImageClassifier $file $classifier_type $output
|
---|
61 | j=$[$j+1]
|
---|
62 | fi
|
---|
63 | done
|
---|
64 | ;;
|
---|
65 | #________________________________________________________________________________________________________________________________________________________________________________________
|
---|
66 |
|
---|
67 | -testNew)
|
---|
68 | javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar -Xlint javaClassifierComparison.java;
|
---|
69 | #Runs javaImageClassifier on 10 images of each
|
---|
70 | for file in $source/SheetMusic/*.png; do
|
---|
71 | if [ $i -lt 10 ] ; then
|
---|
72 | echo $file
|
---|
73 | echo $output
|
---|
74 | echo $i
|
---|
75 | echo ""
|
---|
76 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaClassifierComparison $file $classifier_type $output
|
---|
77 | i=$[$i+1]
|
---|
78 | fi
|
---|
79 | done
|
---|
80 | for file in $source/NotSheetMusic/*.png; do
|
---|
81 | if [ $j -lt 10 ] ; then
|
---|
82 | echo $file
|
---|
83 | echo $output
|
---|
84 | echo $j
|
---|
85 | echo ""
|
---|
86 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaClassifierComparison $file $classifier_type $output
|
---|
87 | j=$[$j+1]
|
---|
88 | fi
|
---|
89 | done
|
---|
90 | ;;
|
---|
91 | #________________________________________________________________________________________________________________________________________________________________________________________
|
---|
92 |
|
---|
93 | -single)
|
---|
94 | #Runs javaImagesClassifier on ONE image
|
---|
95 | javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaImageClassifier.java;
|
---|
96 | echo $source
|
---|
97 | echo $output
|
---|
98 | echo $classifier_type
|
---|
99 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaImageClassifier $source $classifier_type $output
|
---|
100 | ;;
|
---|
101 | #________________________________________________________________________________________________________________________________________________________________________________________
|
---|
102 |
|
---|
103 | -singleNew)
|
---|
104 | #Runs javaImagesClassifier on ONE image
|
---|
105 | javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar -Xlint javaClassifierComparison.java;
|
---|
106 | echo $source
|
---|
107 | echo $output
|
---|
108 | echo $classifier_type
|
---|
109 | java -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar:. -Djava.library.path=/Scratch/cpb16/opencv-3.4.2/build/lib/ javaClassifierComparison $source $classifier_type $output
|
---|
110 | ;;
|
---|
111 | esac
|
---|