HOG-SVM-python
HOG-SVM-python copied to clipboard
Erorr while running test-classifier.py
Hello I am reciving the following error :
Traceback (most recent call last): File "test-classifier.py", line 69, in
pred = clf.predict(fd) 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 300, in decision_function X = check_array(X, accept_sparse='csr') File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\sklearn\utils\validation.py", line 441, in check_array "if it contains a single sample.".format(array)) ValueError: Expected 2D array, got 1D array instead: array=[0. 0. 0. ... 0. 0. 0.]. 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.
so am I
you can add fd = fd.reshape(1,-1) before pred = clf.predict(fd) which is the line 69 of test-classifier.py
https://github.com/yjl9122/object-detector-master/blob/5baa2d715b7c7a69a33328ef01f67d0af3c0b682/object-detector/test-classifier.py#L69