bikz05 / object-detector

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

ValueError: Expected 2D array, got 1D array instead: #21

Open deekshithmr95 opened 6 years ago

deekshithmr95 commented 6 years ago

I'm running test-object-detector.py on Windows 10 64bit with python 3.6.3 (added printstatement's missing parenthesis)

python successfully downloaded and extracted 'UIUC Image Database for Car Detection' but i'm getting error here

ValueError: Expected 2D array, got 1D array instead: array=[]. Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample. Traceback (most recent call last):

how to resolve this issue?

vermouthzjh commented 6 years ago

In test-classifier.py, before pred = clf.predict(fd), add fd = [fd].

alwansm commented 6 years ago

hello @vermouthzjh I tried your method now i am getting : Traceback (most recent call last): File "test-classifier.py", line 72, in <module> pred = clf.predict(fds) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\sklearn\linear_model\base.py", line 324, in predict scores = self.decision_function(X) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\sklearn\linear_model\base.py", line 305, in decision_function % (X.shape[1], n_features)) ValueError: X has 10206 features per sample; expecting 35721

DeepInDeeper commented 6 years ago

@alwansm Hi, I met the same problems.Have u solved it?

chenqing commented 6 years ago

The same problem to me

LazyG commented 5 years ago

bump

HenryJunW commented 5 years ago

Same problem, anyone solve it yet?

Tomingz commented 5 years ago

fd=fd.reshape(1,-1) pred=clf.predict(fd) It works. but I have another error:ValueError: X has 22032 features per sample; expecting 38916,how to fix it?

fistyee commented 4 years ago

fd=fd.reshape(1,-1) pred=clf.predict(fd) It works. but I have another error:ValueError: X has 22032 features per sample; expecting 38916,how to fix it?

Same problem,, Do you solved this?