-
Notifications
You must be signed in to change notification settings - Fork 41
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
image preprocessing functions #185
base: main
Are you sure you want to change the base?
Conversation
… 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
@jhc13 I'm done. |
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 |
I just noticed some models are using preprocessor_config.json |
#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.py
which runs the functions onimages/people_landscape.webp
andimages/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-python
as 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:
