From 79ef41bc516dbfb7d3ff086fc19bb5a6907c69b8 Mon Sep 17 00:00:00 2001 From: geramanisn Date: Tue, 1 Aug 2023 23:16:51 +0300 Subject: [PATCH] dependencies update and minor fix --- .github/workflows/build.yml | 8 +++++--- .gitignore | 5 ++--- denoising_inpainting_lbp/denoising_inpainting.py | 4 +--- denoising_inpainting_lbp/image_damager.py | 4 ++-- denoising_inpainting_lbp/markov_random_field.py | 1 - requirements.txt | 15 +++++++-------- scripts/main.py | 9 +++++++++ setup.py | 11 +++++------ 8 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 scripts/main.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45194bf..0107c71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.10.10' + python-version: '3.11.3' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -28,6 +28,8 @@ jobs: - name: Show coverage report run: coverage report - name: Run linter - run: pylint --disable=E1101 denoising_inpainting_lbp/ + if: always() + run: pylint denoising_inpainting_lbp/ - name: Run type checker - run: mypy --ignore-missing-imports denoising_inpainting_lbp/ + if: always() + run: mypy denoising_inpainting_lbp/ diff --git a/.gitignore b/.gitignore index a71effa..bd53841 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,8 @@ venv/ **/.mypy_cache denoising_inpainting_lbp.egg-info/ *.log -*.png -!images/*.png coverage/ -docs/ scripts/ .coverage +*.png +!images/*.png diff --git a/denoising_inpainting_lbp/denoising_inpainting.py b/denoising_inpainting_lbp/denoising_inpainting.py index 8efdaa9..4e09c60 100644 --- a/denoising_inpainting_lbp/denoising_inpainting.py +++ b/denoising_inpainting_lbp/denoising_inpainting.py @@ -27,7 +27,7 @@ logger.setLevel(logging.INFO) -# pylint: disable=too-many-arguments +# pylint: disable-next=too-many-arguments def denoise_inpaint(image_path: str, mask_image_path: str, n_iterations: int, @@ -59,8 +59,6 @@ def denoise_inpaint(image_path: str, logger.info('Done!') -# pylint: enable=too-many-arguments - def _loopy_belief_propagation( observed_image: np.ndarray, mask_image: np.ndarray, diff --git a/denoising_inpainting_lbp/image_damager.py b/denoising_inpainting_lbp/image_damager.py index 972534e..4c10f4f 100644 --- a/denoising_inpainting_lbp/image_damager.py +++ b/denoising_inpainting_lbp/image_damager.py @@ -63,7 +63,7 @@ def _add_noise(image: np.ndarray, def _calculate_missing_part_points( - shape: Tuple[int, ...]) -> Tuple[Tuple[int, int], Tuple[int, int]]: + shape: Tuple[int, int]) -> Tuple[Tuple[int, int], Tuple[int, int]]: """Create the coordinates of the destroyed portion of the image.""" missing_part_height = random.randint( int(shape[0] * IMAGE_PERCENTAGE_TO_DESTROY_LOW), @@ -84,7 +84,7 @@ def _calculate_missing_part_points( def _create_mask_image( missing_part_points: Tuple[Tuple[int, int], Tuple[int, int]], - shape: Tuple[int, ...]) -> np.ndarray: + shape: Tuple[int, int]) -> np.ndarray: """Create the mask image. The mask image indicates which pixels have been damaged. diff --git a/denoising_inpainting_lbp/markov_random_field.py b/denoising_inpainting_lbp/markov_random_field.py index ed50c51..d5fc836 100644 --- a/denoising_inpainting_lbp/markov_random_field.py +++ b/denoising_inpainting_lbp/markov_random_field.py @@ -34,7 +34,6 @@ def __init__(self, self._smoothness_cost = np.empty((self._N_LABELS, self._N_LABELS), dtype=np.int64) - for i in range(self._N_LABELS): for j in range(self._N_LABELS): self._smoothness_cost[i, j] = ( diff --git a/requirements.txt b/requirements.txt index af5de05..b003184 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,7 @@ -opencv-python==4.7.0.72 -numpy==1.24.2 -matplotlib==3.7.1 -pyqt5==5.15.9 -pytest==7.3.0 -coverage==7.2.3 -pylint==2.17.2 -mypy==1.2.0 \ No newline at end of file +opencv-python==4.8.0.74 +numpy==1.25.2 +matplotlib==3.7.2 +pytest==7.4.0 +coverage==7.2.7 +pylint==2.17.5 +mypy==1.4.1 \ No newline at end of file diff --git a/scripts/main.py b/scripts/main.py new file mode 100644 index 0000000..dfed2ef --- /dev/null +++ b/scripts/main.py @@ -0,0 +1,9 @@ +from denoising_inpainting_lbp import image_damager +from denoising_inpainting_lbp import denoising_inpainting + +image_damager.damage_image('images/boat.pnp', 0, 0.1) +denoising_inpainting.denoise_inpaint('images/house-damaged.png', + 'images/house-mask.png', + 1, + 5, + 37580519.6) diff --git a/setup.py b/setup.py index c51a9c4..6177e86 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='denoising_inpainting_lbp', - version='0.1.0', + version='1.0.0', packages=['denoising_inpainting_lbp'], author='Nick Geramanis', author_email='nickgeramanis@gmail.com', @@ -9,8 +9,7 @@ 'for denoising and inpainting greyscale images'), url='https://github.com/NickGeramanis/denoising-inpainting-lbp', license='GPLV3', - python_requires='==3.10.10', - install_requires=['opencv-python==4.7.0.72', - 'numpy==1.24.2', - 'matplotlib==3.7.1', - 'pyqt5==5.15.9']) + python_requires='==3.11.3', + install_requires=['opencv-python==4.8.0.74', + 'numpy==1.25.2', + 'matplotlib==3.7.2'])