Commit 3c92f0cd authored by Marius Kriegerowski's avatar Marius Kriegerowski

mean=0.5 random init

parent 6a1b2260
......@@ -79,16 +79,14 @@ class DataGenerator(Object):
When working with noisy data, replace this function.
'''
stencil = num.zeros(self.tensor_shape, dtype=num.float32)
if self.noise is not None:
stencil += self.noise.get_chunk(*self.tensor_shape)
return stencil
def attach_graph(self, node):
def attach_graph(self, dataset, shape):
'''
Use this method to attach any preprocessing to be done in tensorflow
graph.
'''
return node
return dataset
def regularize_deltat(self, tr):
'''Equalize sampling rates accross the data set according to sampling rate
......@@ -210,6 +208,10 @@ class PileData(DataGenerator):
chunk = self.get_raw_data_chunk()
indices = [nslc_to_index[tr.nslc_id] for tr in trs]
self.fit_data_into_chunk(trs, chunk, indices=indices, tref=m.tmin)
if self.noise is not None:
chunk += self.noise.get_chunk(*self.tensor_shape)
yield chunk, self.extract_labels(event)
......@@ -275,5 +277,9 @@ class OnTheFlyData(DataGenerator):
for isource, source in enumerate(response.request.sources):
chunk = self.make_data_chunk(source, response.results_list[isource])
if self.noise is not None:
chunk += self.noise.get_chunk(*self.tensor_shape)
yield chunk, self.extract_labels(source)
......@@ -45,7 +45,7 @@ class Model(Object):
self.data_generator.generate_output_types,
output_shapes=shape)
dataset = self.data_generator.attach_graph(dataset)
dataset = self.data_generator.attach_graph(dataset, shape)
dataset = dataset.batch(self.batch_size)
dataset = dataset.repeat()
......@@ -67,7 +67,7 @@ class Model(Object):
with tf.variable_scope('conv_layer%s' %name):
# initializer = tf.truncated_normal_initializer(
initializer = tf.random_normal_initializer(
mean=0, stddev=0.1)
mean=0.5, stddev=0.1)
input = tf.layers.conv2d(
inputs=input,
......
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