Skip to content

Commit f9df314

Browse files
Merge pull request #60 from andreped/fix/failing-tests
[fix] Fixed Reinhard numpy bug; fixed deprecation issues; updated actions in workflows
2 parents fcc0c7a + cb642a5 commit f9df314

File tree

4 files changed

+27
-34
lines changed

4 files changed

+27
-34
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
runs-on: ubuntu-20.04
1010

1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v3
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v4
1414
with:
1515
python-version: '3.x'
1616

@@ -20,7 +20,7 @@ jobs:
2020
- name: Build wheels
2121
run: python setup.py sdist bdist_wheel
2222

23-
- uses: actions/upload-artifact@v3
23+
- uses: actions/upload-artifact@v4
2424
with:
2525
path: ./dist/*
2626

@@ -31,7 +31,7 @@ jobs:
3131
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
3232

3333
steps:
34-
- uses: actions/download-artifact@v3
34+
- uses: actions/download-artifact@v4
3535
with:
3636
name: artifact
3737
path: dist

.github/workflows/tests_full.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Full Tests
22

33
on:
44
push:
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches:
99
- main
10+
workflow_dispatch:
1011

1112
jobs:
1213
build:
@@ -15,9 +16,9 @@ jobs:
1516
if: startsWith(github.ref, 'refs/tags/v') != true
1617

1718
steps:
18-
- uses: actions/checkout@v1
19+
- uses: actions/checkout@v4
1920
- name: Set up Python 3.6
20-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
2122
with:
2223
python-version: 3.6
2324

@@ -39,14 +40,14 @@ jobs:
3940
runs-on: ${{ matrix.os }}
4041
strategy:
4142
matrix:
42-
os: [ windows-2019, ubuntu-20.04, macos-12 ]
43+
os: [ windows-2019, ubuntu-20.04, macos-13 ]
4344
python-version: [ 3.7, 3.8, 3.9 ]
4445
tf-version: [2.7.0, 2.8.0, 2.9.0]
4546

4647
steps:
47-
- uses: actions/checkout@v1
48+
- uses: actions/checkout@v4
4849
- name: Set up Python ${{ matrix.python-version }}
49-
uses: actions/setup-python@v2
50+
uses: actions/setup-python@v4
5051
with:
5152
python-version: ${{ matrix.python-version }}
5253

@@ -56,7 +57,7 @@ jobs:
5657
name: "Python wheel"
5758

5859
- name: Install dependencies
59-
run: pip install tensorflow==${{ matrix.tf-version }} protobuf==3.20.* opencv-python-headless scikit-image pytest
60+
run: pip install tensorflow==${{ matrix.tf-version }} protobuf==3.20.* opencv-python-headless scikit-image pytest "numpy<2"
6061

6162
- name: Install wheel
6263
run: pip install --find-links=${{github.workspace}} torchstain-*
@@ -70,21 +71,14 @@ jobs:
7071
runs-on: ${{ matrix.os }}
7172
strategy:
7273
matrix:
73-
os: [ windows-2019, ubuntu-20.04, macos-12 ]
74-
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
74+
os: [ windows-2019, ubuntu-20.04, macos-13 ]
75+
python-version: [ 3.7, 3.8, 3.9 ]
7576
pytorch-version: [1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0]
76-
exclude:
77-
- python-version: 3.6
78-
pytorch-version: 1.11.0
79-
- python-version: 3.6
80-
pytorch-version: 1.12.0
81-
- python-version: 3.6
82-
pytorch-version: 1.13.0
8377

8478
steps:
85-
- uses: actions/checkout@v1
79+
- uses: actions/checkout@v4
8680
- name: Set up Python ${{ matrix.python-version }}
87-
uses: actions/setup-python@v2
81+
uses: actions/setup-python@v4
8882
with:
8983
python-version: ${{ matrix.python-version }}
9084

@@ -94,7 +88,7 @@ jobs:
9488
name: "Python wheel"
9589

9690
- name: Install dependencies
97-
run: pip install torch==${{ matrix.pytorch-version }} torchvision opencv-python-headless scikit-image pytest
91+
run: pip install torch==${{ matrix.pytorch-version }} torchvision opencv-python-headless scikit-image pytest "numpy<2"
9892

9993
- name: Install wheel
10094
run: pip install --find-links=${{github.workspace}} torchstain-*

.github/workflows/tests_quick.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Quick Tests
22

33
on:
44
push:
@@ -7,14 +7,15 @@ on:
77
pull_request:
88
branches-ignore:
99
- main
10+
workflow_dispatch:
1011

1112
jobs:
1213
build:
1314
runs-on: ubuntu-20.04
1415
steps:
15-
- uses: actions/checkout@v1
16+
- uses: actions/checkout@v4
1617
- name: Set up Python 3.6
17-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v4
1819
with:
1920
python-version: 3.6
2021

@@ -36,9 +37,9 @@ jobs:
3637
runs-on: ubuntu-20.04
3738

3839
steps:
39-
- uses: actions/checkout@v1
40+
- uses: actions/checkout@v4
4041
- name: Set up Python 3.8
41-
uses: actions/setup-python@v2
42+
uses: actions/setup-python@v4
4243
with:
4344
python-version: 3.8
4445

@@ -62,9 +63,9 @@ jobs:
6263
runs-on: ubuntu-20.04
6364

6465
steps:
65-
- uses: actions/checkout@v1
66+
- uses: actions/checkout@v4
6667
- name: Set up Python 3.8
67-
uses: actions/setup-python@v2
68+
uses: actions/setup-python@v4
6869
with:
6970
python-version: 3.8
7071

torchstain/numpy/normalizers/reinhard.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ def fit(self, target):
2525
lab = rgb2lab(target)
2626

2727
# get summary statistics
28-
# stack_ = np.apply_along_axis(get_mean_std, 1, lab_split(lab))
29-
stack_ = np.apply_along_axis(get_mean_std, axis=1, arr=lab_split(lab))
28+
stack_ = np.array([get_mean_std(x) for x in lab_split(lab)])
3029

3130
self.target_means = stack_[:, 0]
3231
self.target_stds = stack_[:, 1]
@@ -40,8 +39,7 @@ def normalize(self, I):
4039
labs = lab_split(lab)
4140

4241
# get summary statistics from LAB
43-
# stack_ = np.apply_along_axis(get_mean_std, 1, labs)
44-
stack_ = np.apply_along_axis(get_mean_std, axis=1, arr=labs)
42+
stack_ = np.array([get_mean_std(x) for x in labs])
4543

4644
mus = stack_[:, 0]
4745
stds = stack_[:, 1]

0 commit comments

Comments
 (0)