PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

关于label维度和logit维度不一致的问题

Open ww451575464 opened this issue 3 years ago • 2 comments

在使用自己数据进行训练的时候,发现报错 [Hint: Expected labels_dims[axis] == 1UL, but received labels_dims[axis]:3 != 1UL:1.] 猜测是label图片读取的时候,通道数为3,查了下dataset.py和transforms.py的代码,在Compose这个类中,关于label图片的读取是 label = np.asarray(Image.open(label)) 改成 label = cv2.imwrite(label, cv2.IMREAD_GRAYSCALE) 此时报错解除,但不确定是否有效 不知道是我的图片的问题还是哪里不对

ww451575464 avatar Apr 09 '21 08:04 ww451575464

@ww451575464 Hi, yes, your label format is wrong. It should be a single channel.

michaelowenliu avatar Apr 09 '21 11:04 michaelowenliu

I have the same issue . Can you please be more specific on which .py files you changed? I can't seem to find it. Thanks!

fschvart avatar Jun 26 '22 22:06 fschvart

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 06 '22 17:12 github-actions[bot]

生成蒙版要是: cv2.imwrite('Annotations/'+(imagName),np_img),不能是:cv2.imwrite('okMask/'+(imagName), cv2.cvtColor(np_img, cv2.COLOR_RGB2BGR) )

gg22mm avatar Mar 14 '23 06:03 gg22mm