summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJames Thewlis <jamt9000@gmail.com>2014-05-23 15:59:52 +0100
committerEvan Shelhamer <shelhamer@imaginarynumber.net>2014-05-23 09:21:17 -0700
commite5fcf030fb2683e7b286b22cde44e3bce2d98229 (patch)
tree3e3151d8a6ed77af7a03720ec4935c2fcff78ff9 /python
parent6029909fe1b8b26c19f618571faf47d9a7561009 (diff)
downloadcaffeonacl-e5fcf030fb2683e7b286b22cde44e3bce2d98229.tar.gz
caffeonacl-e5fcf030fb2683e7b286b22cde44e3bce2d98229.tar.bz2
caffeonacl-e5fcf030fb2683e7b286b22cde44e3bce2d98229.zip
Correctly invert the swapping of colour channels
In the 'deprocess' method, get back the image with the original channel order by inverting the original transform, rather than reversing the tuple which is incorrect.
Diffstat (limited to 'python')
-rw-r--r--python/caffe/pycaffe.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/python/caffe/pycaffe.py b/python/caffe/pycaffe.py
index 537e737b..48273007 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:
- decaf_in = decaf_in[:, :, channel_order[::-1]]
+ channel_order_inverse = tuple([channel_order.index(i) for i in (0,1,2)])
+ decaf_in = decaf_in[:, :, channel_order_inverse]
if input_scale:
decaf_in /= input_scale
return decaf_in