image preprocessing functions#185
Draft
geroldmeisinger wants to merge 6 commits intojhc13:mainfrom
Draft
Conversation
Contributor
Author
… scale_and_fill), added unit tests for prepare_img functions, added opencv-contrib-python requirement
3a82a1e to
6efd6d9
Compare
…hods, use preprocessing in CogVLM2, added select_preprocess_img_by_str to map from string to function
Contributor
Author
Contributor
Author
|
@jhc13 I'm done. |
Contributor
Author
|
I have to admit it is rather difficult for me to come up with real adversarial examples:
I'm so sorry children but it's for science!
from https://commons.wikimedia.org/wiki/File:EPK_komplexes_Beispiel.png |
Contributor
Author
|
I just noticed some models are using preprocessor_config.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





#168
implement different functions (
prepare_img_stretch_and_squish,prepare_img_scale_and_centercrop,prepare_img_scale_and_fill) to prepare square images for the model. functions are not yet integrated in UI.added unit tests for prepare_img functions. call with
python taggui/run_tests.pywhich runs the functions onimages/people_landscape.webpandimages/people_portrait.webp. images are licensed CC, addedattributions.txt. I chose images with an aspect ratio of 2 and people as content to make any strange preparations more obvious ("vertically flipped faces?", "oval faces?", "double face reflections?", "extended feet?")added
opencv-contrib-pythonas requirement (used inscale_and_fill). sooner or later we will need it anyway. I strongly argue for using opencv-contrib (contrib + non-headless) as there is a known issue with opencv to be incompatible with any other module previously installed in parallel and this version is the superset of all opencv modules.TODO: add examples with abstract objects (like diagram)
Landscape example
original:
stretch and squish:

center crop:

fill gray:

fill noise:

fill reflect:

fill replicate:

Portrait Example
original:

stretch and squish:

center crop:

fill gray:

fill noise:

fill reflect:

fill replicate:
