From 8d16ce1834f9d6e1e776b03cb666eb886b7c1314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Reboud?= Date: Sun, 11 Dec 2022 08:35:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20fix:=20update=20correlation?= =?UTF-8?q?=20matrix=20coeffs=20(#37)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Docs/Contributing/CHANGELOG.md | 1 + Tests/MATorchTests/Base/Model.swift | 6 +++--- Tests/MATorchTests/Base/python_lib/model.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Docs/Contributing/CHANGELOG.md b/Docs/Contributing/CHANGELOG.md index 98672541..6e0d1489 100644 --- a/Docs/Contributing/CHANGELOG.md +++ b/Docs/Contributing/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## [unreleased] +🐛 **fix:** update correlation matrix coeffs ([#37](https://github.com/owkin/MAKit/pull/37))\ 🪜 **layer_2d:** ResizeBilinearCrop ([#36](https://github.com/owkin/MAKit/pull/36))\ 🚀 **perf:** enhance backwardGPU for ResizeBilinear ([#35](https://github.com/owkin/MAKit/pull/35))\ 🪜 **layer_2d:** Rotate2D ([#34](https://github.com/owkin/MAKit/pull/34))\ diff --git a/Tests/MATorchTests/Base/Model.swift b/Tests/MATorchTests/Base/Model.swift index 31745267..ef5d49cd 100644 --- a/Tests/MATorchTests/Base/Model.swift +++ b/Tests/MATorchTests/Base/Model.swift @@ -272,9 +272,9 @@ class ModelTest3 layer = DecorrelateRGB( layerPrev: layer, correlation: [ - 0.26, 0.27, 0.27, - 0.09, 0.00, -0.09, - 0.02, -0.05, 0.03 + 0.26, 0.09, 0.02, + 0.27, 0.00, -0.05, + 0.27, -0.09, 0.03 ].map { $0 / 0.4619524 }, params: params ) diff --git a/Tests/MATorchTests/Base/python_lib/model.py b/Tests/MATorchTests/Base/python_lib/model.py index c1e1337c..f1456ed1 100644 --- a/Tests/MATorchTests/Base/python_lib/model.py +++ b/Tests/MATorchTests/Base/python_lib/model.py @@ -213,7 +213,7 @@ def _linear_decorrelate_color(x): color_correlation_normalized = \ color_correlation_svd_sqrt / max_norm_svd_sqrt color_correlation_normalized = torch.Tensor( - color_correlation_normalized.astype("float32") + color_correlation_normalized.T.astype("float32") ) x_flat = torch.matmul(x_flat, color_correlation_normalized) x = torch.reshape(x_flat, x.shape)