Classifier¶
PixelwiseSoftmaxClassifier¶
-
class
chainercv.links.
PixelwiseSoftmaxClassifier
(predictor, ignore_label=-1, class_weight=None)[source]¶ A pixel-wise classifier.
It computes the loss based on a given input/label pair for semantic segmentation.
- Parameters
predictor (Link) – Predictor network.
ignore_label (int) – A class id that is going to be ignored in evaluation. The default value is -1.
class_weight (array) – An array that contains constant weights that will be multiplied with the loss values along with the channel dimension. This will be used in
chainer.functions.softmax_cross_entropy()
.
-
forward
(x, t)[source]¶ Computes the loss value for an image and label pair.
- Parameters
x (Variable) – A variable with a batch of images.
t (Variable) – A variable with the ground truth image-wise label.
- Returns
Loss value.
- Return type
Variable
-
to_cpu
()[source]¶ Copies parameter variables and persistent values to CPU.
This method does not handle non-registered attributes. If some of such attributes must be copied to CPU, the link implementation should override
device_resident_accept()
to do so.Returns: self
-
to_gpu
(device=None)[source]¶ Copies parameter variables and persistent values to GPU.
This method does not handle non-registered attributes. If some of such attributes must be copied to GPU, the link implementation must override
device_resident_accept()
to do so.- Parameters
device – Target device specifier. If omitted, the current device is used.
Returns: self