_宠幸_ 2022-09-09 09:46 采纳率: 75%
浏览 1888
已结题

ValueError: too many values to unpack (expected 2)

feat_pool, feat_fc = net(input, input, test_mode[1])
ValueError: too many values to unpack (expected 2)

with torch.no_grad():
    for batch_idx, (input, label ) in enumerate(query_loader):
        batch_num = input.size(0)
        input = Variable(input.cuda())
        feat_pool, feat_fc = net(input, input, test_mode[1])
        query_feat_pool[ptr:ptr+batch_num,: ] = feat_pool.detach().cpu().numpy()
        query_feat_fc[ptr:ptr+batch_num,: ]   = feat_fc.detach().cpu().numpy()
        ptr = ptr + batch_num         
print('Extracting Time:\t {:.3f}'.format(time.time()-start))
return query_feat_pool, query_feat_fc

其中query_loader = data.DataLoader(queryset, batch_size=args.test_batch, shuffle=False, num_workers=0)

Traceback (most recent call last):
File "E:/韩志忠学习/海军21code/DGTL-for-VT-ReID-main/test.py", line 266, in
query_feat_pool, query_feat_fc = extract_query_feat(query_loader)
File "E:/韩志忠学习/海军21code/DGTL-for-VT-ReID-main/test.py", line 156, in extract_query_feat
feat_pool, feat_fc = net(input, input, test_mode[1])
ValueError: too many values to unpack (expected 2)

  • 写回答

4条回答 默认 最新

  • 怀念不必想念 2022-09-09 10:07
    关注

    eat_pool, feat_fc = net(input, input, test_mode[1])这段话的
    net函数的返回值给多了,看下net的return几个变量

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 9月17日
  • 已采纳回答 9月9日
  • 创建了问题 9月9日

悬赏问题

  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决