增强后的图片的split和stack
Opened this issue · 0 comments
creater-zq commented
您好:
-
如果我的batch_size = 4,请问是不是需要先split拆分为4个tensor,然后每个tensor当独做normlization,之后在stack为一个tensor,再送个分割网络?谢谢
-
是否可以采用下面的方式,这样batch_size可以任意?
normal = transforms.Compose([transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])])
enhanced_image = torch.Tensor(4, 3, 512, 512)
new_image = None
for idx, cur_img in enumerate(enhanced_image):
if idx == 0:
new_image = normal(cur_img).unsqueeze(dim=0)
else:
cur_img = normal(cur_img).unsqueeze(dim=0)
new_image = torch.concat((new_image, cur_img), dim=0)