神经网络matlab 验证集,如何更改神经网络以提高验证集的准确性?

我们使用Tensorflow训练二元分类图像数据集 700 images ,其中每个图像都是 256*256*1 ,数据集平均分成两个类 . 我们稍微更改了 Tensorflow 上的 Cifar10 模型,我们的模型代码如下所示 .

# conv1

with tf.variable_scope('conv1') as scope:

kernel = _variable_with_weight_decay('weights',

shape=[5, 5, 1, 256],

stddev=5e-2,

wd=0.0)

conv = tf.nn.conv2d(images, kernel, [1, 1, 1, 1], padding='SAME')

biases = _variable_on_cpu('biases', [256], tf.constant_initializer(0.0))

pre_activation = tf.nn.bias_add(conv, biases)

conv1 = tf.nn.relu(pre_activation, name=scope.name)

_activation_summary(conv1)

# pool1

pool1 = tf.nn.max_pool(conv1, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1],

padding='SAME', name='pool1')

# norm1

norm1 = tf.nn.lrn(pool1, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75,

name='norm1')

# conv2

with tf.variable_scope('conv2') as scope:

kernel = _variable_with_weight_decay('weights',

shape=[5, 5, 256, 256],

stddev=5e-2,

wd=0.0)

conv = tf.nn.conv2d(norm1, kernel, [1, 1, 1, 1], padding='SAME')

biases = _variable_on_cpu('biases', [256], tf.constant_initializer(0.1))

pre_activation = tf.nn.bias_add(conv, biases)

conv2 = tf.nn.relu(pre_activation, name=scope.name)

_activation_summary(conv2)

# norm2

norm2 = tf.nn.lrn(conv2, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75,

name='norm2')

# pool2

pool2 = tf.nn.max_pool(norm2, ksize=[1, 3, 3, 1],

strides=[1, 2, 2, 1], padding='SAME', name='pool2')

# local3

with tf.variable_scope('local3') as scope:

reshape = tf.reshape(pool2, [FLAGS.batch_size, -1])

dim = reshape.get_shape()[1].value

weights = _variable_with_weight_decay('weights', shape=[dim, 384],

stddev=0.04, wd=0.004)

biases = _variable_on_cpu('biases', [384], tf.constant_initializer(0.1))

local3 = tf.nn.relu(tf.matmul(reshape, weights) + biases, name=scope.name)

_activation_summary(local3)

# local4

with tf.variable_scope('local4') as scope:

weights = _variable_with_weight_decay('weights', shape=[384, 192],

stddev=0.04, wd=0.004)

biases = _variable_on_cpu('biases', [192], tf.constant_initializer(0.1))

local4 = tf.nn.relu(tf.matmul(local3, weights) + biases, name=scope.name)

_activation_summary(local4)

with tf.variable_scope('softmax_linear') as scope:

weights = _variable_with_weight_decay('weights', [192, NUM_CLASSES],

stddev=1/192.0, wd=0.0)

biases = _variable_on_cpu('biases', [NUM_CLASSES],

tf.constant_initializer(0.0))

softmax_linear = tf.add(tf.matmul(local4, weights), biases, name=scope.name)

_activation_summary(softmax_linear)

我们使用 batchsize = 2 和 learning rate = 0.005 .

目前,loss和validation accuracy看起来像这样 . 最大准确度在 65% 和 70% 之间反弹 .

我应该更改哪些参数以获得更高的准确度?我试图将过滤器大小减小到3并添加两个丢失层(0.5),但它似乎没有改变任何东西 .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值