basicsr.archs.inception

class basicsr.archs.inception.FIDInceptionA(in_channels, pool_features)[source]

Bases: InceptionA

InceptionA block patched for FID computation

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class basicsr.archs.inception.FIDInceptionC(in_channels, channels_7x7)[source]

Bases: InceptionC

InceptionC block patched for FID computation

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class basicsr.archs.inception.FIDInceptionE_1(in_channels)[source]

Bases: InceptionE

First InceptionE block patched for FID computation

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class basicsr.archs.inception.FIDInceptionE_2(in_channels)[source]

Bases: InceptionE

Second InceptionE block patched for FID computation

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class basicsr.archs.inception.InceptionV3(output_blocks=3, resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True)[source]

Bases: Module

Pretrained InceptionV3 network returning feature maps

BLOCK_INDEX_BY_DIM = {64: 0, 192: 1, 768: 2, 2048: 3}
DEFAULT_BLOCK_INDEX = 3
forward(x)[source]

Get Inception feature maps.

Parameters:

x (Tensor) – Input tensor of shape (b, 3, h, w). Values are expected to be in range (-1, 1). You can also input (0, 1) with setting normalize_input = True.

Returns:

Corresponding to the selected output block, sorted ascending by index.

Return type:

list[Tensor]

training: bool
basicsr.archs.inception.fid_inception_v3()[source]

Build pretrained Inception model for FID computation.

The Inception model for FID computation uses a different set of weights and has a slightly different structure than torchvision’s Inception.

This method first constructs torchvision’s Inception and then patches the necessary parts that are different in the FID Inception model.