Open ShuxunoO opened 5 months ago
Can you read https://github.com/rom1504/clip-retrieval/pull/329 and propose a fix that make things work without breaking what this PR had fixed ?
Can you read #329 and propose a fix that make things work without breaking what this PR had fixed ?
Sure~ The settings of my local folder and the output of the command line:
the output is:
This is reasonable because the code uses proxy paths relative to the root directory, resulting in all dictionary keys containing subdirectories of different levels.
text_files = {text_file.relative_to(path).as_posix(): text_file for text_file in text_files}
Can you read #329 and propose a fix that make things work without breaking what this PR had fixed ?
should I make a PR again?
I met the same error as https://github.com/rom1504/clip-retrieval/issues/345 when I used
clip-retrieval inference
command to extract images and corresponding texts features, my command is like following:My local directory structure is as follows:
and the output traceback is:
——————————————————————————————————————————————————————————
After my analysis, I think the problem is that the file suffix ".txt" in "key" at this location in the code causes an issue in finding the corresponding file in the image dictionary. This is because in the source code, the possible image file extensions are: ".png", ".jpg", ".jpeg", ".bmp", ".webp", ".PNG", ".JPG", ".JPEG", ".BMP", ".WEBP".
To elaborate further, the function
folder_to_keys(folder, enable_text=True, enable_image=True, enable_metadata=False)
at this location in the code incorrectly uses filenames with suffixes as keys while constructing the dictionaries "text_files", "image_files", and "metadata_files". In fact, it should only retain the filename (removing the suffix). Here is my modified version of the code:After modifying the code, the inference process went smoothly and I successfully obtained the corresponding feature vectors for both images and texts.
I hope this can help the users with the same errors!