From 9d959480a457c2e350af5d9c55d3853f470e04f7 Mon Sep 17 00:00:00 2001 From: Evening Date: Wed, 21 Feb 2024 13:17:02 +0800 Subject: [PATCH] Fix imagenet_scaling not used --- src/frdc/models/inceptionv3.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frdc/models/inceptionv3.py b/src/frdc/models/inceptionv3.py index f1a3209..29ad6ed 100644 --- a/src/frdc/models/inceptionv3.py +++ b/src/frdc/models/inceptionv3.py @@ -53,6 +53,7 @@ def __init__( sharpen_temp=0.5, mix_beta_alpha=0.75, ) + self.imagenet_scaling = imagenet_scaling self.inception = inception_v3( weights=Inception_V3_Weights.IMAGENET1K_V1, @@ -136,7 +137,7 @@ def adapt_inception_multi_channel( return inception @staticmethod - def imagenet_scaling(x: torch.Tensor) -> torch.Tensor: + def _imagenet_scaling(x: torch.Tensor) -> torch.Tensor: """Perform adapted ImageNet normalization on the input tensor. See Also: @@ -189,7 +190,7 @@ def forward(self, x: torch.Tensor): ) if self.imagenet_scaling: - x = self.imagenet_scaling(x) + x = self._imagenet_scaling(x) # During training, the auxiliary outputs are used for auxiliary loss, # but during testing, only the main output is used.