object-detector icon indicating copy to clipboard operation
object-detector copied to clipboard

Error when training: ValueError: setting an array element with a sequence.

Open kantajitshaw opened this issue 8 years ago • 5 comments

I was running test-object-detector in bin. It gives me following error:

Training a Linear SVM Classifier Traceback (most recent call last): File "../object-detector/train-classifier.py", line 48, in clf.fit(list(np.array(fds)), labels) File "/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.py", line 151, in fit X, y = check_X_y(X, y, dtype=np.float64, order='C', accept_sparse='csr') File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 521, in check_X_y ensure_min_features, warn_on_dtype, estimator) File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 382, in check_array array = np.array(array, dtype=dtype, order=order, copy=copy) ValueError: setting an array element with a sequence.

Please fix this issue.

kantajitshaw avatar Feb 23 '17 06:02 kantajitshaw

Hi, hog function returns 2 values, so you have to change the line 45 and 55 of extract-features.py with this line fd,hogimage = hog(im, orientations, pixels_per_cell, cells_per_block, visualize, normalize)

akane999 avatar Feb 25 '17 23:02 akane999

@kantajit did your code work with this solution ?

hotessy avatar Aug 18 '17 18:08 hotessy

Yes, that worked.

akane999 avatar Aug 21 '17 02:08 akane999

@akane999 I did the same thing as you said corresponding to the same issue. But I got the error shown as below: Traceback (most recent call last): File "../object-detector/extract-features.py", line 58, in fd,hogimage = hog(im, orientations, pixels_per_cell, cells_per_block, visualize, normalize) ValueError: too many values to unpack

If I change back, it game me the previous error again. Any advise? thanks

azureway avatar Aug 28 '17 02:08 azureway

Please check the dimensions of your data, this error means that an argument that should be a single value is an array, so It will not work.

So check the dimensions.


De: azureway [email protected] Enviado: lunes, 28 de agosto de 2017 02:16 a. m. Para: bikz05/object-detector CC: akane999; Mention Asunto: Re: [bikz05/object-detector] Error when training: ValueError: setting an array element with a sequence. (#10)

@akane999https://github.com/akane999 I did the same thing as you said corresponding to the same issue. But I got the error shown as below: Traceback (most recent call last): File "../object-detector/extract-features.py", line 58, in fd,hogimage = hog(im, orientations, pixels_per_cell, cells_per_block, visualize, normalize) ValueError: too many values to unpack

If I change back, it game me the previous error again. Any advise? thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/bikz05/object-detector/issues/10#issuecomment-325244456, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKOqjYtQOhZp2TgpsmAgdBeBbax3HWBzks5sciMLgaJpZM4MJmg3.

akane999 avatar Aug 28 '17 14:08 akane999