赞
踩
ValueError: not enough values to unpack (expected 16, got 9)
函数或模型的返回参数错误(数目错误):在这里模型默认返回9个参数,但预期是16个。
# 训练一次
losses, fake_image, real_image, input_label, L1_loss, style_loss, clothes_mask, warped, refined, CE_loss, rx, ry, cx, cy, rg, cg = model(
Variable(data['label'].unsqueeze(0).cuda()), Variable(data['edge'].unsqueeze(0).cuda()),
Variable(img_fore.unsqueeze(0).cuda()),
Variable(mask_clothes.unsqueeze(0).cuda()), Variable(data['color'].unsqueeze(0).cuda()),
Variable(all_clothes_label.unsqueeze(0).cuda()),
Variable(data['image'].unsqueeze(0).cuda()), Variable(data['pose'].unsqueeze(0).cuda()),
Variable(data['image'].unsqueeze(0).cuda()),
Variable(mask_fore.unsqueeze(0).cuda()))
这里,要求返回16个参数,模型默认只返回9个。
def forward(self, label, pre_clothes_mask, img_fore, clothes_mask, clothes, all_clothes_label, real_image, pose,
grid, mask_fore):
# Encode Inputs
.....................
return [fake_image, clothes, arm_label, L1_loss, style_loss, fake_cl, CE_loss, real_image, warped_grid]
将返回值数量和接受参数的变量数目改成一致。
fake_image, real_image, input_label, L1_loss, style_loss, clothes_mask, CE_loss, rgb, alpha = model(
Variable(data['label'].unsqueeze(0).cuda()), Variable(data['edge'].unsqueeze(0).cuda()), Variable(img_fore.unsqueeze(0).cuda()),
Variable(mask_clothes.unsqueeze(0).cuda())
, Variable(data['color'].unsqueeze(0).cuda()), Variable(all_clothes_label.unsqueeze(0).cuda()), Variable(data['image'].unsqueeze(0).cuda()),
Variable(data['pose'].unsqueeze(0).cuda()), Variable(data['image'].unsqueeze(0).cuda()), Variable(mask_fore.unsqueeze(0).cuda()))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。