示例#1
0
std = params_appliance[application]['std']
sess = tf.InteractiveSession()

windowlength = params_appliance[args.appliance_name]['windowlength']

offset = int(0.5 * (params_appliance[application]['windowlength'] - 1.0))

test_kwag = {'inputs': test_set_x, 'targets': ground_truth, 'flatten': False}

# val_kwag = {
#     'inputs': val_set_x,
#     'targets': val_set_y,
#     'flatten':False}

test_provider = DataProvider.MultiApp_Slider(batchsize=batchsize,
                                             shuffle=False,
                                             offset=offset)
# val_provider = DataProvider.DoubleSourceSlider(batchsize = 5000,
#                                                  shuffle = False, offset=offset)

x = tf.placeholder(tf.float32, shape=[None, windowlength], name='x')
y_ = tf.placeholder(tf.float32, shape=[None, 1], name='y_')

##### cnn2
network = tl.layers.InputLayer(x, name='input_layer')
network = tl.layers.ReshapeLayer(network, shape=(-1, windowlength, 1, 1))
network = tl.layers.Conv2dLayer(network,
                                act=tf.nn.relu,
                                shape=[10, 1, 1, 30],
                                strides=[1, 1, 1, 1],
                                padding='SAME',
示例#2
0
# load the data set
tra_set_x, tra_set_y, val_set_x, val_set_y = load_dataset()

# get the window length of the training examples
windowlength = 599

sess = tf.InteractiveSession()

offset = int(0.5 * (windowlength - 1.0))

tra_kwag = {'inputs': tra_set_x, 'targets': tra_set_y, 'flatten': False}

val_kwag = {'inputs': val_set_x, 'targets': val_set_y, 'flatten': False}

tra_provider = DataProvider.MultiApp_Slider(batchsize=batchsize,
                                            shuffle=True,
                                            offset=offset)
val_provider = DataProvider.MultiApp_Slider(batchsize=5000,
                                            shuffle=False,
                                            offset=offset)

x = tf.placeholder(tf.float32, shape=[None, windowlength], name='x')
y_ = tf.placeholder(tf.float32, shape=[None, 6], name='y_')

network = tl.layers.InputLayer(x, name='input_layer')
network = tl.layers.ReshapeLayer(network, shape=(-1, windowlength, 1, 1))
network = tl.layers.Conv2dLayer(network,
                                act=tf.nn.relu,
                                shape=[10, 1, 1, 30],
                                strides=[1, 1, 1, 1],
                                padding='SAME',