Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为啥在dataloader第40行转换的array的shape和cv2不一样呢 #32

Closed
futureflsl opened this issue Aug 22, 2022 · 1 comment
Closed

Comments

@futureflsl
Copy link

我使用json_to_dataset.py转化mask后尝试使用代码查看shape
import cv2
import numpy as np
from PIL import Image

file = '/home/fut/Downloads/unet-pytorch-main/mydata/masks/ID_1110_json.png'
img = cv2.imread(file, cv2.IMREAD_UNCHANGED)
print(img.shape)

pil = Image.open(file)
img2 = np.array(pil)
print(img2.shape)
结果会是:
(800, 800, 3)
(800, 800)
为什么PIL读取后通道就没了,正是因为这个原因你的项目会很好跑起来。

@futureflsl
Copy link
Author

发现是get_random_data有个转L操作,问题已经清楚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant