From cc79d89a7692202dd16fa03ee1789c51340b0e06 Mon Sep 17 00:00:00 2001 From: pooya-mohammadi Date: Sat, 18 Nov 2023 00:08:56 +0330 Subject: [PATCH 1/5] Add .gitignore --- .gitignore | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b0b6f3a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ \ No newline at end of file From b4e6cc0aa607e07bc691d854717e7004e648c7f1 Mon Sep 17 00:00:00 2001 From: pooya-mohammadi Date: Sat, 18 Nov 2023 00:09:53 +0330 Subject: [PATCH 2/5] Remove __pycache__ --- __pycache__/data_loader.cpython-38.pyc | Bin 8747 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 __pycache__/data_loader.cpython-38.pyc diff --git a/__pycache__/data_loader.cpython-38.pyc b/__pycache__/data_loader.cpython-38.pyc deleted file mode 100644 index 2cd2a6098001651e9f39dd27a5eb4ca20ca7a882..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8747 zcmcIqO^h5z74GW)`PudCdTsC8PO?gZ@dVjU90)-qS!3r1gV`9{k@BS^hjPg+qg>|lVU#Ow73C_I zk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 zuQL#G;)5!ZG&VNdUFkJlUe7d%#3|5Zm0zXm12+|0xX^3fXa|XI+KFyzxQ*o7!v=WK zeH-VE8&;yvPx75&l4BatlZxZ4cwsyAx{mV^ItnPktQa*;=hF>IO`U=3n8l+b!E{*6 z<9im)$)<$T+^9wkc-6&X-g!{sMLGmr0=q-uFV0vuK=>=3)OnO`Ta$#VKSVc+t@UtS z;$~5jbx86bvA)vjEwMX}t>79PGz&E`NcQ9gXW9~X{}i|BHp8p&6yRE?7k1i9xa+2` z*i7HrS|^NaoUA*^{||7IF2*ILncd)jYVQ7mg{CG`Nwc3NVhiXS^57)l) EKPht#q5uE@ From 739ac40362497d1e0ec6500f324f79d8a0746548 Mon Sep 17 00:00:00 2001 From: pooya-mohammadi Date: Sat, 18 Nov 2023 00:12:23 +0330 Subject: [PATCH 3/5] ignore saved_models --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b0b6f3a3..56eb790a 100644 --- a/.gitignore +++ b/.gitignore @@ -157,4 +157,5 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -.idea/ \ No newline at end of file +.idea/ +saved_models/ \ No newline at end of file From 9d00a0a69e525add5518fe5cd3e0eff27041c9c1 Mon Sep 17 00:00:00 2001 From: pooya-mohammadi Date: Sat, 18 Nov 2023 00:18:19 +0330 Subject: [PATCH 4/5] Save output with cv2 --- u2net_portrait_composite.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/u2net_portrait_composite.py b/u2net_portrait_composite.py index 74d5da5e..24ff8535 100644 --- a/u2net_portrait_composite.py +++ b/u2net_portrait_composite.py @@ -1,3 +1,4 @@ +import cv2 import os from skimage import io, transform from skimage.filters import gaussian @@ -56,7 +57,7 @@ def save_output(image_name,pred,d_dir,sigma=2,alpha=0.5): alpha = alpha im_comp = image*alpha+pd*(1-alpha) - print(im_comp.shape) + print(im_comp.shape, type(im_comp)) img_name = image_name.split(os.sep)[-1] @@ -65,7 +66,8 @@ def save_output(image_name,pred,d_dir,sigma=2,alpha=0.5): imidx = bbb[0] for i in range(1,len(bbb)): imidx = imidx + "." + bbb[i] - io.imsave(d_dir+'/'+imidx+'_sigma_' + str(sigma) + '_alpha_' + str(alpha) + '_composite.png',im_comp) + cv2.imwrite(d_dir+'/'+imidx+'_sigma_' + str(sigma) + '_alpha_' + str(alpha) + '_composite.png', + im_comp) def main(): From e75652d81b5b80b694c30a07b2d34d5f2d490d19 Mon Sep 17 00:00:00 2001 From: pooya-mohammadi Date: Sat, 18 Nov 2023 00:19:05 +0330 Subject: [PATCH 5/5] Ignore results --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 56eb790a..74861865 100644 --- a/.gitignore +++ b/.gitignore @@ -158,4 +158,5 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ -saved_models/ \ No newline at end of file +saved_models/ +test_data/test_portrait_images/your_portrait_results/*_composite.png \ No newline at end of file