Skip to content
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

using protected methods in Caffe #143

Closed
robertnishihara opened this issue Jan 25, 2016 · 7 comments
Closed

using protected methods in Caffe #143

robertnishihara opened this issue Jan 25, 2016 · 7 comments
Labels

Comments

@robertnishihara
Copy link

Hi, I'd like to do something like the following:

import org.bytedeco.javacpp.caffe._

class CaffeSolver(solverParam: SolverParameter) extends FloatSGDSolver(solverParam) {
    super.ApplyUpdate()
}

ApplyUpdate is a protected method in Caffe's SGDSolver class (link to Caffe code). However, ApplyUpdate and the other protected methods do not appear in the FloatSGDSolver class in caffe.java. Would it be possible to wrap those methods as well?

As a short-term fix, I tried the following:

(1) Edit caffe.java by inserting the line

@Virtual protected native void ApplyUpdate();

in the FloatSGDSolver class.
(2) Set generate-sources.skip to true in javacpp-presets/pom.xml.
(3) Run mvn install --projects .,opencv,caffe.

However in step (3), I ran into a bunch of errors along the lines of

/root/javacpp-presets/caffe/target/classes/org/bytedeco/javacpp/jnicaffe.cpp:1889:5: error: ‘JavaCPP__0003a_0003acaffe_0003a_0003aSGDSolver_0003cdouble_0003e::JavaCPP__0003a_0003acaffe_0003a_0003aSGDSolver_0003cdouble_0003e(std::string&)’ cannot be overloaded
     JavaCPP__0003a_0003acaffe_0003a_0003aSGDSolver_0003cdouble_0003e(std::string& arg0) : ::caffe::SGDSolver<double>(arg0), obj(NULL) { }
     ^

Any help/advice would be appreciated. Thanks!

@saudet saudet added the bug label Jan 27, 2016
saudet added a commit to bytedeco/javacpp that referenced this issue Jan 27, 2016
@saudet
Copy link
Member

saudet commented Jan 27, 2016

Should be fixed in with the commits above! Thanks for reporting!

@robertnishihara
Copy link
Author

After rebuilding javacpp and javacpp-presets, this seems to work for me. Thanks a lot! Do you have any estimate for when this will be included in the binary release?

@saudet
Copy link
Member

saudet commented Feb 7, 2016

Next release? Probably around April.... It would go a lot easier if we had a CI server for that though... We could also upload SNAPSHOT binaries for now, good enough?

@robertnishihara
Copy link
Author

Do you mean upload them to the central maven repository? If so, that'd certainly work.

@saudet
Copy link
Member

saudet commented Feb 7, 2016

@robertnishihara
Copy link
Author

Thanks! I'll actually put them up myself in a temporary location, which should be good enough for now.

@saudet
Copy link
Member

saudet commented May 19, 2016

Fix included in newly released version 1.2. Thanks for reporting!

@saudet saudet closed this as completed May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants