(self, imgs)
return output
Predict features from images.

        Given :math:`N` input images, this method outputs a batched array with
        batchsize :math:`N`.

        Args:
            imgs (iterable of numpy.ndarray): Array-images.
                All images are in CHW format
                and the range of their value is :math:`[0, 255]`.

        Returns:
            numpy.ndarray or tuple of numpy.ndarray:
            A batch of features or a tuple of them.
Predict features from images.
Predict features from images .
def predict(self, imgs):
        """Predict features from images.

        Given :math:`N` input images, this method outputs a batched array with
        batchsize :math:`N`.

        Args:
            imgs (iterable of numpy.ndarray): Array-images.
                All images are in CHW format
                and the range of their value is :math:`[0, 255]`.

        Returns:
            numpy.ndarray or tuple of numpy.ndarray:
            A batch of features or a tuple of them.

        """
        # [(C, H_0, W_0), ..., (C, H_{B-1}, W_{B-1})] -> (B, N, C, H, W)
        imgs = self.xp.asarray([self._prepare(img) for img in imgs])
        n_crop = imgs.shape[-4]
        shape = (-1, imgs.shape[-3]) + self.crop_size
        # (B, N, C, H, W) -> (B * N, C, H, W)
        imgs = imgs.reshape(shape)

        with chainer.using_config('train', False), \
                chainer.function.no_backprop_mode():
            imgs = chainer.Variable(imgs)
            features = self.extractor(imgs)

        if isinstance(features, tuple):
            output = []
            for feature in features:
                feature = feature.array
                if n_crop > 1:
                    feature = self._average_crops(feature, n_crop)
                output.append(cuda.to_cpu(feature))
            output = tuple(output)
        else:
            output = cuda.to_cpu(features.array)
            if n_crop > 1:
                output = self._average_crops(output, n_crop)

        return output
def predict ( self , imgs ) : # [(C, H_0, W_0), ..., (C, H_{B-1}, W_{B-1})] -> (B, N, C, H, W) imgs = self . xp . asarray ( [ self . _prepare ( img ) for img in imgs ] ) n_crop = imgs . shape [ - 4 ] shape = ( - 1 , imgs . shape [ - 3 ] ) + self . crop_size # (B, N, C, H, W) -> (B * N, C, H, W) imgs = imgs . reshape ( shape ) with chainer . using_config ( 'train' , False ) , chainer . function . no_backprop_mode ( ) : imgs = chainer . Variable ( imgs ) features = self . extractor ( imgs ) if isinstance ( features , tuple ) : output = [ ] for feature in features : feature = feature . array if n_crop > 1 : feature = self . _average_crops ( feature , n_crop ) output . append ( cuda . to_cpu ( feature ) ) output = tuple ( output ) else : output = cuda . to_cpu ( features . array ) if n_crop > 1 : output = self . _average_crops ( output , n_crop ) return output