Skip to content

Commit 26450a3

Browse files
committed
add comments
1 parent 8e3983c commit 26450a3

5 files changed

+846
-7
lines changed

q1_database_statistics.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
'''
2+
3+
dumps out some statistics for the fonts.zip database and
4+
makes plots, saved in files, of characters for each fontVariant found in
5+
the database
6+
27
Created on Jul 25, 2016
38
@author: richard
49
'''

q2_tensorflow_mnist.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import numpy as np
3333
import pandas as pd
3434

35-
35+
import tensorflow as tf
36+
#with tf.device('/gpu:0'):
37+
#with tf.device('/cpu:0'):
3638
def train_a_font(input_filters_dict,output_feature_list, nEpochs=5000):
3739

3840
ds = ocr_utils.read_data(input_filters_dict = input_filters_dict,
@@ -47,7 +49,7 @@ def train_a_font(input_filters_dict,output_feature_list, nEpochs=5000):
4749
4850
"""# ==============================================================================
4951

50-
import tensorflow as tf
52+
5153
sess = tf.InteractiveSession()
5254

5355
"""# ==============================================================================
@@ -243,7 +245,7 @@ def max_pool_2x2(x):
243245
for i in range(4):
244246
tm += str(tp[i])+'-'
245247
tm += str(tp[4])
246-
writer = tf.train.SummaryWriter("/tmp/ds_logs/"+ tm, sess.graph_def)
248+
writer = tf.train.SummaryWriter("/tmp/ds_logs/"+ tm, sess.graph)
247249

248250
# To see the results in Chrome,
249251
# Run the following in terminal to activate server.
@@ -338,7 +340,7 @@ def computeSize(s,tens):
338340
# input_filters_dict = {'font': ('OCRA','OCRB'), 'fontVariant':('scanned',)}
339341

340342
# select everything; all fonts , font variants, etc.
341-
# input_filters_dict = {}
343+
input_filters_dict = {}
342344

343345
# select the digits 0 through 9 in the E13B font
344346
# input_filters_dict = {'m_label': range(48,58), 'font': 'E13B'}
@@ -356,9 +358,9 @@ def computeSize(s,tens):
356358
#output_feature_list = ['font_one_hot','image','italic','aspect_ratio','upper_case']
357359

358360
# train the digits 0-9 for all fonts
359-
input_filters_dict = {'m_label': range(48,58)}
361+
#input_filters_dict = {'m_label': range(48,58)}
360362
output_feature_list = ['m_label_one_hot','image','italic','aspect_ratio','upper_case']
361-
train_a_font(input_filters_dict, output_feature_list, nEpochs = 5000)
363+
train_a_font(input_filters_dict, output_feature_list, nEpochs = 50000)
362364

363365
else:
364366
# loop through all the fonts and train individually
@@ -377,6 +379,6 @@ def computeSize(s,tens):
377379
input_filters_dict= {'font': (l[0],)}
378380
train_a_font(input_filters_dict,output_feature_list, nEpochs = 500)
379381

380-
382+
381383
print ('\n########################### No Errors ####################################')
382384

0 commit comments

Comments
 (0)