source: other-projects/is-sheet-music-encore/trunk/EndToEndSystem.sh@ 33589

Last change on this file since 33589 was 33589, checked in by cpb16, 5 years ago

final01. Need Map results still

  • Property svn:executable set to *
File size: 21.4 KB
Line 
1#!/bin/bash
2#****************************************************************************************************
3#Type --help for detail on shortcuts
4#Have Makefile have some useful 'quick commands'
5
6#if [ $# != 1 ] ; then
7# echo "Usage: ./EndToEndSystem task" 1>&2
8# exit 1
9#fi
10#Using scripts that have different amount of arguments
11type=$1
12
13#****************************************************************************************************
14#Test/Dev Scripts
15#****************************************************************************************************
16if [ $type == "argTest" ] ; then
17 if [ $# != 3 ] ; then
18 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory> <borderIgnoreAmount> "
19 exit 1
20 fi
21 location=$2
22 borderIgnoreAmount=$3
23 cd image-identification-terminal
24 mkdir log-EndToEnd/$location/
25 #Delete files if exists
26 if [ -d log-EndToEnd/$location ] ; then
27 echo "removing folder logEndToEnd/$location"
28 rm -r log-EndToEnd/$location/
29 mkdir log-EndToEnd/$location/
30 fi
31
32 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
33 echo "Start Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
34 echo >> log-EndToEnd/$location/results.txt #Add Space
35 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt #Add config
36 echo $'ARGUEMENT DETAILS: \n' >> log-EndToEnd/$location/results.txt
37 echo "borderIgnoreAmount: $borderIgnoreAmount. That is to say that outer $borderIgnoreAmount% of the image was not considered by the algorithm." >> log-EndToEnd/$location/results.txt
38 echo "[NYI]" >> log-EndToEnd/$location/results.txt
39 echo >> log-EndToEnd/$location/results.txt #Space
40
41 #Compile
42 echo "Compiling java programs..."
43 javac javaAccuracyCalculator.java
44 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
45
46 #Classifiers
47 echo "Successfuly Compiled, running classifer now..."
48 ./runClassiferV02.sh -argTest /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MU morphology log-EndToEnd/$location/log-morph-MU.txt $borderIgnoreAmount
49
50 #Accuracy Calculation
51 echo "Successfuly Classified, writing results now..."
52 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-MU.txt morph-MU log-EndToEnd/$location/results.txt
53 echo >>log-EndToEnd/$location/results.txt
54 echo "End Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
55 #.././calculateCorpusAccuracy.sh
56
57 #less log-EndToEnd/$location/results.txt
58 exit $?
59fi
60
61#****************************************************************************************************
62#Utility Scripts
63#****************************************************************************************************
64if [ $type == "page_num_test" ] ; then
65 page_num=5
66 if [ $page_num != 1 ] ; then
67 let a=$page_num/2
68 new_page_num=$a
69 else
70 new_page_num=$page_num
71 fi
72 echo $new_page_num
73 exit $?
74fi
75#****************************************************************************************************
76#Classifier Scripts [HIGHRES BY DEFUALT]
77#****************************************************************************************************
78
79#Morphology - No args
80
81if [ $type == "morph" ] ; then
82 if [ $# != 2 ] ; then
83 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory> "
84 exit 1
85 fi
86 location=$2
87
88 #Compile
89 echo "Compiling java programs..."
90 cd image-identification-terminal
91 javac javaAccuracyCalculator.java
92 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
93 #Classifiers
94 echo "Successfuly Compiled, running classifer now..."
95 ./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MU morphology log-EndToEnd/$location/log-morph-MU.txt
96 ./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/BK morphology log-EndToEnd/$location/log-morph-BK.txt
97 ./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MP morphology log-EndToEnd/$location/log-morph-MP.txt
98 ./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/SE morphology log-EndToEnd/$location/log-morph-SE.txt
99 #Results
100 echo "Successfuly Classified, writing results now..."
101 mkdir log-EndToEnd/$location/
102 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
103 date >> log-EndToEnd/$location/results.txt
104 echo >> log-EndToEnd/$location/results.txt
105 #echo "" >> log-EndToEnd/$location/results.txt
106 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt
107 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-MU.txt morph-MU log-EndToEnd/$location/results.txt
108 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-BK.txt morph-BK log-EndToEnd/$location/results.txt
109 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-MP.txt morph-MP log-EndToEnd/$location/results.txt
110 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-SE.txt morph-SE log-EndToEnd/$location/results.txt
111 .././calculateCorpusAccuracy.sh
112 less log-EndToEnd/$location/results.txt
113 exit $?
114fi
115
116#Cluster - No args
117
118if [ $type == "cluster" ] ; then
119
120 if [ $# != 2 ] ; then
121 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory>"
122 exit 1
123 fi
124 location=$2
125 #Compile
126 echo "Compiling java programs..."
127 cd image-identification-terminal
128 javac javaAccuracyCalculator.java
129 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
130 #Classifiers
131 echo "Successfuly Compiled, running classifer now..."
132 #./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MU cluster log-EndToEnd/$location/log-cluster-MU.txt
133 #./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/BK cluster log-EndToEnd/$location/log-cluster-BK.txt
134 #./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MP cluster log-EndToEnd/$location/log-cluster-MP.txt
135 #./runClassiferV02.sh -all /Scratch/cpb16/is-sheet-music-encore/hires-download-images/SE cluster log-EndToEnd/$location/log-cluster-SE.txt
136 #Results
137 echo "Successfuly Classified, writing results now..."
138 mkdir log-EndToEnd/$location/
139 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
140 date >> log-EndToEnd/$location/results.txt
141 echo >> log-EndToEnd/$location/results.txt
142 #echo "" >> log-EndToEnd/$location/results.txt
143 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt
144 #java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-MU.txt cluster-MU log-EndToEnd/$location/results.txt
145 #java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-BK.txt cluster-BK log-EndToEnd/$location/results.txt
146 #java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-MP.txt cluster-MP log-EndToEnd/$location/results.txt
147 #java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-SE.txt cluster-SE log-EndToEnd/$location/results.txt
148 .././calculateCorpusAccuracy.sh
149 less log-EndToEnd/$location/results.txt
150 exit $?
151fi
152
153#Morphology - Border Args -Corpus - No Map
154
155if [ $type == "morph-border" ] ; then
156 if [ $# != 3 ] ; then
157 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory> <borderIgnoreAmount> "
158 exit 1
159 fi
160 location=$2
161 borderIgnoreAmount=$3
162 cd image-identification-terminal
163 mkdir log-EndToEnd/$location/
164 #Delete files if exists
165 if [ -d log-EndToEnd/$location ] ; then
166 echo "removing folder logEndToEnd/$location"
167 rm -r log-EndToEnd/$location/
168 mkdir log-EndToEnd/$location/
169 fi
170
171 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
172 echo "Start Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
173 echo >> log-EndToEnd/$location/results.txt #Add Space
174 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt #Add config
175 echo $'ARGUEMENT DETAILS: \n' >> log-EndToEnd/$location/results.txt
176 echo "borderIgnoreAmount: $borderIgnoreAmount. That is to say that outer $borderIgnoreAmount% of the image was not considered by the algorithm." >> log-EndToEnd/$location/results.txt
177 echo "[NYI]" >> log-EndToEnd/$location/results.txt
178 echo >> log-EndToEnd/$location/results.txt #Space
179
180 #Compile
181 echo "Compiling java programs..."
182 javac javaAccuracyCalculator.java
183 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
184
185 #Classifiers
186 echo "Successfuly Compiled, running classifer now..."
187 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MU morphology log-EndToEnd/$location/log-morph-MU.txt $borderIgnoreAmount
188 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/BK morphology log-EndToEnd/$location/log-morph-BK.txt $borderIgnoreAmount
189 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/SE morphology log-EndToEnd/$location/log-morph-SE.txt $borderIgnoreAmount
190
191 #Accuracy Calculation
192 echo "Successfuly Classified, writing results now..."
193 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-MU.txt morph-MU log-EndToEnd/$location/results.txt
194 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-BK.txt morph-BK log-EndToEnd/$location/results.txt
195 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-SE.txt morph-SE log-EndToEnd/$location/results.txt
196 echo >>log-EndToEnd/$location/results.txt
197 echo "End Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
198 #.././calculateCorpusAccuracy.sh
199
200 #less log-EndToEnd/$location/results.txt
201 exit $?
202fi
203
204#HoughTransform - Cluster Args -Corpus - No Map
205
206if [ $type == "cluster-border" ] ; then
207 if [ $# != 3 ] ; then
208 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory> <borderIgnoreAmount> "
209 exit 1
210 fi
211 location=$2
212 borderIgnoreAmount=$3
213 cd image-identification-terminal
214 mkdir log-EndToEnd/$location/
215 #Delete files if exists
216 if [ -d log-EndToEnd/$location ] ; then
217 echo "removing folder logEndToEnd/$location"
218 rm -r log-EndToEnd/$location/
219 mkdir log-EndToEnd/$location/
220 fi
221
222 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
223 echo "Start Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
224 echo >> log-EndToEnd/$location/results.txt #Add Space
225 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt #Add config
226 echo $'ARGUEMENT DETAILS: \n' >> log-EndToEnd/$location/results.txt
227 echo "borderIgnoreAmount: $borderIgnoreAmount. That is to say that outer $borderIgnoreAmount% of the image was not considered by the algorithm." >> log-EndToEnd/$location/results.txt
228 echo "[NYI]" >> log-EndToEnd/$location/results.txt
229 echo >> log-EndToEnd/$location/results.txt #Space
230
231 #Compile
232 echo "Compiling java programs..."
233 javac javaAccuracyCalculator.java
234 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
235
236 #Classifiers
237 echo "Successfuly Compiled, running classifer now..."
238 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MU cluster log-EndToEnd/$location/log-cluster-MU.txt $borderIgnoreAmount
239 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/BK cluster log-EndToEnd/$location/log-cluster-BK.txt $borderIgnoreAmount
240 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/SE cluster log-EndToEnd/$location/log-cluster-SE.txt $borderIgnoreAmount
241
242 #Accuracy Calculation
243 echo "Successfuly Classified, writing results now..."
244 java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-MU.txt cluster-MU log-EndToEnd/$location/results.txt
245 java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-BK.txt cluster-BK log-EndToEnd/$location/results.txt
246 java javaAccuracyCalculator log-EndToEnd/$location/log-cluster-SE.txt cluster-SE log-EndToEnd/$location/results.txt
247 echo >>log-EndToEnd/$location/results.txt
248 echo "End Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
249 #.././calculateCorpusAccuracy.sh
250
251 #less log-EndToEnd/$location/results.txt
252 exit $?
253fi
254
255
256
257#HoughTransform - Count Args -Corpus - No Map
258
259if [ $type == "count-border" ] ; then
260 if [ $# != 3 ] ; then
261 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory> <borderIgnoreAmount> "
262 exit 1
263 fi
264 location=$2
265 borderIgnoreAmount=$3
266 cd image-identification-terminal
267 mkdir log-EndToEnd/$location/
268 #Delete files if exists
269 if [ -d log-EndToEnd/$location ] ; then
270 echo "removing folder logEndToEnd/$location"
271 rm -r log-EndToEnd/$location/
272 mkdir log-EndToEnd/$location/
273 fi
274
275 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
276 echo "Start Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
277 echo >> log-EndToEnd/$location/results.txt #Add Space
278 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt #Add config
279 echo $'ARGUEMENT DETAILS: \n' >> log-EndToEnd/$location/results.txt
280 echo "borderIgnoreAmount: $borderIgnoreAmount. That is to say that outer $borderIgnoreAmount% of the image was not considered by the algorithm." >> log-EndToEnd/$location/results.txt
281 echo "[NYI]" >> log-EndToEnd/$location/results.txt
282 echo >> log-EndToEnd/$location/results.txt #Space
283
284 #Compile
285 echo "Compiling java programs..."
286 javac javaAccuracyCalculator.java
287 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
288
289 #Classifiers
290 echo "Successfuly Compiled, running classifer now..."
291 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MU count log-EndToEnd/$location/log-count-MU.txt $borderIgnoreAmount
292 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/BK count log-EndToEnd/$location/log-count-BK.txt $borderIgnoreAmount
293 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/SE count log-EndToEnd/$location/log-count-SE.txt $borderIgnoreAmount
294
295 #Accuracy Calculation
296 echo "Successfuly Classified, writing results now..."
297 java javaAccuracyCalculator log-EndToEnd/$location/log-count-MU.txt count-MU log-EndToEnd/$location/results.txt
298 java javaAccuracyCalculator log-EndToEnd/$location/log-count-BK.txt count-BK log-EndToEnd/$location/results.txt
299 java javaAccuracyCalculator log-EndToEnd/$location/log-count-SE.txt count-SE log-EndToEnd/$location/results.txt
300 echo >>log-EndToEnd/$location/results.txt
301 echo "End Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
302 #.././calculateCorpusAccuracy.sh
303
304 #less log-EndToEnd/$location/results.txt
305 exit $?
306fi
307
308
309
310
311
312#Map SCRIPT
313
314if [ $type == "map-hough-morph" ] ; then
315 if [ $# != 3 ] ; then
316 echo "Usage:./EndToEndSystem <ClassifierType> <ResultSubDirectory> <borderIgnoreAmount> "
317 exit 1
318 fi
319 location=$2
320 borderIgnoreAmount=$3
321 cd image-identification-terminal
322 mkdir log-EndToEnd/$location/
323 #Delete files if exists
324 if [ -d log-EndToEnd/$location ] ; then
325 echo "removing folder logEndToEnd/$location"
326 rm -r log-EndToEnd/$location/
327 mkdir log-EndToEnd/$location/
328 fi
329
330 echo $'\n***********************************************\n' >> log-EndToEnd/$location/results.txt
331 echo "Start Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
332 echo >> log-EndToEnd/$location/results.txt #Add Space
333 cat configClassifierComparison.properties >> log-EndToEnd/$location/results.txt #Add config
334 echo $'ARGUEMENT DETAILS: \n' >> log-EndToEnd/$location/results.txt
335 echo "borderIgnoreAmount: $borderIgnoreAmount. That is to say that outer $borderIgnoreAmount% of the image was not considered by the algorithm." >> log-EndToEnd/$location/results.txt
336 echo "[NYI]" >> log-EndToEnd/$location/results.txt
337 echo >> log-EndToEnd/$location/results.txt
338
339 #Compile
340 echo "Compiling java programs..."
341 javac javaAccuracyCalculator.java
342 javac -cp /Scratch/cpb16/opencv-3.4.2/build/bin/opencv-342.jar javaClassifierComparison.java;
343
344 #Classifiers
345 echo "Successfuly Compiled, running classifer now..."
346 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MP count log-EndToEnd/$location/log-count-MP.txt $borderIgnoreAmount
347 ./runClassiferV02.sh -borderAll /Scratch/cpb16/is-sheet-music-encore/hires-download-images/MP morphology log-EndToEnd/$location/log-morph-MP.txt $borderIgnoreAmount
348
349 #Accuracy Calculation
350 echo "Successfuly Classified, writing results now..."
351 java javaAccuracyCalculator log-EndToEnd/$location/log-count-MP.txt count-MP log-EndToEnd/$location/results.txt
352 java javaAccuracyCalculator log-EndToEnd/$location/log-morph-MP.txt morph-MP log-EndToEnd/$location/results.txt
353
354 echo >>log-EndToEnd/$location/results.txt
355 echo "End Time: $(date +"%T")" >> log-EndToEnd/$location/results.txt #Add End Time
356 #.././calculateCorpusAccuracy.sh
357
358 #less log-EndToEnd/$location/results.txt
359 exit $?
360fi
361
362
363
364
365
366
367#****************************************************************************************************
368#Downloader Scripts
369#****************************************************************************************************
370
371#****************************************************************************************************
372#End of the line
373echo "unknown command, please try again, or type './EndToEndSystem --help'"
374exit 1
Note: See TracBrowser for help on using the repository browser.