android-demo-app icon indicating copy to clipboard operation
android-demo-app copied to clipboard

Try to use pytorch_android:1.10.0

Open l-atome opened this issue 4 years ago • 4 comments

Hello, from yolov5s, i created my own model and try to integrate it to "ObjectDetection" but I have the following error:

The model version must be between 3 and 5But the model version is 7 ()

I think that i use pytorch:1.10 on my computer (??)

So, i try to change the next two lines of "build:gradle:app" :

implementation 'org.pytorch:pytorch_android_lite:1.10.0' implementation 'org.pytorch:pytorch_android_torchvision:1.10.0'

But during the compilation of "ObjectDetection", i have the following error :

Duplicate class org.pytorch.BuildConfig found in modules jetified-pytorch_android-1.10.0-runtime (org.pytorch:pytorch_android:1.10.0) and jetified-pytorch_android_lite-1.10.0-runtime (org.pytorch:pytorch_android_lite:1.10.0)

What can i do to use my proper yolov5s model with ObjectDetection

Thanks for your help L'Atome

l-atome avatar Nov 29 '21 04:11 l-atome

I think this is what you want :https://github.com/jeffxtang/android-demo-app/tree/pt1.10

cloveropen avatar Nov 29 '21 07:11 cloveropen

Thanks for all

l-atome avatar Dec 06 '21 02:12 l-atome

To make things easier here is the direct solution: The pytorch guys changed torchvision to torchvision_lite from 1.9.0 to 1.10.0 which breaks the build when you just update the version number. You need to replace the dependency implementation 'org.pytorch:pytorch_android_torchvision:1.10.0' with implementation 'org.pytorch:pytorch_android_torchvision_lite:1.10.0' (adding the _lite).

phillies avatar Feb 03 '22 16:02 phillies

To make things easier here is the direct solution: The pytorch guys changed torchvision to torchvision_lite from 1.9.0 to 1.10.0 which breaks the build when you just update the version number. You need to replace the dependency implementation 'org.pytorch:pytorch_android_torchvision:1.10.0' with implementation 'org.pytorch:pytorch_android_torchvision_lite:1.10.0' (adding the _lite).

This worked for me, but classification results are coming wrong with ptl file generated from the script given along with HelloWorld app.

kartikpodugu avatar Aug 01 '23 18:08 kartikpodugu