Python tflearn.layers.conv.conv_2d() Examples
The following are 30
code examples of tflearn.layers.conv.conv_2d().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tflearn.layers.conv
, or try the search function
.
Example #1
Source File: models.py From pygta5 with GNU General Public License v3.0 | 8 votes |
def resnext(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): net = input_data(shape=[None, width, height, 3], name='input') net = tflearn.conv_2d(net, 16, 3, regularizer='L2', weight_decay=0.0001) net = tflearn.layers.conv.resnext_block(net, n, 16, 32) net = tflearn.resnext_block(net, 1, 32, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 32, 32) net = tflearn.resnext_block(net, 1, 64, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 64, 32) net = tflearn.batch_normalization(net) net = tflearn.activation(net, 'relu') net = tflearn.global_avg_pool(net) # Regression net = tflearn.fully_connected(net, output, activation='softmax') opt = tflearn.Momentum(0.1, lr_decay=0.1, decay_step=32000, staircase=True) net = tflearn.regression(net, optimizer=opt, loss='categorical_crossentropy') model = tflearn.DNN(net, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #2
Source File: inceptionVxOnFire.py From fire-detection-cnn with MIT License | 6 votes |
def reduction_block_a(reduction_input_a): reduction_a_conv1_1_1 = conv_2d(reduction_input_a,384,3,strides=2,padding='valid',activation='relu',name='reduction_a_conv1_1_1') reduction_a_conv2_1_1 = conv_2d(reduction_input_a,192,1,activation='relu',name='reduction_a_conv2_1_1') reduction_a_conv2_3_3 = conv_2d(reduction_a_conv2_1_1,224,3,activation='relu',name='reduction_a_conv2_3_3') reduction_a_conv2_3_3_s2 = conv_2d(reduction_a_conv2_3_3,256,3,strides=2,padding='valid',activation='relu',name='reduction_a_conv2_3_3_s2') reduction_a_pool = max_pool_2d(reduction_input_a,strides=2,padding='valid',kernel_size=3,name='reduction_a_pool') # merge reduction_a reduction_a = merge([reduction_a_conv1_1_1,reduction_a_conv2_3_3_s2,reduction_a_pool],mode='concat',axis=3) return reduction_a ################################################################################ # InceptionV4 : definition of inception_block_b
Example #3
Source File: models.py From pygta5 with GNU General Public License v3.0 | 6 votes |
def resnext(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): net = input_data(shape=[None, width, height, 3], name='input') net = tflearn.conv_2d(net, 16, 3, regularizer='L2', weight_decay=0.0001) net = tflearn.layers.conv.resnext_block(net, n, 16, 32) net = tflearn.resnext_block(net, 1, 32, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 32, 32) net = tflearn.resnext_block(net, 1, 64, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 64, 32) net = tflearn.batch_normalization(net) net = tflearn.activation(net, 'relu') net = tflearn.global_avg_pool(net) # Regression net = tflearn.fully_connected(net, output, activation='softmax') opt = tflearn.Momentum(0.1, lr_decay=0.1, decay_step=32000, staircase=True) net = tflearn.regression(net, optimizer=opt, loss='categorical_crossentropy') model = tflearn.DNN(net, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #4
Source File: em_model.py From Emotion-recognition-and-prediction with Apache License 2.0 | 6 votes |
def build_network(self): print("---> Starting Neural Network") self.network = input_data(shape = [None, 48, 48, 1]) self.network = conv_2d(self.network, 64, 5, activation = 'relu') self.network = max_pool_2d(self.network, 3, strides = 2) self.network = conv_2d(self.network, 64, 5, activation = 'relu') self.network = max_pool_2d(self.network, 3, strides = 2) self.network = conv_2d(self.network, 128, 4, activation = 'relu') self.network = dropout(self.network, 0.3) self.network = fully_connected(self.network, 3072, activation = 'relu') self.network = fully_connected(self.network, len(self.target_classes), activation = 'softmax') self.network = regression(self.network, optimizer = 'momentum', loss = 'categorical_crossentropy') self.model = tflearn.DNN( self.network, checkpoint_path = 'model_1_nimish', max_checkpoints = 1, tensorboard_verbose = 2 ) self.load_model()
Example #5
Source File: models.py From pygta5 with GNU General Public License v3.0 | 6 votes |
def resnext(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): net = input_data(shape=[None, width, height, 3], name='input') net = tflearn.conv_2d(net, 16, 3, regularizer='L2', weight_decay=0.0001) net = tflearn.layers.conv.resnext_block(net, n, 16, 32) net = tflearn.resnext_block(net, 1, 32, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 32, 32) net = tflearn.resnext_block(net, 1, 64, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 64, 32) net = tflearn.batch_normalization(net) net = tflearn.activation(net, 'relu') net = tflearn.global_avg_pool(net) # Regression net = tflearn.fully_connected(net, output, activation='softmax') opt = tflearn.Momentum(0.1, lr_decay=0.1, decay_step=32000, staircase=True) net = tflearn.regression(net, optimizer=opt, loss='categorical_crossentropy') model = tflearn.DNN(net, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #6
Source File: inception_resnet_v2.py From FRU with MIT License | 6 votes |
def block35(net, scale=1.0, activation="relu"): tower_conv = relu(batch_normalization(conv_2d(net, 32, 1, bias=False, activation=None, name='Conv2d_1x1'))) tower_conv1_0 = relu(batch_normalization(conv_2d(net, 32, 1, bias=False, activation=None,name='Conv2d_0a_1x1'))) tower_conv1_1 = relu(batch_normalization(conv_2d(tower_conv1_0, 32, 3, bias=False, activation=None,name='Conv2d_0b_3x3'))) tower_conv2_0 = relu(batch_normalization(conv_2d(net, 32, 1, bias=False, activation=None, name='Conv2d_0a_1x1'))) tower_conv2_1 = relu(batch_normalization(conv_2d(tower_conv2_0, 48,3, bias=False, activation=None, name='Conv2d_0b_3x3'))) tower_conv2_2 = relu(batch_normalization(conv_2d(tower_conv2_1, 64,3, bias=False, activation=None, name='Conv2d_0c_3x3'))) tower_mixed = merge([tower_conv, tower_conv1_1, tower_conv2_2], mode='concat', axis=3) tower_out = relu(batch_normalization(conv_2d(tower_mixed, net.get_shape()[3], 1, bias=False, activation=None, name='Conv2d_1x1'))) net += scale * tower_out if activation: if isinstance(activation, str): net = activations.get(activation)(net) elif hasattr(activation, '__call__'): net = activation(net) else: raise ValueError("Invalid Activation.") return net
Example #7
Source File: inception_resnet_v2.py From FRU with MIT License | 6 votes |
def block17(net, scale=1.0, activation="relu"): tower_conv = relu(batch_normalization(conv_2d(net, 192, 1, bias=False, activation=None, name='Conv2d_1x1'))) tower_conv_1_0 = relu(batch_normalization(conv_2d(net, 128, 1, bias=False, activation=None, name='Conv2d_0a_1x1'))) tower_conv_1_1 = relu(batch_normalization(conv_2d(tower_conv_1_0, 160,[1,7], bias=False, activation=None,name='Conv2d_0b_1x7'))) tower_conv_1_2 = relu(batch_normalization(conv_2d(tower_conv_1_1, 192, [7,1], bias=False, activation=None,name='Conv2d_0c_7x1'))) tower_mixed = merge([tower_conv,tower_conv_1_2], mode='concat', axis=3) tower_out = relu(batch_normalization(conv_2d(tower_mixed, net.get_shape()[3], 1, bias=False, activation=None, name='Conv2d_1x1'))) net += scale * tower_out if activation: if isinstance(activation, str): net = activations.get(activation)(net) elif hasattr(activation, '__call__'): net = activation(net) else: raise ValueError("Invalid Activation.") return net
Example #8
Source File: inception_resnet_v2.py From FRU with MIT License | 6 votes |
def block8(net, scale=1.0, activation="relu"): tower_conv = relu(batch_normalization(conv_2d(net, 192, 1, bias=False, activation=None, name='Conv2d_1x1'))) tower_conv1_0 = relu(batch_normalization(conv_2d(net, 192, 1, bias=False, activation=None, name='Conv2d_0a_1x1'))) tower_conv1_1 = relu(batch_normalization(conv_2d(tower_conv1_0, 224, [1,3], bias=False, activation=None, name='Conv2d_0b_1x3'))) tower_conv1_2 = relu(batch_normalization(conv_2d(tower_conv1_1, 256, [3,1], bias=False, name='Conv2d_0c_3x1'))) tower_mixed = merge([tower_conv,tower_conv1_2], mode='concat', axis=3) tower_out = relu(batch_normalization(conv_2d(tower_mixed, net.get_shape()[3], 1, bias=False, activation=None, name='Conv2d_1x1'))) net += scale * tower_out if activation: if isinstance(activation, str): net = activations.get(activation)(net) elif hasattr(activation, '__call__'): net = activation(net) else: raise ValueError("Invalid Activation.") return net
Example #9
Source File: models.py From pygta5 with GNU General Public License v3.0 | 6 votes |
def resnext(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): net = input_data(shape=[None, width, height, 3], name='input') net = tflearn.conv_2d(net, 16, 3, regularizer='L2', weight_decay=0.0001) net = tflearn.layers.conv.resnext_block(net, n, 16, 32) net = tflearn.resnext_block(net, 1, 32, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 32, 32) net = tflearn.resnext_block(net, 1, 64, 32, downsample=True) net = tflearn.resnext_block(net, n-1, 64, 32) net = tflearn.batch_normalization(net) net = tflearn.activation(net, 'relu') net = tflearn.global_avg_pool(net) # Regression net = tflearn.fully_connected(net, output, activation='softmax') opt = tflearn.Momentum(0.1, lr_decay=0.1, decay_step=32000, staircase=True) net = tflearn.regression(net, optimizer=opt, loss='categorical_crossentropy') model = tflearn.DNN(net, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #10
Source File: inceptionVxOnFire.py From fire-detection-cnn with MIT License | 6 votes |
def reduction_block_b(reduction_input_b): reduction_b_1_1 = conv_2d(reduction_input_b,192,1,activation='relu',name='reduction_b_1_1') reduction_b_1_3 = conv_2d(reduction_b_1_1,192,3,strides=2,padding='valid',name='reduction_b_1_3') reduction_b_3_3_reduce = conv_2d(reduction_input_b, 256, filter_size=1, activation='relu', name='reduction_b_3_3_reduce') reduction_b_3_3_asym_1 = conv_2d(reduction_b_3_3_reduce, 256, filter_size=[1,7], activation='relu',name='reduction_b_3_3_asym_1') reduction_b_3_3_asym_2 = conv_2d(reduction_b_3_3_asym_1, 320, filter_size=[7,1], activation='relu',name='reduction_b_3_3_asym_2') reduction_b_3_3=conv_2d(reduction_b_3_3_asym_2,320,3,strides=2,activation='relu',padding='valid',name='reduction_b_3_3') reduction_b_pool = max_pool_2d(reduction_input_b,kernel_size=3,strides=2,padding='valid') # merge the reduction_b reduction_b_output = merge([reduction_b_1_3,reduction_b_3_3,reduction_b_pool],mode='concat',axis=3) return reduction_b_output ################################################################################ # InceptionV4 : defintion of inception_block_c
Example #11
Source File: inceptionVxOnFire.py From fire-detection-cnn with MIT License | 6 votes |
def inception_block_a(input_a): inception_a_conv1_1_1 = conv_2d(input_a,96,1,activation='relu',name='inception_a_conv1_1_1') inception_a_conv1_3_3_reduce = conv_2d(input_a,64,1,activation='relu',name='inception_a_conv1_3_3_reduce') inception_a_conv1_3_3 = conv_2d(inception_a_conv1_3_3_reduce,96,3,activation='relu',name='inception_a_conv1_3_3') inception_a_conv2_3_3_reduce = conv_2d(input_a,64,1,activation='relu',name='inception_a_conv2_3_3_reduce') inception_a_conv2_3_3_sym_1 = conv_2d(inception_a_conv2_3_3_reduce,96,3,activation='relu',name='inception_a_conv2_3_3') inception_a_conv2_3_3 = conv_2d(inception_a_conv2_3_3_sym_1,96,3,activation='relu',name='inception_a_conv2_3_3') inception_a_pool = avg_pool_2d(input_a,kernel_size=3,name='inception_a_pool',strides=1) inception_a_pool_1_1 = conv_2d(inception_a_pool,96,1,activation='relu',name='inception_a_pool_1_1') # merge inception_a inception_a = merge([inception_a_conv1_1_1,inception_a_conv1_3_3,inception_a_conv2_3_3,inception_a_pool_1_1],mode='concat',axis=3) return inception_a ################################################################################ # InceptionV4 : definition of reduction_block_a
Example #12
Source File: test_validation_monitors.py From FRU with MIT License | 5 votes |
def test_vbs1(self): with tf.Graph().as_default(): # Data loading and preprocessing import tflearn.datasets.mnist as mnist X, Y, testX, testY = mnist.load_data(one_hot=True) X = X.reshape([-1, 28, 28, 1]) testX = testX.reshape([-1, 28, 28, 1]) X = X[:20, :, :, :] Y = Y[:20, :] testX = testX[:10, :, :, :] testY = testY[:10, :] # Building convolutional network network = input_data(shape=[None, 28, 28, 1], name='input') network = conv_2d(network, 32, 3, activation='relu', regularizer="L2") network = max_pool_2d(network, 2) network = local_response_normalization(network) network = conv_2d(network, 64, 3, activation='relu', regularizer="L2") network = max_pool_2d(network, 2) network = local_response_normalization(network) network = fully_connected(network, 128, activation='tanh') network = dropout(network, 0.8) network = fully_connected(network, 256, activation='tanh') network = dropout(network, 0.8) network = fully_connected(network, 10, activation='softmax') network = regression(network, optimizer='adam', learning_rate=0.01, loss='categorical_crossentropy', name='target') # Training model = tflearn.DNN(network, tensorboard_verbose=3) model.fit({'input': X}, {'target': Y}, n_epoch=1, batch_size=10, validation_set=({'input': testX}, {'target': testY}), validation_batch_size=5, snapshot_step=10, show_metric=True, run_id='convnet_mnist_vbs') self.assertEqual(model.train_ops[0].validation_batch_size, 5) self.assertEqual(model.train_ops[0].batch_size, 10)
Example #13
Source File: layers.py From polar-transformer-networks with MIT License | 5 votes |
def conv_bn_relu(net, nf, fs, scope, padding='same', strides=1, reuse=False, weights_init='variance_scaling', weight_decay=0., activation='relu'): if padding == 'wrap': padding = 'valid' curr = wrap_pad_rows(net, (fs-1)//2) else: curr = net netout = conv_2d(curr, nf, fs, activation='linear', padding=padding, scope=scope, reuse=reuse, strides=[1, strides, strides, 1], weights_init=weights_init, regularizer='L2', weight_decay=weight_decay) netout = batch_normalization(netout, scope=scope, reuse=reuse) netout = getattr(tflearn.activations, activation)(netout) return netout
Example #14
Source File: arch.py From polar-transformer-networks with MIT License | 5 votes |
def pt_regressor(layer_in, flags): net, curr = pt_regressor_conv(layer_in, flags) net['ptreg_in'] = layer_in dims = curr.get_shape().as_list() weights_init = 'zeros' bias_init = tf.ones([1]) # 1x1 conv, no BN, no ReLU on final heatmap net['ptreg_out'], curr = dup(conv_2d(curr, 1, 1, activation='linear', weights_init=weights_init, bias_init=bias_init, padding=flags.pad, name='ptreg_out')) # take the centroid of the feature map s = tf.shape(curr) # compute xc, yc from -1 to 1 xc = tf.tile(tf.linspace(-1., 1., s[2])[np.newaxis, ...], (s[1], 1)) yc = tf.transpose(xc) net['po_j'] = (tf.reduce_sum(curr[..., 0]*xc[np.newaxis, ...], axis=(1, 2)) / tf.reduce_sum(curr[..., 0], axis=(1, 2))) net['po_i'] = (tf.reduce_sum(curr[..., 0]*yc[np.newaxis, ...], axis=(1, 2)) / tf.reduce_sum(curr[..., 0], axis=(1, 2))) net['polar_origin'] = tf.stack([net['po_j'], net['po_i']], axis=1) # origin augmentation if flags.ptreg_aug > 0: dim = layer_in.get_shape().as_list()[1] shift = tf.cond(tflearn.get_training_mode(), lambda: 1./dim * tf.random_uniform([flags.bs, 2], minval=-flags.ptreg_aug, maxval=flags.ptreg_aug), lambda: tf.zeros([flags.bs, 2])) net['polar_origin'] += shift return net
Example #15
Source File: arch.py From polar-transformer-networks with MIT License | 5 votes |
def finalize_conv_from_flags(net, curr, flags): if flags.pad_wrap: curr = layers.wrap_pad_rows(curr) pad = 'valid' # final layer is linear name = 'conv_final' net[name] = conv_2d(curr, flags.nc, flags.filter_size, activation='linear', name=name, padding=pad) return net
Example #16
Source File: single_layer_network.py From DeepOSM with MIT License | 5 votes |
def model_for_type(neural_net_type, tile_size, on_band_count): """The neural_net_type can be: one_layer_relu, one_layer_relu_conv, two_layer_relu_conv.""" network = tflearn.input_data(shape=[None, tile_size, tile_size, on_band_count]) # NN architectures mirror ch. 3 of www.cs.toronto.edu/~vmnih/docs/Mnih_Volodymyr_PhD_Thesis.pdf if neural_net_type == 'one_layer_relu': network = tflearn.fully_connected(network, 64, activation='relu') elif neural_net_type == 'one_layer_relu_conv': network = conv_2d(network, 64, 12, strides=4, activation='relu') network = max_pool_2d(network, 3) elif neural_net_type == 'two_layer_relu_conv': network = conv_2d(network, 64, 12, strides=4, activation='relu') network = max_pool_2d(network, 3) network = conv_2d(network, 128, 4, activation='relu') else: print("ERROR: exiting, unknown layer type for neural net") # classify as road or not road softmax = tflearn.fully_connected(network, 2, activation='softmax') # hyperparameters based on www.cs.toronto.edu/~vmnih/docs/Mnih_Volodymyr_PhD_Thesis.pdf momentum = tflearn.optimizers.Momentum( learning_rate=.005, momentum=0.9, lr_decay=0.0002, name='Momentum') net = tflearn.regression(softmax, optimizer=momentum, loss='categorical_crossentropy') return tflearn.DNN(net, tensorboard_verbose=0)
Example #17
Source File: weights_loading_scope.py From FRU with MIT License | 5 votes |
def make_core_network(network): network = tflearn.reshape(network, [-1, 28, 28, 1], name="reshape") network = conv_2d(network, 32, 3, activation='relu', regularizer="L2") network = max_pool_2d(network, 2) network = local_response_normalization(network) network = conv_2d(network, 64, 3, activation='relu', regularizer="L2") network = max_pool_2d(network, 2) network = local_response_normalization(network) network = fully_connected(network, 128, activation='tanh') network = dropout(network, 0.8) network = fully_connected(network, 256, activation='tanh') network = dropout(network, 0.8) network = fully_connected(network, 10, activation='softmax') return network
Example #18
Source File: emotion_recognition.py From emotion-recognition-neural-networks with MIT License | 5 votes |
def build_network(self): # Smaller 'AlexNet' # https://github.com/tflearn/tflearn/blob/master/examples/images/alexnet.py print('[+] Building CNN') self.network = input_data(shape=[None, SIZE_FACE, SIZE_FACE, 1]) self.network = conv_2d(self.network, 64, 5, activation='relu') #self.network = local_response_normalization(self.network) self.network = max_pool_2d(self.network, 3, strides=2) self.network = conv_2d(self.network, 64, 5, activation='relu') self.network = max_pool_2d(self.network, 3, strides=2) self.network = conv_2d(self.network, 128, 4, activation='relu') self.network = dropout(self.network, 0.3) self.network = fully_connected(self.network, 3072, activation='relu') self.network = fully_connected( self.network, len(EMOTIONS), activation='softmax') self.network = regression( self.network, optimizer='momentum', loss='categorical_crossentropy' ) self.model = tflearn.DNN( self.network, checkpoint_path=SAVE_DIRECTORY + '/emotion_recognition', max_checkpoints=1, tensorboard_verbose=2 ) self.load_model()
Example #19
Source File: alexnet.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet(width, height, lr): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 3, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=2, tensorboard_dir='log') return model
Example #20
Source File: alexnet.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet(width, height, lr): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 3, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #21
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet2(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #22
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def sentnet_color_2d(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): network = input_data(shape=[None, width, height, 3], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #23
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #24
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet2(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #25
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #26
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet2(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #27
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def sentnet_color_2d(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): network = input_data(shape=[None, width, height, 3], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #28
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet2(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #29
Source File: models.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def sentnet_color_2d(width, height, frame_count, lr, output=9, model_name = 'sentnet_color.model'): network = input_data(shape=[None, width, height, 3], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, max_checkpoints=0, tensorboard_verbose=0, tensorboard_dir='log') return model
Example #30
Source File: alexnet.py From pygta5 with GNU General Public License v3.0 | 5 votes |
def alexnet2(width, height, lr, output=3): network = input_data(shape=[None, width, height, 1], name='input') network = conv_2d(network, 96, 11, strides=4, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = conv_2d(network, 256, 5, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 384, 3, activation='relu') network = conv_2d(network, 256, 3, activation='relu') network = max_pool_2d(network, 3, strides=2) network = local_response_normalization(network) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, 4096, activation='tanh') network = dropout(network, 0.5) network = fully_connected(network, output, activation='softmax') network = regression(network, optimizer='momentum', loss='categorical_crossentropy', learning_rate=lr, name='targets') model = tflearn.DNN(network, checkpoint_path='model_alexnet', max_checkpoints=1, tensorboard_verbose=2, tensorboard_dir='log') return model