Shortcuts

mmedit.evaluation.functional.fid_inception

Inception networks used in calculating FID and Inception metrics.

This code is modified from: https://github.com/rosinality/stylegan2-pytorch/blob/master/inception.py

Module Contents

Classes

InceptionV3

Pretrained InceptionV3 network returning feature maps.

FIDInceptionA

InceptionA block patched for FID computation.

FIDInceptionC

InceptionC block patched for FID computation.

FIDInceptionE_1

First InceptionE block patched for FID computation.

FIDInceptionE_2

Second InceptionE block patched for FID computation.

Functions

fid_inception_v3([load_ckpt])

Build pretrained Inception model for FID computation.

Attributes

FID_WEIGHTS_URL

mmedit.evaluation.functional.fid_inception.FID_WEIGHTS_URL = https://github.com/mseitzer/pytorch-fid/releases/download/fid_weights/pt_inception-2015-12-05-672...[source]
class mmedit.evaluation.functional.fid_inception.InceptionV3(output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True)[source]

Bases: torch.nn.Module

Pretrained InceptionV3 network returning feature maps.

DEFAULT_BLOCK_INDEX = 3[source]
BLOCK_INDEX_BY_DIM[source]
forward(inp)[source]

Get Inception feature maps.

Parameters

inp (torch.Tensor) – Input tensor of shape Bx3xHxW. Values are expected to be in range (0, 1)

Returns

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

Return type

list(torch.Tensor)

mmedit.evaluation.functional.fid_inception.fid_inception_v3(load_ckpt=True)[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.

class mmedit.evaluation.functional.fid_inception.FIDInceptionA(in_channels, pool_features)[source]

Bases: torchvision.models.inception.InceptionA

InceptionA block patched for FID computation.

forward(x)[source]

Get InceptionA feature maps.

Parameters

x (torch.Tensor) – Input tensor of shape BxCxHxW.

Returns

Feature Maps of x outputted by this block.

Return type

torch.Tensor

class mmedit.evaluation.functional.fid_inception.FIDInceptionC(in_channels, channels_7x7)[source]

Bases: torchvision.models.inception.InceptionC

InceptionC block patched for FID computation.

forward(x)[source]

Get InceptionC feature maps.

Parameters

x (torch.Tensor) – Input tensor of shape BxCxHxW.

Returns

Feature Maps of x outputted by this block.

Return type

torch.Tensor

class mmedit.evaluation.functional.fid_inception.FIDInceptionE_1(in_channels)[source]

Bases: torchvision.models.inception.InceptionE

First InceptionE block patched for FID computation.

forward(x)[source]

Get first InceptionE feature maps.

Parameters

x (torch.Tensor) – Input tensor of shape BxCxHxW.

Returns

Feature Maps of x outputted by this block.

Return type

torch.Tensor

class mmedit.evaluation.functional.fid_inception.FIDInceptionE_2(in_channels)[source]

Bases: torchvision.models.inception.InceptionE

Second InceptionE block patched for FID computation.

forward(x)[source]

Get second InceptionE feature maps.

Parameters

x (torch.Tensor) – Input tensor of shape BxCxHxW.

Returns

Feature Maps of x outputted by this block.

Return type

torch.Tensor

Read the Docs v: latest
Versions
master
latest
stable
zyh-re-docs
zyh-doc-notfound-extend
zyh-api-rendering
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.