预期2得0

时间:2019-06-26 22:11:09

标签: python python-3.x machine-learning graphics computer-vision

嗨,我想知道当它预期会收到两个但什么都没收到时如何解决此问题?另外,我一直在尝试运行名为github的代码,但是我遇到了很多错误。可以看到代码https://github.com/CSAILVision/IBD

我尝试删除下划线字符并编辑代码,以使其没有任何红线阻止其运行

import os
import settings
from loader.model_loader import loadmodel
from util.feature_operation import FeatureOperator
from util.clean import clean
from util.feature_decoder import SingleSigmoidFeatureClassifier
from util.image_operation import *
from PIL import Image
import numpy as np

from imageio import imread


from visualize.plot import random_color
from torch.autograd import Variable as V
import torch


model = loadmodel()
fo = FeatureOperator()

features, _ = fo.feature_extraction(0)

for layer_id, layer in enumerate(settings.FEATURE_NAMES):
    feat_clf = SingleSigmoidFeatureClassifier(feature=features[layer_id], layer=layer, fo=fo)
    feat_clf.load_snapshot(14, unbiased=True)

data_loader.py:156: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  result[list(np.indices(arr.shape)) + [arr]] = 1
loading features layer4
Traceback (most recent call last):
  File "test.py", line 26, in <module>
    features, _ = fo.feature_extraction(0)
ValueError: not enough values to unpack (expected 2, got 0)

1 个答案:

答案 0 :(得分:1)

阅读代码和错误消息:

features, _ = fo.feature_extraction(0)
...
not enough values to unpack (expected 2, got 0)

您尝试分配两个值,但是feature_extraction根本不返回任何值。 重新访问文档和使用说明?