-
Notifications
You must be signed in to change notification settings - Fork 18.7k
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Error in python interface. " Net.__init__(Net, str, str, int) did not match C++ signature" #3220
Comments
Well, I solved this problem.
to
And it's normal now. |
I hit this same error in Jan 2016. @suruoxi's fix seems to work. diff --git a/python/caffe/_caffe.cpp b/python/caffe/_caffe.cpp
index 4ea2ec6..4c558cb 100644
--- a/python/caffe/_caffe.cpp
+++ b/python/caffe/_caffe.cpp
@@ -75,7 +75,7 @@ void CheckContiguousArray(PyArrayObject* arr, string name,
// Net constructor for passing phase as int
shared_ptr<Net<Dtype> > Net_Init(
- string param_file, int phase) {
+ char* param_file, int phase) {
CheckFile(param_file);
shared_ptr<Net<Dtype> > net(new Net<Dtype>(param_file,
@@ -85,7 +85,7 @@ shared_ptr<Net<Dtype> > Net_Init(
// Net construct-and-load convenience constructor
shared_ptr<Net<Dtype> > Net_Init_Load(
- string param_file, string pretrained_param_file, int phase) {
+ char* param_file, char* pretrained_param_file, int phase) {
CheckFile(param_file);
CheckFile(pretrained_param_file); Maybe has something to do with differing versions of Boost? Please reopen this issue |
Hi, I've the same error too and did the above but it didn't work.
|
Running Ubuntu 15.10 and receive the same error on the ipython example 00 net = caffe.Net(model_def, # defines the structure of the model
model_weights, # contains the trained weights
caffe.TEST) # use test mode (e.g., don't perform dropout)
the above fix does not work for me |
If you take a careful look at the error message, the constructor is expecting strings for the first two arguments. What are the |
I ran into this issue recent. I found that just wrapping the input args with str() seemed to get the function signature to match. I.e.
|
You may be using Python 3/from future import unicode_literals, in which case wrapping with str() works. |
I had this problem, because I had |
Reinstalling latest version of Boost from sources resolved that problem for me (Ubuntu 16). |
Since this seems to be a boost error, what version of boost is everyone running? |
Any one could solve this problem. I am facing the same error and tried many solutions without a luck |
Encountered this error today, solved by installing the latest boost from source. Ubuntu 16.04, anaconda3, Python 3.6, CUDA 8, Boost 1.64
Additionally, to get
I encountered this error in examples/00-classification.ipynb, where it tried to load trained net/weight with caffe.Net(...). |
@suruoxi I also faced the same issue and tried the solution you have stated but it didn't work out for me. Do we also need to compile _caffe.cpp again here. I can see a file _caffe.so thought it might be related. ^ Sorted just had to run make pycaffe for it to be compiled again. Thanks for the solution though |
I use above way to slove my same problem. |
as @suruoxi said, in the newest version of |
thanks! I met the same issue, and solved it. as @kr11 said, in the newest version of _caffe.cpp, I replace all parameters with the type of string in Net_Init-like functions with char *. After changing, don't forget re-run make pycaffe. |
Hi All, I am getting same error and i have tried all the solutions which mention above, So is the boost.python is dependency or it will work for boost.python3 as well..? Please guide me if i am losing the track or missing anything?? Installation Info: |
Hi All, So the caffe model which i am trying to load its belongs to other community name is "Deeplab_v1" which needs its own caffe to build which has pyhton2 version. But i want build that caffe into python3 and i am trying to build and load using official document which is wrong so i make few changes in the files of "Deeplab_v1" and make it compatible with python3. And thats how i solved the problem. Thanks ..! |
Seems hopeful I made corresponding // Net constructor for passing phase as int
shared_ptr<Net<Dtype> > Net_Init(
-- // string param_file, int phase) {
++ // https://github.com/BVLC/caffe/issues/3220
++ char *param_file, int phase) {
CheckFile(param_file);
shared_ptr<Net<Dtype> > net(new Net<Dtype>(param_file,
static_cast<Phase>(phase)));
return net;
}
// Net construct-and-load convenience constructor
shared_ptr<Net<Dtype> > Net_Init_Load(
--// string param_file, string pretrained_param_file, int phase) {
++// https://github.com/BVLC/caffe/issues/3220
++char * param_file, char * pretrained_param_file, int phase) {
CheckFile(param_file);
CheckFile(pretrained_param_file);
from caffe-fast-rcnn but still gets following (although it seems better than this
|
Hi, I have the same problem, have you solved it? |
Boost.Python.ArgumentError: Python argument types in |
I tried to init a net with the python code:
The following error is reported:
I think the python interface is compatible with C++ signature. Then why is this error reported?
OpenSuse 13.02 64bit
The text was updated successfully, but these errors were encountered: