From d1634d47026815cf46961fde832df4d2ce6aa9a4 Mon Sep 17 00:00:00 2001 From: Tingquan Gao Date: Fri, 23 Aug 2024 11:51:43 +0800 Subject: [PATCH] fix: there may not be weight ratio in multilabel dataset label (#3227) --- ppcls/loss/multilabelloss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppcls/loss/multilabelloss.py b/ppcls/loss/multilabelloss.py index 2dd61d1c7b..51ae978388 100644 --- a/ppcls/loss/multilabelloss.py +++ b/ppcls/loss/multilabelloss.py @@ -39,7 +39,7 @@ def _labelsmoothing(self, target, class_num): def _binary_crossentropy(self, input, target, class_num): if self.weight_ratio: target, label_ratio = target[:, 0, :], target[:, 1, :] - else: + elif target.ndim == 3: target = target[:, 0, :] if self.epsilon is not None: target = self._labelsmoothing(target, class_num)