image_embeddings icon indicating copy to clipboard operation
image_embeddings copied to clipboard

image extension .jpeg hardcoded

Open zubairahmed-ai opened this issue 4 years ago • 3 comments

Hi

You have hardcoded extension .jpeg which makes it harder to try other images

<ipython-input-42-a444c2d0177a> in <module>
      1 p=1
      2 print(id_to_name[p])
----> 3 image_embeddings.knn.display_picture(path_images, id_to_name[p])
      4 results = image_embeddings.knn.search(index, id_to_name, embeddings[p])
      5 image_embeddings.knn.display_results(path_images, results)

~/miniconda3/envs/tracker/lib/python3.8/site-packages/image_embeddings/knn/knn.py in display_picture(image_path, image_name)
     54 
     55 def display_picture(image_path, image_name):
---> 56     display(Image(filename=f"{image_path}/{image_name}.jpeg"))
     57 
     58 

zubairahmed-ai avatar Oct 16 '20 10:10 zubairahmed-ai

The current code only supports jpeg yes. It could be possible to add support to other formats but it's not only the extension that needs to be changed, a conversion step should be added

On Fri, Oct 16, 2020, 12:07 Zubair Ahmed [email protected] wrote:

Hi

You have hardcoded extension .jpeg which makes it harder to try other images

in 1 p=1 2 print(id_to_name[p]) ----> 3 image_embeddings.knn.display_picture(path_images, id_to_name[p]) 4 results = image_embeddings.knn.search(index, id_to_name, embeddings[p]) 5 image_embeddings.knn.display_results(path_images, results)

~/miniconda3/envs/tracker/lib/python3.8/site-packages/image_embeddings/knn/knn.py in display_picture(image_path, image_name) 54 55 def display_picture(image_path, image_name): ---> 56 display(Image(filename=f"{image_path}/{image_name}.jpeg")) 57 58

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rom1504/image_embeddings/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437WDIZFPQD4UVWOGFKDSLALM5ANCNFSM4STEHE5A .

rom1504 avatar Oct 16 '20 10:10 rom1504

Thanks for replying, already changed the extension to jpg and using the new module after change

zubairahmed-ai avatar Oct 16 '20 10:10 zubairahmed-ai

Must also include a function to loop through all available images and display, the ordering on the file system isn't the same as index

zubairahmed-ai avatar Oct 16 '20 10:10 zubairahmed-ai