-
Notifications
You must be signed in to change notification settings - Fork 14
Android resize image for llava and gemma #95
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements image resizing functionality for different model types in an Android LLaMA demo application. The changes introduce model-specific image size configurations and simplify the image resizing logic.
- Adds a method to determine input image size based on model type (LLAVA_1_5: 336px, GEMMA_3: 896px)
- Modifies ETImage constructor and resizing methods to accept dynamic side sizes
- Removes custom toString() method from ModelType enum and replaces aspect-ratio-preserving resize with square resizing
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ModelType.java | Removes custom toString() method for enum values |
| MainActivity.java | Adds getInputImageSideSize() method and updates image processing to use dynamic sizing |
| ETImage.java | Updates constructor and resizing logic to accept configurable side sizes and use square resizing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/MainActivity.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| return Bitmap.createScaledBitmap(bitmap, finalWidth, finalHeight, false); | ||
| return Bitmap.createScaledBitmap(bitmap, sideSize, sideSize, false); |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from aspect-ratio-preserving resize to square resizing may distort images. This could negatively impact model performance if the models expect properly proportioned images. Consider whether this change is intentional or if aspect ratio should be preserved.
…llamademo/MainActivity.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.