Skip to content

Commit

Permalink
Running 3 convolutional layer neural network and applying stronger mu…
Browse files Browse the repository at this point in the history
…ltiprocessing.
  • Loading branch information
daniel-muthukrishna committed May 13, 2018
1 parent 2ce83eb commit cefed8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions dash/deep_learning_multilayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ def train_model(dataDirName, overwrite=False):
a = []
x, y_, keep_prob, y_conv = convnet_variables(imWidth, imWidthReduc, N, nLabels)

with tf.Session() as sess: # config=tf.ConfigProto(inter_op_parallelism_threads=1, intra_op_parallelism_threads=1)) as sess:
config = tf.ConfigProto()
config.intra_op_parallelism_threads = 44
config.inter_op_parallelism_threads = 44

with tf.Session(config=config) as sess: # config=tf.ConfigProto(inter_op_parallelism_threads=1, intra_op_parallelism_threads=1)) as sess:
# TRAIN AND EVALUATE MODEL
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y_conv + 1e-8), reduction_indices=[1]))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
Expand Down Expand Up @@ -144,7 +148,7 @@ def train_model(dataDirName, overwrite=False):

if __name__ == '__main__':
t1 = time.time()
savedFilenames = train_model('data_files/', overwrite=False)
savedFilenames = train_model('data_files_zeroZ/', overwrite=False)
t2 = time.time()
print("time spent: {0:.2f}".format(t2 - t1))

2 changes: 1 addition & 1 deletion dash/multilayer_convnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def convnet_variables(imWidth, imWidthReduc, N, ntypes):
h_fc2 = Layer3.connect_layers(h_pool3, 64, 2)

# READOUT LAYER
keep_prob, h_fc2_drop = Layer3.dropout(h_fc1)
keep_prob, h_fc2_drop = Layer3.dropout(h_fc2)
W_fc3, b_fc3 = Layer3.readout_layer()
y_conv = tf.nn.softmax(tf.matmul(h_fc2_drop, W_fc3) + b_fc3)

Expand Down

0 comments on commit cefed8f

Please sign in to comment.