-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
在paddleseg/models/losses/cross_entropy_loss.py中的CrossEntropyLoss类49-52行代码处,当有权重参数时会将权重扩充到256的长度,但是forward函数中调用的paddle.nn.functional.cross_entropy接受的权重参数应该和分类类别相同,这么处理会引起异常(cityscapes 19类为例):
ValueError:inputs's class_dimension(19) must equal to weight's class_dimension(256) when weight is provided.
在paddleseg-develop和paddleseg-release2.3中都有这个问题,paddleseg-release2.2中无此bug。
部分代码如下:
`
self.weight = paddle.to_tensor(weight, dtype='float32')
long_weight = weight + [0] * (256 - len(weight)) 《============这里有bug,不应该固定为256的长度
self.long_weight = paddle.to_tensor(long_weight, dtype='float32')
`
Metadata
Metadata
Assignees
Labels
No labels