训练神经网络技巧 [英] Training neural network tips
问题描述
对于对象识别,建议我必须在MATLAB中使用神经网络.我有30个对象,每个对象20个图像,所以我有600个输入数据和20个不同的类.输入矩阵为100x600,目标为1x600.输入矩阵列是100个bin中关键点色相的直方图,如下所示:(m,n)=hist(hue_val,100)
我取了m
.
如果选择MLP网络,则需要多少层和这些层的神经元,这些函数可以传递函数适合每一层吗?
对于最后一个问题,我是否需要阴性样品?
For object recognition propose I've to use a neural network in MATLAB. I have 30 objects and 20 images for each object, so I have 600 input data and 20 different classes. Input matrix is 100x600 and target is 1x600. Input matrix columns is a histogram of keypoints' Hue in 100 bins like this: (m,n)=hist(hue_val,100)
that I took m
.
If I chose MLP network, how many layers and neurons for those layers are needed, which transfer functions is suitable for each layer?
And for last question, do I need negative samples?
推荐答案
- 层数-通常,单个隐藏层就足够了,因为(只要使用非线性激活函数,那么单个层就可以近似任意数量的层.)
- 传递函数-我不习惯这个术语,但是我假设您指的是激活函数(在将净输入传递到下一层之前对净输入执行的操作).我在此处回答了该问题的一个细微变化,但要点是,在大多数情况下,双曲线正切或逻辑等标准选择都适用案例.
- 隐藏层中神经元的数量-crodriguezo的链接很好地体现了这一点.我真正能添加的是,根据您的输入大小,我可能会在训练时间上大量使用此数量.
- 负样本-如果您只需要分类输入也属于30个对象中的哪个,则不需要负样本.但是,如果测试输入可能不包含30个对象,则肯定使用大量否定示例,因此网络不会认为所有是对象.
- Number of layers - In general a single hidden layer is sufficient since (so long your using a non-linear activation function) a single layer can approximate an arbitrary number of layers.
- Transfer function - I'm not used to this term, but I assume you mean the activation function (what you do to the net input before passing it to the next layer). I answered a slight variant of that question here, but the gist is that a standard choice like hyperbolic tangent or logistic works in most cases.
- Number of neurons in your hidden layer - crodriguezo's link fielded this one quite nicely. All I can really add is that with your input size, I'd probably base this quantity a lot on training time.
- Negative samples - If you just need to classify which of the 30 objects an input belongs too, then negative samples aren't needed. But, if a test input might be none of the 30 objects, then definitely use lots of negative example so the network doesn't think everything is an object.
记住要考虑留一法制和类似形式交叉验证作为对抗过度拟合的方法.限制隐藏层的单位数量也可以做到这一点,但是要付出代表丰富性的代价.
Remember to consider leave-one-out and similar forms cross validation as ways of combating overfitting. Limiting your hidden layer's unit count does this also, but at the cost of representational richness.
您没有提到的其他参数对于任何成功的ANN应用程序也非常重要.这些包括学习率,误差函数,退火时间表,动量和重量衰减.在这一点上,设置所有这些都是一门艺术,而不是一门科学(反对使用ANN与支持向量机的最佳论据之一),但是这
Other parameters you haven't mentioned are also very important to any successful ANN application. These include learning rate, error function, annealing schedule, momentum, and weight decay. Setting all of these is more of an art than a science at this point (one of the best arguments against using ANNs vs. support vector machinces), but this link has been a godsend for me in this area.
这篇关于训练神经网络技巧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!