Skip to content

Commit a4abbed

Browse files
author
Songki Choi
authored
Fix h-label loss normalization issue w/ exclusive label group of singe label (#2604)
* Fix h-label loss normalization issue w/ exclusive label group with signle label * Fix non-linear version --------- Signed-off-by: Songki Choi <songki.choi@intel.com>
1 parent c22c683 commit a4abbed

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
1313

1414
- Fix IBLoss enablement with DeiT-Tiny when class incremental training (<https://github.com/openvinotoolkit/training_extensions/pull/2595>)
1515
- Fix mmcls bug not wrapping model in DataParallel on CPUs (<https://github.com/openvinotoolkit/training_extensions/pull/2601>)
16+
- Fix h-label loss normalization issue w/ exclusive label group of singe label (<https://github.com/openvinotoolkit/training_extensions/pull/2604>)
1617

1718
## \[v1.4.3\]
1819

src/otx/algorithms/classification/adapters/mmcls/models/heads/custom_hierarchical_linear_cls_head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def forward_train(self, cls_score, gt_label, **kwargs):
105105
losses["loss"] += multiclass_loss
106106
num_effective_heads_in_batch += 1
107107

108-
if self.hierarchical_info["num_multiclass_heads"] > 1:
108+
if num_effective_heads_in_batch > 0:
109109
losses["loss"] /= num_effective_heads_in_batch
110110

111111
if self.compute_multilabel_loss:

src/otx/algorithms/classification/adapters/mmcls/models/heads/custom_hierarchical_non_linear_cls_head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def forward_train(self, cls_score, gt_label, **kwargs):
135135
losses["loss"] += multiclass_loss
136136
num_effective_heads_in_batch += 1
137137

138-
if self.hierarchical_info["num_multiclass_heads"] > 1:
138+
if num_effective_heads_in_batch > 0:
139139
losses["loss"] /= num_effective_heads_in_batch
140140

141141
if self.compute_multilabel_loss:

0 commit comments

Comments
 (0)