Skip to content

image2image

allennlp.modules.vision.image2image

[SOURCE]


Image2ImageModule

class Image2ImageModule(nn.Module,  Registrable)

An Image2ImageModule takes a batch of images as a tensor with the dimensions (batch_size, color_channels, height, width), and returns a tensor in the same format, after applying some transformation on the images.

forward

class Image2ImageModule(nn.Module,  Registrable):
 | ...
 | def forward(self, images: FloatTensor, sizes: IntTensor)

NormalizeImage

@Image2ImageModule.register("normalize")
class NormalizeImage(Image2ImageModule):
 | def __init__(self, means: List[float], stds: List[float])

Normalizes an image by subtracting the mean and dividing by the standard deviation, separately for each channel.

forward

class NormalizeImage(Image2ImageModule):
 | ...
 | def forward(self, images: FloatTensor, sizes: IntTensor)