def get_transformer(self):
        # check if already loaded
        if hasattr(self, '_transformer') and self._transformer is not None:
            return self._transformer

        data_shape = None
        channel_swap = None
        mean_pixel = None
        mean_image = None

        network = caffe_pb2.NetParameter()
        with open(self.path(self.deploy_file)) as infile:
            text_format.Merge(infile.read(), network)
        if network.input_shape:
            data_shape = network.input_shape[0].dim
        else:
            data_shape = network.input_dim[:4]

        if isinstance(self.dataset, dataset.ImageClassificationDatasetJob):
            if self.dataset.image_dims[2] == 3 and \
                    self.dataset.train_db_task().image_channel_order == 'BGR':
                # XXX see issue #59
                channel_swap = (2,1,0)

            if self.use_mean == 'pixel':
                mean_pixel = self.get_mean_pixel(self.dataset.path(self.dataset.train_db_task().mean_file))
            elif self.use_mean == 'image':
                mean_image = self.get_mean_image(self.dataset.path(self.dataset.train_db_task().mean_file), True)

        elif isinstance(self.dataset, dataset.GenericImageDatasetJob):
            task = self.dataset.analyze_db_tasks()[0]

            if task.image_channels == 3:
                # XXX see issue #59
                channel_swap = (2,1,0)

            if self.dataset.mean_file:
                if self.use_mean == 'pixel':
                    mean_pixel = self.get_mean_pixel(self.dataset.path(self.dataset.mean_file))
                elif self.use_mean == 'image':
                    mean_image = self.get_mean_image(self.dataset.path(self.dataset.mean_file), True)

        t = caffe.io.Transformer(
                inputs = {'data': tuple(data_shape)}
                )

        # transpose to (channels, height, width)
        t.set_transpose('data', (2,0,1))

        if channel_swap is not None:
            # swap color channels
            t.set_channel_swap('data', channel_swap)

        # set mean
        if self.use_mean == 'pixel' and mean_pixel is not None:
            t.set_mean('data', mean_pixel)
        elif self.use_mean == 'image' and mean_image is not None:
            t.set_mean('data', mean_image)

        #t.set_raw_scale('data', 255) # [0,255] range instead of [0,1]

        self._transformer = t
        return self._transformer
Initiates the pocketsphinx instance.
dataset/ETHPy150Open NVIDIA/DIGITS/digits/model/tasks/caffe_train.py/CaffeTrainTask.get_transformer--crossover with--dataset/ETHPy150Open jasperproject/jasper-client/client/mic.py/Mic.__init__