Comments (13)
Hi, based on the cnn_train.m
example for training, you need to have labels +-1. But as it is an example training code, there is nothing easier to change the line 274 in cnn_train.m to:
error = bsxfun(@eq, predictions, labels);
And then you should be able to use 1,2 labels. It's just that it is sort of a common practice to have binary task with labels +-1...
from matconvnet.
I see. Great. Thanks!
from matconvnet.
Hmm, I just realised that I got it slightly wrong :)
With the binary classification, the network actually has a single output - that's why you multiply with the label directly...
But I just found, that actually having 2-class softmax is the same as logistic regression so in order to use what I've proposed, you will need to have softmaxloss
layer at the end with two outputs. But that might have actually been your case, so I hope that it worked :)
from matconvnet.
Hmm, so should I still use -1/+1?
from matconvnet.
I think the easiest would be to use the softmax with two outputs and two labels 1 and 2, then you just need to remove the top5 error evaluation in updateError in cnn_train
(as you will have just 2 labels)...
It's actually worth to fix this - to be able to set the n
for the error measures...
from matconvnet.
Great. Or actually I have data only with 2 labels (1 or 2) and I still set my output as having 5 distinct labels to train the network. I think this will still be ok, am I right?
from matconvnet.
Hmm, I'm not sure. At least the last layer would be slower, because you would have more parameters to learn (in this case to learn that they should be zero) - so you would deliberately make your problem more complicated.
But it's really just about commmenting out lines {271, 272} in cnn_train.m
:)
from matconvnet.
ok, great! Thanks.
from matconvnet.
I comment the {271,272} lines and keep label as 1/2, the output of the error plot look weird to me (it bigger than 1!?)
from matconvnet.
have you solved your problem?
I did binary classification with binary train type and 1/-1 labels.
But result doesn't make sense and graph is like you.
So, i did train with multiclass type and 1/2 labels.
But it does not converge.
How did you deal with binary classification with matconvnet?
from matconvnet.
@lenck
I did just as what you said,but things seems to be wrong.
In cifar, I changed the 10 in penultimate layers to be 2, and have the labels of 1,2. but the error didn't change in epochs. It always be obj:0.693 top1err:0.501.
I also tried to use the lables of -1 and 1. And change the error to 'error = bsxfun(@eq, predictions, labels);' But I just get a large error such as 150.
Look forward to your reply!
Thanks!
from matconvnet.
@johnny5550822 @lenck It would be helpful for many others to answer how solve Binary classification?
from matconvnet.
@Addhi86 Sorry, I have not used matconvnet for a while. Not sure how to handle this.
from matconvnet.
Related Issues (20)
- Latest versions vl_compilenn fail
- vl_compilenn directory
- Error in vl_testnn('gpu', true). MATLAB: mex: ErrInvalidMEXFile
- Error vl_compilenn('enableGpu', true) HOT 1
- cuda11.1 HOT 1
- 未定义的函数 'vl_testnn'
- this is why
- D:\Software\matconvnet-1.0-beta25\matlab\src\bits\datacu.hpp(89): error: identifier "cudnnConvolutionFwdPreference_t" is undefined D:\Software\matconvnet-1.0-beta25\matlab\src\bits\datacu.hpp(94): error: identifier "cudnnConvolutionBwdFilterPreference_t" is undefined D:\Software\matconvnet-1.0-beta25\matlab\src\bits\datacu.hpp(99): error: identifier "cudnnConvolutionBwdDataPreference_t" is undefined D:\Software\matconvnet-1.0-beta25\matlab\src\bits\datacu.hpp(141): error: identifier "cudnnConvolutionFwdPreference_t" is undefined D:\Software\matconvnet-1.0-beta25\matlab\src\bits\datacu.hpp(147): error: identifier "cudnnConvolutionBwdFilterPreference_t" is undefined D:\Software\matconvnet-1.0-beta25\matlab\src\bits\datacu.hpp(153): error: identifier "cudnnConvolutionBwdDataPreference_t" is undefined 6 errors detected in the compilation of "D:/Software/matconvnet-1.0-beta25/matlab/src/bits/data.cu". HOT 1
- every time i reopen the matlab porject,need to recompile the matconvnet,why?
- Question about the matrix format of vgg19
- Error in vl_compilenn>mex_compile (line 583) and vl_compilenn (line 492) HOT 1
- How to solve?
- The NVCC compiler 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc' does not appear to be valid. HOT 1
- Issue when compiling with GPU enabled HOT 1
- error in vl_compilenn HOT 1
- Is vl_nnconv implemented based on the FFT operator? HOT 1
- Convert pytorch model to matconvnet model
- Matlab crack after run again Matconvnet
- Reference to non-existent field ‘dilate‘.
- Have trouble compiling MatConvNet
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matconvnet.