MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / set_channel_swap

Method set_channel_swap

rtpose_wrapper/python/caffe/io.py:203–219  ·  view source on GitHub ↗

Set the input channel order for e.g. RGB to BGR conversion as needed for the reference ImageNet model. N.B. this assumes the channels are the first dimension AFTER transpose. Parameters ---------- in_ : which input to assign this channel order

(self, in_, order)

Source from the content-addressed store, hash-verified

201 self.transpose[in_] = order
202
203 def set_channel_swap(self, in_, order):
204 """
205 Set the input channel order for e.g. RGB to BGR conversion
206 as needed for the reference ImageNet model.
207 N.B. this assumes the channels are the first dimension AFTER transpose.
208
209 Parameters
210 ----------
211 in_ : which input to assign this channel order
212 order : the order to take the channels.
213 (2,1,0) maps RGB to BGR for example.
214 """
215 self.__check_input(in_)
216 if len(order) != self.inputs[in_][1]:
217 raise Exception('Channel swap needs to have the same number of '
218 'dimensions as the input channels.')
219 self.channel_swap[in_] = order
220
221 def set_raw_scale(self, in_, scale):
222 """

Callers 2

__init__Method · 0.80
__init__Method · 0.80

Calls 1

__check_inputMethod · 0.95

Tested by

no test coverage detected