Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sklearn ValueError: Expected 2D array, got 1D array instead: #850

Closed
wangjingquang opened this issue May 9, 2023 · 2 comments
Closed

sklearn ValueError: Expected 2D array, got 1D array instead: #850

wangjingquang opened this issue May 9, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@wangjingquang
Copy link

when i commit a mp4 file upload to system, error happened. error is below, how to fix the bug, thx!

/mnt/e/venvs/librephotos/lib/python3.10/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'api.models.person.Person'> QuerySet.
paginator = self.django_paginator_class(queryset, page_size)
Internal Server Error: /api/clusterfaces
Traceback (most recent call last):
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/mnt/e/venvs/librephotos/backend/api/views/dataviz.py", line 18, in get
res = cluster_faces(request.user)
File "/mnt/e/venvs/librephotos/backend/api/face_classify.py", line 43, in cluster_faces
vis_all = pca.fit_transform(face_encoding)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/sklearn/utils/_set_output.py", line 140, in wrapped
data_to_wrap = f(self, X, *args, **kwargs)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/sklearn/decomposition/_pca.py", line 462, in fit_transform
U, S, Vt = self._fit(X)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/sklearn/decomposition/_pca.py", line 485, in _fit
X = self._validate_data(
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/sklearn/base.py", line 565, in _validate_data
X = check_array(X, input_name="X", **check_params)
File "/mnt/e/venvs/librephotos/lib/python3.10/site-packages/sklearn/utils/validation.py", line 902, in check_array
raise ValueError(
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.
17:22:38 Cleaning registries for queue: default

@wangjingquang wangjingquang added the bug Something isn't working label May 9, 2023
@clemenz5
Copy link

I have the same issue, but i don't think a mp4 raised it

@derneuere
Copy link
Member

This error indicates that something went wrong when viewing the faces cluster at /facescatter. This error has nothing to do with uploading.

Added a check to only show faces which have an encoding and solved a potential memory issue with pagination. This is available on dev and will land in latest in the next release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants