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

[WIP] add DJL Android ONNXRuntime support #1844

Merged
merged 2 commits into from Aug 5, 2022

Conversation

wxm2018
Copy link
Contributor

@wxm2018 wxm2018 commented Jul 29, 2022

Description

Brief description of what this PR is about

  • Add DJL Android support for the ONNXRuntime engine to enable it to use onnx format models.-
  • But now it is [WIP].

@@ -97,11 +97,19 @@ afterEvaluate {
}
}

repositories {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

@@ -0,0 +1,90 @@

# ONNXRuntime Android Build Procedure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the installation instruction is generally applicable to all versions. You can migrate the build instruction to Android folder and refer a link from README




//apply plugin: 'java-library'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the setup for transient onnxruntime, @frankfliu what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try my PR: #1866

Your android project should be able to simply include:

implementation "ai.djl.android:onnxruntime:0.19.0-SNAPSHOT"

@lanking520 lanking520 changed the title add DJL Android ONNXRuntime support [WIP] add DJL Android ONNXRuntime support Jul 29, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #1844 (8ba0f0e) into master (bb5073f) will decrease coverage by 2.50%.
The diff coverage is 65.20%.

@@             Coverage Diff              @@
##             master    #1844      +/-   ##
============================================
- Coverage     72.08%   69.58%   -2.51%     
- Complexity     5126     5511     +385     
============================================
  Files           473      526      +53     
  Lines         21970    24445    +2475     
  Branches       2351     2665     +314     
============================================
+ Hits          15838    17010    +1172     
- Misses         4925     6124    +1199     
- Partials       1207     1311     +104     
Impacted Files Coverage Δ
api/src/main/java/ai/djl/modality/cv/Image.java 69.23% <ø> (-4.11%) ⬇️
...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java 76.00% <ø> (ø)
...rc/main/java/ai/djl/modality/cv/output/Joints.java 71.42% <ø> (ø)
.../main/java/ai/djl/modality/cv/output/Landmark.java 100.00% <ø> (ø)
...main/java/ai/djl/modality/cv/output/Rectangle.java 72.41% <0.00%> (ø)
...i/djl/modality/cv/translator/BigGANTranslator.java 21.42% <0.00%> (-5.24%) ⬇️
...odality/cv/translator/BigGANTranslatorFactory.java 33.33% <0.00%> (+8.33%) ⬆️
...nslator/InstanceSegmentationTranslatorFactory.java 14.28% <0.00%> (-3.90%) ⬇️
.../cv/translator/SemanticSegmentationTranslator.java 0.00% <0.00%> (ø)
.../cv/translator/StyleTransferTranslatorFactory.java 40.00% <ø> (ø)
... and 423 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 587763a...8ba0f0e. Read the comment docs.


# ONNXRuntime Android Build Procedure

This procedure is meant only for developers who want to build PyTorch native binaries from source, this is not intended for regular users.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is copied from PyTorch module, we need write different one for ONNX

@@ -7,6 +7,7 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.github.kezong:fat-aar:1.3.8'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fat-aar may not work as you expected.
engine.jar bundle in aar won't work, it need to be dexed first.

I think we should just publish a pom only package as normal java project.

@@ -97,11 +97,19 @@ afterEvaluate {
}
}

repositories {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not need this.

We can use mavenLocal():

  1. cd onnxruntime-native
  2. gradle pTML

@lanking520
Copy link
Member

As discussed offline. Let's just rollback to the previous trasient dependency version

Change-Id: Ifc66c565a44519e2469c87d8e22ebd8b027bf660
@lanking520 lanking520 merged commit defbe73 into deepjavalibrary:master Aug 5, 2022
patins1 pushed a commit to patins1/djl that referenced this pull request Aug 26, 2022
* add DJL Android ONNXRuntime support

* Use transient dependency

Change-Id: Ifc66c565a44519e2469c87d8e22ebd8b027bf660

Co-authored-by: wuxuemeng <wxmcreate@foxmail.com>
Co-authored-by: Frank Liu <frankfliu2000@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants