Skip to content

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

@vamas2

Description

@vamas2

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions