Skip to content

Commit

Permalink
Commit des modifs sur le GUI de ce matin + rajout Egoshare_5_TestPerf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
remi.paucher committed Feb 24, 2009
1 parent e6640e5 commit 7a2dc2f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 5 deletions.
20 changes: 17 additions & 3 deletions Egoshare_4_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def OnLaunch(self, evt):
return
if not self.model_selected:
wx.MessageBox("Selectionner le modele SVM !", "Donnee manquante")
#return
return

thread.start_new_thread(Break_Egoshare_Captcha.break_captcha,
(self.model, self.letter1_algo, self.letter2_algo, self.letter3_algo, self))
Expand All @@ -272,7 +272,12 @@ def OnSelectModel(self, evt):

if retour == wx.ID_OK and fichier != "":
self.model = Break_Egoshare_Captcha.load_model(self.chemin, self, fichier)
self.Update()
self.Update()

if self.captcha_selected and self.model_selected:
#Lancement du calcul
self.OnLaunch(None)




Expand All @@ -292,7 +297,16 @@ def OnSelectCaptcha(self, evt):
self.setThumbs(self.letter1, self.letter2, self.letter3)
self.captcha_selected = True
self.setResults("", "", "", "", "", "")
self.Update()

self.Update()

if self.captcha_selected and self.model_selected:
#Lancement du calcul
self.OnLaunch(None)




###############################################################################
###############################################################################

Expand Down
55 changes: 55 additions & 0 deletions Egoshare_5_TestPerf.py
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, "%"
print
write(MODEL_FILE + '\t' + str((1 - (1.*nb_errors/nb_captchas_tested))*100) + "%")






3 changes: 1 addition & 2 deletions characters_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
TRAINING_FOLDER = "Egoshare/DBTraining-Simulation_based"

for folder, subfolders, files in os.walk(TRAINING_FOLDER):
loaded = False


print folder

if os.name == "nt":
Expand Down

0 comments on commit 7a2dc2f

Please sign in to comment.