Skip to content

Commit

Permalink
🛠 Fix the loss-val (#425) in STFPM
Browse files Browse the repository at this point in the history
  • Loading branch information
samet-akcay authored Jul 11, 2022
1 parent 7e34bb1 commit 00492cf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions anomalib/models/stfpm/lightning_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def __init__(
layers=layers,
)
self.loss = STFPMLoss()
self.loss_val = 0

def training_step(self, batch, _): # pylint: disable=arguments-differ
"""Training Step of STFPM.
Expand All @@ -72,8 +71,7 @@ def training_step(self, batch, _): # pylint: disable=arguments-differ
"""
self.model.teacher_model.eval()
teacher_features, student_features = self.model.forward(batch["image"])
loss = self.loss_val + self.loss(teacher_features, student_features)
self.loss_val = 0
loss = self.loss(teacher_features, student_features)
return {"loss": loss}

def validation_step(self, batch, _): # pylint: disable=arguments-differ
Expand Down

0 comments on commit 00492cf

Please sign in to comment.