-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Running RealESRGAN on Android #18453
Comments
You may be able to use this script as an example of how to add pre/post processing to that specific model (assuming there's no major difference between the _x4 and _x4plus variants) : With that you can provide jpg or png bytes as the input and it will return a png (could also return jpg by changing this line) This example app uses a different model, but the usage is the same - provide bytes from a jpg or png as input, with it returning the bytes of the upscaled image. |
Exception caught when perform super resolution Thank you. I've completed all steps and converted the realesrgan-x4 from the repo model and converted FLOAT 32 to FLOAT 16. But facing this error.
|
The |
If you don't mind, can you help me by providing the code?
|
There's no direct cast, so you'll need to first convert your uint8 byte buffer into a FloatBuffer by copying each element, upcasting the uint8 to a bigger integer (making sure you don't flip the sign) before calling put on your new FloatBuffer, then call Fp16Conversions.convertFloatBufferToFp16Buffer. |
Note that currently there's limited fp16 support on mobile, so most of the model will convert data to fp32 to run, which can result in worse performance than fp32. Quantizing to 8-bit is going to be the best option if you run into performance issues. |
Describe the issue
Someone help me by providing Java code to use this model on Android? Sorry for creating these type of stupid issue.
Python Code:
To reproduce
I'm using RealESRGAN0-x4plus.onnx
Urgency
No response
Platform
Android
OS Version
13
ONNX Runtime Installation
Released Package
Compiler Version (if 'Built from Source')
No response
Package Name (if 'Released Package')
onnxruntime-android
ONNX Runtime Version or Commit ID
1.16.2
ONNX Runtime API
Java/Kotlin
Architecture
ARM64
Execution Provider
Other / Unknown
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: