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
| # Copy from https://github.com/bbonik/image_enhancement/blob/f0c286a166443202d592b920b63ee6901a0ee727/source/image_enhancement.py#L1388 | |
| import numpy as np | |
| from skimage import img_as_float | |
| def change_color_saturation( | |
| image_color, | |
| image_ph_mask=None, | |
| sat_degree=1.5,): | |
| LOCAL_BOOST = 0.2 |
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
| def split_to_batches(img, trained_size=512): | |
| img = skimage.img_as_float32(img) | |
| direction = 'landscape' | |
| if img.shape[0] > img.shape[1]: direction = 'portrait' | |
| # resize into 512x[width|height] | |
| width, height = img.shape[1], img.shape[0] | |
| if direction == 'landscape': | |
| new_height = trained_size | |
| new_width = int(new_height * (width / height)) |
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
| curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba && mkdir -p ~/micromamba && mv bin/micromamba ~/micromamba/ && ~/micromamba/micromamba shell init -s bash -y && echo "alias conda='micromamba'" >> ~/.bashrc && source ~/.bashrc |
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
| conda create -n pt python=3.11 -y && conda activate pt && pip install tqdm codetiming glances[all] torch torchvision pillow |
OlderNewer