MCPcopy
hub / github.com/mseitzer/pytorch-fid / _inception_v3

Function _inception_v3

src/pytorch_fid/inception.py:166–194  ·  view source on GitHub ↗

Wraps `torchvision.models.inception_v3`

(*args, **kwargs)

Source from the content-addressed store, hash-verified

164
165
166def _inception_v3(*args, **kwargs):
167 """Wraps `torchvision.models.inception_v3`"""
168 try:
169 version = tuple(map(int, torchvision.__version__.split('.')[:2]))
170 except ValueError:
171 # Just a caution against weird version strings
172 version = (0,)
173
174 # Skips default weight inititialization if supported by torchvision
175 # version. See https://github.com/mseitzer/pytorch-fid/issues/28.
176 if version >= (0, 6):
177 kwargs['init_weights'] = False
178
179 # Backwards compatibility: `weights` argument was handled by `pretrained`
180 # argument prior to version 0.13.
181 if version < (0, 13) and 'weights' in kwargs:
182 if kwargs['weights'] == 'DEFAULT':
183 kwargs['pretrained'] = True
184 elif kwargs['weights'] is None:
185 kwargs['pretrained'] = False
186 else:
187 raise ValueError(
188 'weights=={} not supported in torchvision {}'.format(
189 kwargs['weights'], torchvision.__version__
190 )
191 )
192 del kwargs['weights']
193
194 return torchvision.models.inception_v3(*args, **kwargs)
195
196
197def fid_inception_v3():

Callers 2

__init__Method · 0.85
fid_inception_v3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected