diff --git a/D2Go/ObjectDetection/app/build.gradle b/D2Go/ObjectDetection/app/build.gradle index c8d5756c..4c8299bd 100644 --- a/D2Go/ObjectDetection/app/build.gradle +++ b/D2Go/ObjectDetection/app/build.gradle @@ -15,7 +15,7 @@ android { defaultConfig { applicationId "org.pytorch.demo.objectdetection" minSdkVersion 28 - targetSdkVersion 30 + targetSdkVersion 33 versionCode 1 versionName "1.0" @@ -46,7 +46,7 @@ android { packagingOptions { pickFirst "**" - } + } } @@ -64,7 +64,14 @@ dependencies { implementation "androidx.camera:camera-core:$camerax_version" implementation "androidx.camera:camera-camera2:$camerax_version" - implementation 'org.pytorch:pytorch_android_lite:1.10.0' - implementation 'org.pytorch:pytorch_android_torchvision_lite:1.10.0' - implementation 'org.pytorch:torchvision_ops:0.10.0' + implementation 'com.facebook.fbjni:fbjni-java-only:0.0.3' + + implementation 'org.pytorch:pytorch_android_lite:1.13.0' + implementation 'org.pytorch:pytorch_android_torchvision_lite:1.13.0' + implementation 'org.pytorch:torchvision_ops:0.14.0' + +// Uncomment below lines if using the libraries built from source +// implementation(name:'pytorch_android-release', ext:'aar') +// implementation(name:'pytorch_android_torchvision-release', ext:'aar') + } \ No newline at end of file diff --git a/D2Go/ObjectDetection/app/src/main/AndroidManifest.xml b/D2Go/ObjectDetection/app/src/main/AndroidManifest.xml index b2a531ca..dea27873 100644 --- a/D2Go/ObjectDetection/app/src/main/AndroidManifest.xml +++ b/D2Go/ObjectDetection/app/src/main/AndroidManifest.xml @@ -14,7 +14,8 @@ android:theme="@style/AppTheme"> + android:screenOrientation="portrait" + android:exported="true"> diff --git a/D2Go/README.md b/D2Go/README.md index f00908d4..f9824c16 100644 --- a/D2Go/README.md +++ b/D2Go/README.md @@ -8,16 +8,16 @@ This D2Go Android demo app shows how to prepare and use the D2Go model on Androi ## Prerequisites -* PyTorch 1.10.0 and torchvision 0.11.1 (Optional) +* PyTorch 1.13.0 and torchvision 0.14.1 (Optional) * Python 3.8 or above (Optional) -* Android Pytorch library pytorch_android_lite 1.10.0, pytorch_android_torchvision_lite 1.10.0, torchvision_ops library 0.10.0 +* Android Pytorch library pytorch_android_lite 1.13.0, pytorch_android_torchvision_lite 1.13.0, torchvision_ops library 0.13.0 * Android Studio 4.0.1 or later ## Quick Start This section shows how to create and use the D2Go model and the pre-built torchvision-ops library in a completed Android app. To just build and run the app without creating the D2Go model yourself, go directly to Step 4. -1. Install PyTorch 1.10.0 and torchvision 0.11.1, for example: +1. Install PyTorch 1.13.0 and torchvision 0.14.0, for example: ``` conda create -n d2go python=3.8.5 @@ -54,9 +54,9 @@ In Android Studio, open `android-demo-app/D2Go` (not `android-demo-app/D2Go/Obje The main changes needed to use the D2Go model and the required and pre-built torchvision-ops library are adding ``` -implementation 'org.pytorch:pytorch_android_lite:1.10.0' -implementation 'org.pytorch:pytorch_android_torchvision_lite:1.10.0' -implementation 'org.pytorch:torchvision_ops:0.10.0' +implementation 'org.pytorch:pytorch_android_lite:1.13.0' +implementation 'org.pytorch:pytorch_android_torchvision_lite:1.13.0' +implementation 'org.pytorch:torchvision_ops:0.14.0' ``` in the build.gradle file and ``` diff --git a/D2Go/build.gradle b/D2Go/build.gradle index 5fde2be0..52733036 100644 --- a/D2Go/build.gradle +++ b/D2Go/build.gradle @@ -2,9 +2,9 @@ allprojects { buildscript { ext { minSdkVersion = 21 - targetSdkVersion = 28 - compileSdkVersion = 28 - buildToolsVersion = '28.0.3' + targetSdkVersion = 33 + compileSdkVersion = 33 + buildToolsVersion = '30.0.3' coreVersion = "1.2.0" extJUnitVersion = "1.1.1" @@ -21,16 +21,22 @@ allprojects { google() mavenCentral() jcenter() + flatDir { + dirs 'libs' + } } dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' + classpath 'com.android.tools.build:gradle:7.3.1' } } repositories { google() jcenter() + flatDir { + dirs 'libs' + } } }