-
Notifications
You must be signed in to change notification settings - Fork 622
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
[opencv] Add opencv extension #1331
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1331 +/- ##
============================================
- Coverage 72.08% 71.69% -0.40%
- Complexity 5126 5177 +51
============================================
Files 473 480 +7
Lines 21970 22432 +462
Branches 2351 2410 +59
============================================
+ Hits 15838 16083 +245
- Misses 4925 5126 +201
- Partials 1207 1223 +16
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a README for the opencv extension and add that README to the mkdocs?
extensions/opencv/src/main/java/ai/djl/opencv/OpenCVImageFactory.java
Outdated
Show resolved
Hide resolved
extensions/opencv/src/main/java/ai/djl/opencv/OpenCVImageFactory.java
Outdated
Show resolved
Hide resolved
Change-Id: I738397d316ae128dd66f6ff5de8d52bfc56927e2
Why haven't you considered the JavaCPP Presets for OpenCV? Could you please explain why you are trying so hard to avoid using anything related to JavaCPP? What's wrong with JavaCPP? I would be more than happy to fix anything that prevents you from using JavaCPP, if only you could express those needs! Please do speak up! |
I want to make it clear that I'm not against JavaCPP at all. We do considered about JavaCPP, and we are still interested in using JavaCPP with PyTorch (Due to resource constraint, we paused this initiative. I happy to schedule a meeting with you if you can lead this initiative). I actually started with JavaCPP Presets for OpenCV. Everything works perfect except the default dependency size is huge (480M). I didn't figure out an easy way to reduce the size (e.g. I failed exclude openblas) I'm actually not happy with |
If you look only at the binaries of the presets for Linux, Mac, and Windows (x86_64), those are also about 80 MB: https://repo1.maven.org/maven2/org/bytedeco/opencv/4.5.3-1.5.6/ As for the dependency on OpenBLAS, it does accelerate OpenCV and PyTorch quite a bit, but neither OpenCV nor PyTorch distribute binaries with BLAS enabled, which I find weird. Are users of DJL also not concerned with performance? If you can say for sure that your users are unconcerned with performance, please let me know, and we'll see what we can do. Thank you for clarifying your needs! |
BTW, when PyTorch is used, an alternative to OpenCV could be TorchVision. When all symbols are properly stripped from the libraries, the archives are only 1~2 MB per platform: https://pypi.org/project/torchvision/#files |
Right, it does come with a few operations in C++, but looking more closely, it doesn't look too useful. It actually looks mostly like a wrapper around Pillow... In any case, we can enable building the Python libraries as part of the build for the JavaCPP Presets for PyTorch, and that would get us that missing library. BTW, I was thinking about this, and I think DJL could use the JavaCPP Presets for PyTorch as is, but simply rebundle it as necessary, similarly to how you're already doing it for TensorFlow for Java. Although I don't make releases frequently because it needs to some testing, I plan to continue updating the snapshots regularly, so you could pick those binaries and test those independently on your own, before making frequent releases of DJL. How does that sound? |
Change-Id: I738397d316ae128dd66f6ff5de8d52bfc56927e2
Description
Brief description of what this PR is about