SegNet¶
Semantic Segmentation Link¶
SegNetBasic¶
-
class
chainercv.links.model.segnet.
SegNetBasic
(n_class=None, pretrained_model=None, initialW=None)¶ SegNet Basic for semantic segmentation.
This is a SegNet [1] model for semantic segmenation. This is based on SegNetBasic model that is found here.
When you specify the path of a pretrained chainer model serialized as a
npz
file in the constructor, this chain model automatically initializes all the parameters with it. When a string in prespecified set is provided, a pretrained model is loaded from weights distributed on the Internet. The list of pretrained models supported are as follows:camvid
: Loads weights trained with the train split of CamVid dataset.
[1] Vijay Badrinarayanan, Alex Kendall and Roberto Cipolla “SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation.” PAMI, 2017 Parameters: - n_class (int) – The number of classes. If
None
, it can be infered ifpretrained_model
is given. - pretrained_model (str) – The destination of the pretrained
chainer model serialized as a
npz
file. If this is one of the strings described above, it automatically loads weights stored under a directory$CHAINER_DATASET_ROOT/pfnet/chainercv/models/
, where$CHAINER_DATASET_ROOT
is set as$HOME/.chainer/dataset
unless you specify another value by modifying the environment variable. - initialW (callable) – Initializer for convolution layers.
-
__call__
(x)¶ Compute an image-wise score from a batch of images
Parameters: x (chainer.Variable) – A variable with 4D image array. Returns: An image-wise score. Its channel size is self.n_class
.Return type: chainer.Variable
-
predict
(imgs)¶ Conduct semantic segmentations from images.
Parameters: imgs (iterable of numpy.ndarray) – Arrays holding images. All images are in CHW and RGB format and the range of their values are \([0, 255]\). Returns: List of integer labels predicted from each image in the input list. Return type: list of numpy.ndarray