Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

fix/D2go-App #292

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions D2Go/ObjectDetection/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
defaultConfig {
applicationId "org.pytorch.demo.objectdetection"
minSdkVersion 28
targetSdkVersion 30
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -46,7 +46,7 @@ android {

packagingOptions {
pickFirst "**"
}
}
}


Expand All @@ -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')

}
3 changes: 2 additions & 1 deletion D2Go/ObjectDetection/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:configChanges="orientation"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
12 changes: 6 additions & 6 deletions D2Go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
Expand Down
14 changes: 10 additions & 4 deletions D2Go/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'
}
}
}

Expand Down