Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
licenseplates
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Taddeüs Kroes
licenseplates
Commits
0a4ff955
Commit
0a4ff955
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added image normalization to performance measuring script.
parent
1d2ae333
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test_performance.py
+33
-7
33 additions, 7 deletions
src/test_performance.py
with
33 additions
and
7 deletions
src/test_performance.py
+
33
−
7
View file @
0a4ff955
#!/usr/bin/python
from
os
import
listdir
from
cPickle
import
load
from
sys
import
argv
,
exit
from
time
import
time
from
GrayscaleImage
import
GrayscaleImage
from
NormalizedCharacterImage
import
NormalizedCharacterImage
from
Character
import
Character
from
Classifier
import
Classifier
if
len
(
argv
)
<
4
:
...
...
@@ -14,17 +18,37 @@ blur_scale = float(argv[2])
count
=
int
(
argv
[
3
])
suffix
=
'
_%s_%s
'
%
(
blur_scale
,
neighbours
)
chars_file
=
'
characters%s.dat
'
%
suffix
#
chars_file = 'characters%s.dat' % suffix
classifier_file
=
'
classifier%s.dat
'
%
suffix
print
'
Loading characters...
'
chars
=
load
(
open
(
chars_file
,
'
r
'
))[:
count
]
count
=
len
(
chars
)
#print 'Loading characters...'
#chars = load(open(chars_file, 'r'))[:count]
#count = len(chars)
#
#for char in chars:
# del char.feature
#
#print 'Read %d characters' % count
for
char
in
chars
:
del
char
.
feature
print
'
Loading %d characters...
'
%
count
chars
=
[]
i
=
0
br
=
False
for
value
in
sorted
(
listdir
(
'
../images/LearningSet
'
)):
for
image
in
sorted
(
listdir
(
'
../images/LearningSet/
'
+
value
)):
f
=
'
../images/LearningSet/
'
+
value
+
'
/
'
+
image
image
=
GrayscaleImage
(
f
)
char
=
Character
(
value
,
[],
image
)
chars
.
append
(
char
)
i
+=
1
if
i
==
count
:
br
=
True
break
print
'
Read %d characters
'
%
count
if
br
:
break
print
'
Loading classifier...
'
classifier
=
Classifier
(
filename
=
classifier_file
)
...
...
@@ -33,6 +57,8 @@ classifier.neighbours = neighbours
start
=
time
()
for
char
in
chars
:
char
.
image
=
NormalizedCharacterImage
(
image
,
blur
=
blur_scale
,
height
=
42
)
char
.
get_single_cell_feature_vector
(
neighbours
)
classifier
.
classify
(
char
)
elapsed
=
time
()
-
start
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment