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

[BUG] image search in the example code does not work as expected #978

Open
barney2074 opened this issue Sep 20, 2024 · 2 comments
Open

[BUG] image search in the example code does not work as expected #978

barney2074 opened this issue Sep 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@barney2074
Copy link

Hi,

I'm just following the steps in https://docs.marqo.ai/latest/examples/marqo/image-search/

  • At Step 3 (adding images to the Index), I get the below error (I'm running the Docker/Open Source in Python- so Marqo version 2.12.0)
  • The add_documents method seems to work ok- but possibly the error is in the response ??
  • Not a big deal- but noticed a typo in the index name for the cURL option in this step of the same tutorial

thanks for the tutorials- they are useful

Andrew

2024-09-20 15:54:19,251 logger:'marqo' INFO     add_documents batch 0: took 0.210s for Marqo to process & index 1 docs. Roundtrip time: 0.222s.
2024-09-20 15:54:19,483 logger:'marqo' INFO     add_documents batch 1: took 0.225s for Marqo to process & index 1 docs. Roundtrip time: 0.232s.
2024-09-20 15:54:19,663 logger:'marqo' INFO     add_documents batch 2: took 0.172s for Marqo to process & index 1 docs. Roundtrip time: 0.180s.
2024-09-20 15:54:19,871 logger:'marqo' INFO     add_documents batch 3: took 0.201s for Marqo to process & index 1 docs. Roundtrip time: 0.208s.
Traceback (most recent call last):
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/_httprequests.py", line 130, in _validate
    request.raise_for_status()
  File "/home/ub/marqo-env/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://localhost:8882/indexes/image-search/refresh

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ub/marqo/marqo-image.py", line 31, in <module>
    res = mq.index(index_name).add_documents(
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/index.py", line 410, in add_documents
    return self._add_docs_organiser(
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/index.py", line 466, in _add_docs_organiser
    res = self._batch_request(
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/index.py", line 621, in _batch_request
    self.refresh()
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/index.py", line 222, in refresh
    return self.http.post(path=F"indexes/{self.index_name}/refresh", index_name=self.index_name,)
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/_httprequests.py", line 96, in post
    return self.send_request('post', path, body, content_type, index_name=index_name)
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/_httprequests.py", line 70, in send_request
    return self._validate(response)
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/_httprequests.py", line 133, in _validate
    convert_to_marqo_error_and_raise(response=request, err=err)
  File "/home/ub/marqo-env/lib/python3.10/site-packages/marqo/_httprequests.py", line 147, in convert_to_marqo_error_and_raise
    raise MarqoWebError(message=response_msg, code=code, error_type=error_type,
marqo.errors.MarqoWebError: MarqoWebError: MarqoWebError Error message: {"detail":"Not Found"}
status_code: 404, type: unhandled_error_type, code: unhandled_error, link: 
@barney2074 barney2074 added the bug Something isn't working label Sep 20, 2024
@papa99do
Copy link
Collaborator

papa99do commented Nov 11, 2024

Hello @barney2074 , sorry for taking so long to respond. I wasn't able to reproduce this issue on the latest image. Could you give the latest image 2.13.1 a try and see if you still have this issue.

This issue might be related to the pymarqo version you use. Could you also upgrade the pymarqo to the latest version Please? Thanks a lot.

@barney2074
Copy link
Author

Hi @papa99do

that seems to have fixed it, thanks
A question if I may: although the image search queries seem to get the best match, there is very little variation in the scores

For example, in this tutorial- the search "A rider on a horse jumping over the barrier" gets the best image at a score of 58%, but other images which have noting to do with the search term still get scores >50%

I would have expected much more variation in the scores e.g a positive would be much higher, and a completely different image would have a much lower score

Is this to be expected ?

Andrew

@papa99do papa99do changed the title [BUG] [BUG] image search in the example code does not work as expected Nov 14, 2024
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

2 participants