milvus-io / bootcamp

Dealing with all unstructured data, such as reverse image search, audio search, molecular search, video analysis, question and answer systems, NLP, etc.

Home Page:https://milvus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: ERROR: Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'

vhwzx opened this issue · comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I run the docker-compose followed by /bootcamp/solution/reverse_image_search/quick_deploy readme.
i input path in front page and click '+', nothing happend.
i checked the log of img-search-webserver, it show some error message :

INFO:     172.20.31.21:5608 - "POST /img/load HTTP/1.1" 500 Internal Server Error
2023-02-11 03:57:11,145 - 140657349613376 - milvus_helpers.py-milvus_helpers:121 - DEBUG: Successfully get the num:0 of the collection:milvus_img_search
2023-02-11 03:57:11,145 - 140657349613376 - main.py-main:125 - INFO: Successfully count the number of images!
2023-02-11 03:57:11,145 | INFO | main.py | count_images | 125 | Successfully count the number of images!
INFO:     172.20.31.21:7393 - "POST /img/count HTTP/1.1" 200 OK
INFO:     172.20.31.21:7393 - "OPTIONS /img/load HTTP/1.1" 200 OK
2023-02-11 03:57:15,008 - 140657349613376 - helpers.py-helpers:247 - INFO: Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,008 | INFO | helpers.py | load_pretrained | 247 | Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,099 | ERROR | load.py | extract_features | 37 | Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:15,099 - 140657349613376 - load.py-load:37 - ERROR: Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:15,344 - 140657349613376 - helpers.py-helpers:247 - INFO: Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,344 | INFO | helpers.py | load_pretrained | 247 | Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,411 - 140657349613376 - load.py-load:37 - ERROR: Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:15,411 | ERROR | load.py | extract_features | 37 | Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:15,653 | INFO | helpers.py | load_pretrained | 247 | Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,653 - 140657349613376 - helpers.py-helpers:247 - INFO: Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,720 - 140657349613376 - load.py-load:37 - ERROR: Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:15,720 | ERROR | load.py | extract_features | 37 | Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:15,967 | INFO | helpers.py | load_pretrained | 247 | Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:15,967 - 140657349613376 - helpers.py-helpers:247 - INFO: Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth)
2023-02-11 03:57:16,040 | ERROR | load.py | extract_features | 37 | Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:16,040 - 140657349613376 - load.py-load:37 - ERROR: Error with extracting feature from image __init__() missing 3 required positional arguments: 'height', 'channel', and 'mode'
2023-02-11 03:57:16,047 - 140657349613376 - milvus_helpers.py-milvus_helpers:72 - ERROR: Failed to load data to Milvus: list index out of range
2023-02-11 03:57:16,047 | ERROR | milvus_helpers.py | insert | 72 | Failed to load data to Milvus: list index out of range
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/app/src/milvus_helpers.py", line 65, in insert
    mr = self.collection.insert(data)
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/collection.py", line 528, in insert
    if not self._check_insert_data_schema(data):
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/collection.py", line 179, in _check_insert_data_schema
    infer_fields = parse_fields_from_data(data)
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/schema.py", line 296, in parse_fields_from_data
    d_type = infer_dtype_bydata(d[0])
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 396, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 86, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 142, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 241, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 52, in app
    response = await func(request)
  File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 215, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 149, in run_endpoint_function
    return await dependant.call(**values)
  File "main.py", line 70, in load_images
    total_num = do_load(item.Table, item.File, MODEL, MILVUS_CLI, MYSQL_CLI)
  File "/app/src/operations/load.py", line 59, in do_load
    ids = milvus_client.insert(table_name, vectors)
  File "/app/src/milvus_helpers.py", line 73, in insert
    sys.exit(1)
SystemExit: 1
2023-02-11 03:57:16,047 - 140657349613376 - h11_impl.py-h11_impl:399 - ERROR: Exception in ASGI application
Traceback (most recent call last):
  File "/app/src/milvus_helpers.py", line 65, in insert
    mr = self.collection.insert(data)
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/collection.py", line 528, in insert
    if not self._check_insert_data_schema(data):
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/collection.py", line 179, in _check_insert_data_schema
    infer_fields = parse_fields_from_data(data)
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/schema.py", line 296, in parse_fields_from_data
    d_type = infer_dtype_bydata(d[0])
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 396, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 86, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 142, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 241, in handle
2023-02-11 03:57:16,047 | ERROR | h11_impl.py | run_asgi | 399 | Exception in ASGI application
Traceback (most recent call last):
  File "/app/src/milvus_helpers.py", line 65, in insert
    mr = self.collection.insert(data)
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/collection.py", line 528, in insert
    if not self._check_insert_data_schema(data):
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 52, in app
    response = await func(request)
  File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 215, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 149, in run_endpoint_function
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/collection.py", line 179, in _check_insert_data_schema
    infer_fields = parse_fields_from_data(data)
  File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/schema.py", line 296, in parse_fields_from_data
    d_type = infer_dtype_bydata(d[0])
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 396, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 86, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 142, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 241, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 52, in app
    response = await func(request)
  File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 215, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 149, in run_endpoint_function
    return await dependant.call(**values)
  File "main.py", line 70, in load_images
    total_num = do_load(item.Table, item.File, MODEL, MILVUS_CLI, MYSQL_CLI)
  File "/app/src/operations/load.py", line 59, in do_load
    ids = milvus_client.insert(table_name, vectors)
  File "/app/src/milvus_helpers.py", line 73, in insert
    sys.exit(1)
SystemExit: 1
INFO:     172.20.31.21:7393 - "POST /img/load HTTP/1.1" 500 Internal Server Error
    return await dependant.call(**values)
  File "main.py", line 70, in load_images
    total_num = do_load(item.Table, item.File, MODEL, MILVUS_CLI, MYSQL_CLI)
  File "/app/src/operations/load.py", line 59, in do_load
    ids = milvus_client.insert(table_name, vectors)
  File "/app/src/milvus_helpers.py", line 73, in insert
    sys.exit(1)
SystemExit: 1

i think this is similar to #974
I am using the docker containe(option 1) and milvus server is up.
I manually connect to milvus and after check, I find the collection "milvus_img_search" is created successfully, as shown in figure.

root@468fd21cc902:/app/src# python -im milvus_helpers
>>> milvus = MilvusHelper()
>>> milvus.has_collection("milvus_img_search")
True
>>>

in webserver.volumes, I use the absolute path and only 4 images in that folder

Expected Behavior

No response

Steps To Reproduce

No response

Software version

Milvus: [e.g. 2.0.0rc1]
Server: [e.g. 2.0.0]
Client: [e.g. 2.0.0]

Anything else?

No response

Do you have solved this error? I also get it

Don't use towhee-0.6.0,upgrade the version!
I use towhee-0.9.0 to solve this issue!

commented

@antelopeh

bro,
I already update towhee from 0.6.0 to 0.9.0, but met error.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. flask 2.2.3 requires click>=8.0, but you have click 7.1.2 which is incompatible.

then, I reinstall the click with version 8.*, an error occurrenced again.

uvicorn 0.13.4 requires click==7.*, but you have click 8.1.3 which is incompatible.

how do you fix it ?

commented

Don't use towhee-0.6.0,upgrade the version! I use towhee-0.9.0 to solve this issue!

upgrade to 0.9.0, have this error:
Error with extracting feature from image No module named 'towhee.utils.pandas_utils'

I'm facing a similar issue and I've tried with towhee versions 1.1.0 as well as 0.9.0 but they result in the same error. Did someone figure out how to solve this?

commented

I'm facing a similar issue and I've tried with towhee versions 1.1.0 as well as 0.9.0 but they result in the same error. Did someone figure out how to solve this?

I didn't solve the problem, but (a few month ago) I followed another tutorial in this repository and successed. It seems that the README file has been updated and is not same as when I open this issue. I suggest to follow the new README.

Hi @ALL, I have updated the code about image search with the latest Milvus and Towhee #1157, please pull the code and try again.