bikz05 / object-detector

Object Detection Framework using HOG as descriptor and Linear SVM as classifier.
MIT License
430 stars 221 forks source link

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

Open kantajitshaw opened 7 years ago

kantajitshaw commented 7 years ago

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.

akane999 commented 7 years ago

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)

hotessy commented 7 years ago

@kantajit did your code work with this solution ?

akane999 commented 7 years ago

Yes, that worked.

azureway commented 7 years ago

@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

akane999 commented 7 years ago

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 notifications@github.com 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.