From 1dac15c2ea205e53cfb3e713ca1980409ee24e44 Mon Sep 17 00:00:00 2001
From: Tiago Freitas Pereira <tiagofrepereira@gmail.com>
Date: Wed, 16 Jun 2021 14:53:20 +0200
Subject: [PATCH] Fixed RGB subtraction

---
 bob/bio/face/embeddings/opencv.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bob/bio/face/embeddings/opencv.py b/bob/bio/face/embeddings/opencv.py
index ab0c46bd..8a5d55f8 100644
--- a/bob/bio/face/embeddings/opencv.py
+++ b/bob/bio/face/embeddings/opencv.py
@@ -135,14 +135,15 @@ class VGG16_Oxford(OpenCVTransformer):
             Caffe has the shape `C x H x W` and the chanel is BGR and 
 
             """
-            # To BGR
-            X = X[:, ::-1, :, :].astype("float32")
 
             # Subtracting
             X[:, :, :, 0] -= caffe_average_img[0]
             X[:, :, :, 1] -= caffe_average_img[1]
             X[:, :, :, 2] -= caffe_average_img[2]
 
+            # To BGR
+            X = X[:, ::-1, :, :].astype("float32")
+
             return X
 
         super(VGG16_Oxford, self).__init__(checkpoint_path, config, preprocessor)
-- 
GitLab