From 211c3c29bb3f3acb6ef5e8c3f341e029d8946143 Mon Sep 17 00:00:00 2001 From: Evan Shelhamer Date: Fri, 23 May 2014 09:13:44 -0700 Subject: [PATCH] follow-up on #443 to invert k channels (instead of 3) --- python/caffe/pycaffe.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/caffe/pycaffe.py b/python/caffe/pycaffe.py index 4827300708c..8bed7046cc8 100644 --- a/python/caffe/pycaffe.py +++ b/python/caffe/pycaffe.py @@ -284,7 +284,8 @@ def _Net_deprocess(self, input_name, input_): decaf_in += mean decaf_in = decaf_in.transpose((1,2,0)) if channel_order: - channel_order_inverse = tuple([channel_order.index(i) for i in (0,1,2)]) + channel_order_inverse = [channel_order.index(i) + for i in range(decaf_in.shape[2])] decaf_in = decaf_in[:, :, channel_order_inverse] if input_scale: decaf_in /= input_scale