Indian-Sign-Language-Recognition icon indicating copy to clipboard operation
Indian-Sign-Language-Recognition copied to clipboard

preprocessing_surf.py Value Error: Expected 2D array, got 1D array instead

Open vamas2 opened this issue 5 years ago • 9 comments

sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning) C:\Users\bipin\Anaconda3\lib\site-packages\sklearn\grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20. DeprecationWarning) Train-test-val split: 0 training rows, 0 test rows, 0 validation rows 0 descriptors before clustering Using clustering model MiniBatchKMeans(batch_size=100, compute_labels=True, init='k-means++', init_size=None, max_iter=100, max_no_improvement=10, n_clusters=150, n_init=3, random_state=None, reassignment_ratio=0.01, tol=0.0, verbose=0)... Clustering on training set to get codebook of 150 words Traceback (most recent call last): File "preprocessing_surf.py", line 204, in X, cluster_model = cluster_features(img_descs, training_idxs, MiniBatchKMeans(n_clusters=150)) File "preprocessing_surf.py", line 120, in cluster_features cluster_model.fit(all_train_descriptors) File "C:\Users\bipin\Anaconda3\lib\site-packages\sklearn\cluster\k_means_.py", line 1354, in fit dtype=[np.float64, np.float32]) File "C:\Users\bipin\Anaconda3\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=[]. 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.

This is the error I get when I try to run preprocessing_surf.py. How do I solve this error?

vamas2 avatar Apr 24 '19 15:04 vamas2

Put the train folder in the same folder with four files mentioned..

yashsinojiya1898 avatar Apr 27 '19 08:04 yashsinojiya1898

@yashsinojiya1898 i have. but it says that the array must be non-empty

vamas2 avatar Apr 28 '19 10:04 vamas2

use '/ ' instead of '\' and '\\' .

ashok2811 avatar Oct 31 '19 23:10 ashok2811

Thank you for replying..😀

On Fri, Nov 1, 2019 at 5:10 AM Ashok Kumar Chaudhary < [email protected]> wrote:

use '/ ' instead of '' and '\' .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/imRishabhGupta/Indian-Sign-Language-Recognition/issues/7?email_source=notifications&email_token=AFINAQ7AU6BSNRZSIIGIK7LQRNUFRA5CNFSM4HIFFYPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZSHCA#issuecomment-548610952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFINAQYAEM4PMUJNAF3Q7CDQRNUFRANCNFSM4HIFFYPA .

yashsinojiya1898 avatar Nov 02 '19 09:11 yashsinojiya1898

@yashsinojiya1898 The folder, did you mean in sklearn ? I am facing the same error right now.

Amchuz avatar Mar 17 '20 05:03 Amchuz

@yashsinojiya1898 The folder, did you mean in sklearn ? I am facing the same error right now.

No, put it in the same folder where your code files are.

yashsinojiya1898 avatar Mar 17 '20 05:03 yashsinojiya1898

@yashsinojiya1898 Thanks for the reply. I have put it in the same folder but its not working.

Amchuz avatar Mar 17 '20 06:03 Amchuz

I am facing the same problem..any solutions @yashsinojiya1898

bhanu-1902 avatar Nov 15 '21 11:11 bhanu-1902

is your problem solved? if yes can you tell me how did you do it?

snehanals14 avatar Mar 23 '22 15:03 snehanals14