(self, device="cuda", choices=["fid"], video_frame=None)
| 12 | |
| 13 | class MyMetric: |
| 14 | def __init__(self, device="cuda", choices=["fid"], video_frame=None): |
| 15 | self.choices = choices |
| 16 | self.device = device |
| 17 | if "fid" in choices: |
| 18 | self._fid = FrechetInceptionDistance( |
| 19 | feature=2048, |
| 20 | reset_real_features=True, |
| 21 | normalize=False, |
| 22 | sync_on_compute=True, |
| 23 | ).to(device) |
| 24 | if "is" in choices: |
| 25 | self._is = InceptionScore().to(device) |
| 26 | if "kid" in choices: |
| 27 | self._kid = KernelInceptionDistance(subset_size=50).to(device) |
| 28 | if "prdc" in choices: |
| 29 | self._prdc = PRDC(nearest_k=5).to(device) |
| 30 | if "sfid" in choices: |
| 31 | self._sfid = sFrechetInceptionDistance().to(device) |
| 32 | if "fdd" in choices: |
| 33 | self._fdd = FrechetDinovDistance().to(device) |
| 34 | if "fvd" in choices: |
| 35 | self._fvd = FrechetVideoDistance() |
| 36 | self.video_frame = video_frame |
| 37 | assert video_frame is not None, "video_frame is None" |
| 38 | |
| 39 | def update_real(self, data, real=True): |
| 40 | self.update_fake_and_real(data, real) |
nothing calls this directly
no test coverage detected