tflearn:model.fit中的ValueError

时间:2016-11-07 21:08:11

标签: python tensorflow deep-learning conv-neural-network tflearn

我是TFLearn的新手,我正在尝试编写一个简单的CNN。这是我的代码:

Traceback (most recent call last):
  File "rs.py", line 46, in <module>
    run_id='rs')
  File "/usr/local/lib/python2.7/site-packages/tflearn/models/dnn.py", line 188, in fit
    run_id=run_id)
  File "/usr/local/lib/python2.7/site-packages/tflearn/helpers/trainer.py", line 277, in fit
    show_metric)
  File "/usr/local/lib/python2.7/site-packages/tflearn/helpers/trainer.py", line 684, in _train
    feed_batch)
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 717, in run
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 888, in _run
    np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
  File "/usr/local/lib/python2.7/site-packages/numpy/core/numeric.py", line 482, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.

我收到以下错误:

X

我有预感它与image_dirs_to_samples的形状有关,但我无法弄清楚如何解决它(同样,我希望@_silgen_name("UIAnimationDragCoefficient") func UIAnimationDragCoefficient() -> Float func slowAnimationsEnabled() -> Bool { return UIAnimationDragCoefficient() != 1.0 } 会返回有意义的东西tflearn)。

2 个答案:

答案 0 :(得分:0)

显然我对图像的假设不正确:它们不一定是299x299,当我将image_dirs_to_samples传递给@for $i from 0 through 99 { #small_div_#{$i} { left: (200 + 50 * $i)px; } } 时,它开始工作。但是,我仍然不明白为什么我会得到一个ValueError。

答案 1 :(得分:0)

这意味着它无法将X变成numpy数组。 它的含义是,并非列表X中的所有元素都具有相同的形状。 确保将图像加载到样本的功能确实标准化了图像的大小,如果没有,请确保所有图像的大小相同。