예제 #1
0
파일: care_standard.py 프로젝트: jingcx/n2v
    def predict_probabilistic(self,
                              img,
                              axes,
                              normalizer=PercentileNormalizer(),
                              resizer=PadAndCropResizer(),
                              n_tiles=None):
        """Apply neural network to raw image to predict probability distribution for restored image.

        See :func:`predict` for parameter explanations.

        Returns
        -------
        :class:`csbdeep.internals.probability.ProbabilisticPrediction`
            Returns the probability distribution of the restored image.

        Raises
        ------
        ValueError
            If this is not a probabilistic model.

        """
        self.config.probabilistic or _raise(
            ValueError('This is not a probabilistic model.'))
        mean, scale = self._predict_mean_and_scale(img, axes, normalizer,
                                                   resizer, n_tiles)
        return ProbabilisticPrediction(mean, scale)
예제 #2
0
    def predict_probabilistic(self,
                              img,
                              axes,
                              factor,
                              normalizer=PercentileNormalizer(),
                              resizer=PadAndCropResizer(),
                              batch_size=8):
        """Apply neural network to raw image to predict probability distribution for isotropic restored image.

        See :func:`CARE.predict_probabilistic` for documentation.

        Parameters
        ----------
        factor : float
            Upsampling factor for Z axis. It is important that this is chosen in correspondence
            to the subsampling factor used during training data generation.
        batch_size : int
            Number of image slices that are processed together by the neural network.
            Reduce this value if out of memory errors occur.

        """
        self.config.probabilistic or _raise(
            ValueError('This is not a probabilistic model.'))
        mean, scale = self._predict_mean_and_scale(img, axes, factor,
                                                   normalizer, resizer,
                                                   batch_size)
        return ProbabilisticPrediction(mean, scale)