diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d4817d9..26f9a9a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,8 +9,8 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 with: python-version: '3.x' @@ -20,7 +20,7 @@ jobs: - name: Build wheels run: python setup.py sdist bdist_wheel - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./dist/* @@ -31,7 +31,7 @@ jobs: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifact path: dist diff --git a/.github/workflows/tests_full.yml b/.github/workflows/tests_full.yml index b6d7596..057d00f 100644 --- a/.github/workflows/tests_full.yml +++ b/.github/workflows/tests_full.yml @@ -1,4 +1,4 @@ -name: tests +name: Full Tests on: push: @@ -7,6 +7,7 @@ on: pull_request: branches: - main + workflow_dispatch: jobs: build: @@ -15,9 +16,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') != true steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python 3.6 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.6 @@ -28,7 +29,7 @@ jobs: run: python setup.py bdist_wheel - name: Upload Python wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Python wheel path: ${{github.workspace}}/dist/torchstain-*.whl @@ -39,24 +40,24 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ windows-2019, ubuntu-20.04, macos-12 ] + os: [ windows-2019, ubuntu-20.04, macos-13 ] python-version: [ 3.7, 3.8, 3.9 ] tf-version: [2.7.0, 2.8.0, 2.9.0] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: "Python wheel" - name: Install dependencies - run: pip install tensorflow==${{ matrix.tf-version }} protobuf==3.20.* opencv-python-headless scikit-image pytest + run: pip install tensorflow==${{ matrix.tf-version }} protobuf==3.20.* opencv-python-headless scikit-image pytest "numpy<2" - name: Install wheel run: pip install --find-links=${{github.workspace}} torchstain-* @@ -70,31 +71,24 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ windows-2019, ubuntu-20.04, macos-12 ] - python-version: [ 3.6, 3.7, 3.8, 3.9 ] + os: [ windows-2019, ubuntu-20.04, macos-13 ] + python-version: [ 3.7, 3.8, 3.9 ] pytorch-version: [1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0] - exclude: - - python-version: 3.6 - pytorch-version: 1.11.0 - - python-version: 3.6 - pytorch-version: 1.12.0 - - python-version: 3.6 - pytorch-version: 1.13.0 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: "Python wheel" - name: Install dependencies - run: pip install torch==${{ matrix.pytorch-version }} torchvision opencv-python-headless scikit-image pytest + run: pip install torch==${{ matrix.pytorch-version }} torchvision opencv-python-headless scikit-image pytest "numpy<2" - name: Install wheel run: pip install --find-links=${{github.workspace}} torchstain-* diff --git a/.github/workflows/tests_quick.yml b/.github/workflows/tests_quick.yml index 4c22ec5..b5e62c7 100644 --- a/.github/workflows/tests_quick.yml +++ b/.github/workflows/tests_quick.yml @@ -1,4 +1,4 @@ -name: tests +name: Quick Tests on: push: @@ -7,14 +7,15 @@ on: pull_request: branches-ignore: - main + workflow_dispatch: jobs: build: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python 3.6 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.6 @@ -25,7 +26,7 @@ jobs: run: python setup.py bdist_wheel - name: Upload Python wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Python wheel path: ${{github.workspace}}/dist/torchstain-*.whl @@ -36,14 +37,14 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: "Python wheel" @@ -62,14 +63,14 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: "Python wheel" diff --git a/torchstain/numpy/normalizers/reinhard.py b/torchstain/numpy/normalizers/reinhard.py index 035c49f..d959bc4 100644 --- a/torchstain/numpy/normalizers/reinhard.py +++ b/torchstain/numpy/normalizers/reinhard.py @@ -25,8 +25,7 @@ def fit(self, target): lab = rgb2lab(target) # get summary statistics -# stack_ = np.apply_along_axis(get_mean_std, 1, lab_split(lab)) - stack_ = np.apply_along_axis(get_mean_std, axis=1, arr=lab_split(lab)) + stack_ = np.array([get_mean_std(x) for x in lab_split(lab)]) self.target_means = stack_[:, 0] self.target_stds = stack_[:, 1] @@ -40,8 +39,7 @@ def normalize(self, I): labs = lab_split(lab) # get summary statistics from LAB -# stack_ = np.apply_along_axis(get_mean_std, 1, labs) - stack_ = np.apply_along_axis(get_mean_std, axis=1, arr=labs) + stack_ = np.array([get_mean_std(x) for x in labs]) mus = stack_[:, 0] stds = stack_[:, 1]