Hi there,
I have started with the course (youtube lectures), and am really fascinated with the whole topic so far.
And luckily, so far, I haven’t run into too many technical issues…
This might be a bit overambitious, but I was thinking of creating a simple phone app that runs my image classification model - just as an excercise to try and go through the whole process from training a model to practically using it in an app
All the posts that I could find regarding creating android/ios apps are relatively ‘old’
this one for example is three years old by now:
[Deployment boilerplate for fastai-v2 - fastai / fastai dev - fast.ai Course Forums]Deployment boilerplate for fastai-v2
Could someone tell me if there is more up to date information on this subject?
ok, after days of struggling, i am getting a bit frustrated. none of the example scripts from the pytorch_lite github are working for me (in flutter, android studio etc). (compatibility issues with outdated versions)
flutter installation, dart, android studio etc is all working fine. once i try and run the pytorch example android apps (main.dart) i run into issues.
has anyone recently had any success with deploying a trained model to android?
Hi Dickson,
thanks for getting back to me.
flutter doctor doesn’t have any issues:
[✓] Flutter (Channel stable, 3.7.11, on Microsoft Windows [Version 10.0.19045.2846], locale en-GB) [✓] Windows Version (Installed version of Windows is version 10 or higher) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Chrome - develop for the web [✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.4) [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.77.3) [✓] Connected device (3 available) [✓] HTTP Host Availability
• No issues found!
for the flutter_app, once in android studio, I do get lots of warning from gradle assembleDebug:
** What went wrong:* Execution failed for task ‘:app:processDebugMainManifest’. > Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not “opens java.io” to unnamed module @3bf017f5
i get similar errors when i try to run the examples from the official pytorch tutorials
so my issue must be something basic that i am missing - but i assume it is version dependencies as you say
it is just weird, since all the examples are very recent - just a few months or weeks old
YES!
the app/script seems to be working now! Thank you very much, this is amazing.
dart/flutter might not be that complicated, but i found it faaar too overwhelming to get my head around your script.
one thing i had to change to make your script work, though:
change this: minSdkVersion flutter.minSdkVersion
to this: minSdkVersion 21
in the android/app/build.gradle file
and of course I had to add my own model and labels to the assets folder.
now i need to add some sample images (in assets) to try the classifier in the emulator.
Happy to know that it worked for you @muff! Sorry for my messy codes
PS - If anyone is wondering where is the code we were discussing about it’s here. Hope it helps. I’m open to suggestions and edits to make it easier for anyone trying to replicate the example.
silly question:
is the image being transformed before it is being fed to the image classification model?
I know that the image width/height are given (224px in your case), but how does it actually handle the images that come in larger sizes?
i wonder if i need to add an image crop and resize process before feeding the images to the classifier?
i do get much better results when i feed cropped images - but i was assuming the transform would happen inside the classifier anyway?