-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit des modifs sur le GUI de ce matin + rajout Egoshare_5_TestPerf.py
- Loading branch information
remi.paucher
committed
Feb 24, 2009
1 parent
e6640e5
commit 7a2dc2f
Showing
3 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!coding: utf-8 | ||
from Break_Egoshare_Captcha import * | ||
|
||
MODEL_FOLDER = 'Egoshare/Models' | ||
MODEL_FILES = ['simulation_based_C=1000_KERNEL=1.svm'] | ||
TEST_FOLDER = 'Egoshare/DBTest-Captcha_based' | ||
|
||
try: | ||
print MODEL_FILE | ||
except: | ||
pass | ||
else: | ||
MODEL_FILES = [MODEL_FILE] | ||
|
||
set_files_errors = set([]) | ||
|
||
for MODEL_FILE in MODEL_FILES: | ||
model = load_model(os.path.join(MODEL_FOLDER, MODEL_FILE)) | ||
|
||
nbs = 0 | ||
errors = 0 | ||
for folder, subfolders, files in os.walk(TEST_FOLDER): | ||
if (folder[0] != "."): | ||
loaded = False | ||
for file in [file for file in files if 'bmp' in file]: | ||
if not loaded: | ||
print "Testing on ", folder | ||
loaded = True | ||
|
||
im = Image.open(os.path.join(folder, file)) | ||
im = im.point(lambda e : e/255) | ||
|
||
char, max_score, scores = predict(model, im) | ||
|
||
if char == folder[-1]: | ||
#print "SUCCESS" | ||
pass | ||
else: | ||
#print "FAILURE" | ||
set_files_errors.add(file.split('number')[0]) | ||
#print "Error: ", char, "detected instead of", folder[-1] | ||
nbs += 1 | ||
|
||
|
||
nb_errors = len(set_files_errors) | ||
nb_captchas_tested = nbs/3 | ||
print "\tSuccess rate: ", (1 - (1.*nb_errors/nb_captchas_tested))*100, "%" | ||
write(MODEL_FILE + '\t' + str((1 - (1.*nb_errors/nb_captchas_tested))*100) + "%") | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters