Commit 06246989 authored by Taddeus Kroes's avatar Taddeus Kroes

Pretiffied a print statement and tested run_classifier script.

parent 79884e9a
...@@ -21,6 +21,8 @@ def load_characters(neighbours, blur_scale, verbose=0): ...@@ -21,6 +21,8 @@ def load_characters(neighbours, blur_scale, verbose=0):
chars = [] chars = []
for char in sorted(listdir(IMAGES_FOLDER)): for char in sorted(listdir(IMAGES_FOLDER)):
count = 0
for image in sorted(listdir(IMAGES_FOLDER + char)): for image in sorted(listdir(IMAGES_FOLDER + char)):
image = GrayscaleImage(IMAGES_FOLDER + char + '/' + image) image = GrayscaleImage(IMAGES_FOLDER + char + '/' + image)
norm = NormalizedCharacterImage(image, blur=blur_scale, \ norm = NormalizedCharacterImage(image, blur=blur_scale, \
...@@ -29,8 +31,10 @@ def load_characters(neighbours, blur_scale, verbose=0): ...@@ -29,8 +31,10 @@ def load_characters(neighbours, blur_scale, verbose=0):
character.get_single_cell_feature_vector(neighbours) character.get_single_cell_feature_vector(neighbours)
chars.append(character) chars.append(character)
count += 1
if verbose: if verbose:
print 'Loaded character %s' % char print 'Loaded character %s %d times' % (char, count)
if verbose: if verbose:
print 'Saving characters...' print 'Saving characters...'
......
...@@ -7,14 +7,20 @@ from create_characters import load_test_set ...@@ -7,14 +7,20 @@ from create_characters import load_test_set
from create_classifier import load_classifier from create_classifier import load_classifier
if len(argv) < 3: if len(argv) < 3:
print 'Usage: python %s NEIGHBOURS BLUR_SCALE' % argv[0] print 'Usage: python %s NEIGHBOURS BLUR_SCALE [ C GAMMA ]' % argv[0]
exit(1) exit(1)
neighbours = int(argv[1]) neighbours = int(argv[1])
blur_scale = float(argv[2]) blur_scale = float(argv[2])
# Load classifier # Load classifier
classifier = load_classifier(neighbours, blur_scale, verbose=1) if len(argv) > 4:
c = float(argv[3])
gamma = float(argv[4])
classifier = load_classifier(neighbours, blur_scale, c=c, gamma=gamma, \
verbose=1)
else:
classifier = load_classifier(neighbours, blur_scale, verbose=1)
# Load test set # Load test set
test_set = load_test_set(neighbours, blur_scale, verbose=1) test_set = load_test_set(neighbours, blur_scale, verbose=1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment