New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i want to use SVM as last layer of CNN any suggestion? #6090
Comments
Hello, |
@unrealwill #2588 does not have any information about how to use as SVM last layer of CNN |
In #2588 it suggest to end your model with :
You can adapt it to CNN by using a kernel size of 1 for conv1d or (1,1) for conv2d, use the appropriate regularizer and adding a flattening layer afterwards and you should be good to go : (untested not even runned )
|
i want to train a neural network, then select one of the first fully connected one, run the neural network on my dataset, store all the feature vectors, then train an SVM with a different library (e.g sklearn). |
Ok, then you might find this useful Additional hint, you can have two models : one Model for training and one Model for exporting the intermediate layer. As long as the models share their weights, the training will modify the the second model use for prediction of the intermediate layer. |
That's what people do a lot in transfer learning including me in this work, take a look on codes. Basically, 1) do what @unrealwill linked, 2) store all of them 3) do SVM using scikit-learn. |
Thanks @unrealwill @keunwoochoi How can i solve this issue File "", line 3, in File "C:\Users\user\Anaconda2\lib\site-packages\keras\backend\theano_backend.py", line 959, in call File "C:\Users\user\Anaconda2\lib\site-packages\theano\compile\function_module.py", line 795, in call File "C:\Users\user\Anaconda2\lib\site-packages\theano\tensor\type.py", line 178, in filter TypeError: Bad input argument to theano function with name "C:\Users\user\Anaconda2\lib\site-packages\keras\backend\theano_backend.py:955" at index 0 (0-based). File "C:\Users\user\Anaconda2\lib\site-packages\ipykernel\zmqshell.py", line 501, in run_cell |
Hello @keunwoochoi @unrealwill #Store features after CNN training #Now I have feature vector #currently, I am trying this code #But I got error |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.
Thank you!
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
The text was updated successfully, but these errors were encountered: