Open segalinc opened 2 years ago
Hi @segalinc Could you share a code snippet of how you're running it and preferably a sample of strings that you're using as your local paths? Also what notebooks environment you're running it in? (e.g.: Jupyter, Google Colab, etc.)
I am using jupyter notebook
here is the line I am calling
ipyplot.plot_class_tabs(df.path, df.feature_code, custom_texts = df.feature_value.astype(float).round(4), show_url=False, tabs_order=cols)
where df.path is a dataframe columns with strings like data/image_name.jpg
and data is in the same folder as the notebook I am running
I used the same command line where df.path was an url instead and it worked fine
I also tired to have a column with the loaded pil images too but it doesn't work
force_b64=True
takes forever to run and than crashes
Since you mentioned it works fine when you try running ipyplot directly with string URLs I would bet that there's something funky happening when you pass your column (pandas series object) as an input. Maybe the data type is something else than string? Please try running the following lines an let me know what is the output:
print(df.path.dtype)
print(type(df.path.values[0]))
print(type(df.path[0]))
I'm trying to recreate your scenario but I'm failing to get any errors. I have the same setup as you with data folder with images located in the same dir as my notebook and I run something like this with success:
Please provide the following info for me to try recreate your issue:
Hi thank you again for helping. this are the info you requested
ipyplot==1.1.1 python==3.7.12 pandas==1.3.5
print(df.path.dtype) --> object print(type(df.path.values[0])) --> <class 'str'> print(type(df.path[0])) --> <class 'str'>
Thanks for providing additional info.
I'm trying to recreate this issue but it doesn't show up in any of my test environments...
I assume simply running ipyplot.plot_images(df.path)
doesn't work either?
No it doesn't
Are there any special characters in the image paths? Such as space
, &
, $
, %
?
Could you please share few actual strings from df.path
?
No, here are some examples 0 img/60027106_1672795_141993.jpg 1 img/60027106_1672795_100199.jpg 2 img/60027106_1672795_15606.jpg
Just to be absolutely sure - if you run bellow code it displays images correctly?
images = ["img/60027106_1672795_141993.jpg", "img/60027106_1672795_100199.jpg", "img/60027106_1672795_15606.jpg"]
ipyplot.plot_images(images)
no, that doesn't work either
And img
directory is located in the same directory as the .ipynb
notebook file you're running your code from?
At which directory level is your jupyter server running?
yes it is. it runs internally in our infrastructure. I also tried using absolute paths but same issue. tried also reading the images in PIL and expose them directly but seems like it has issue loading them too
That's very odd.. There's a known issue with not displaying images from directories outside of Jupyter server scope but I'm not convinced if that's the case here. You can check this thread to find out if it's relevant at all for your case.
And as for PIL, does this work for you?
from PIL import Image
images = ["img/60027106_1672795_141993.jpg", "img/60027106_1672795_100199.jpg", "img/60027106_1672795_15606.jpg"]
ipyplot.plot_images([Image.open(path) for path in images])
that's exactly what I tried and it doesn't work. I also already checked that issue before opening this one Using force_b64 takes forever to run and than it doesn't even show anything afterall, very odd
What's the error message when you try to open images with PIL?
the is no error message at all, when I run the cell, it seems running then the kernel look like had completed the execution but the cell still shows the * as it is still working on it and no output, same with the path and force_b64
That's super weird. As much as I'd like to help you, I'm afraid I'm out of ideas at this point..
I appreciated you bared with me so far. I might ask some of my peers if they have any issue as well using the tool should we leave this open ?
Yes, let's leave this issue open for now, thanks. If you will get to the bottom of this at any point, please loop back and drop a msg here for others. Good luck!
it seems that even passing the numpy version of the images doesn't work as I saw you can also pass arrays I can open and show the images in the notebook with Image.open(local_path) though so this is a bit weird
Wait, Image.open()
works for you but when you do this: ipyplot.plot_images([Image.open(local_path)])
it doesn't work? Is that correct?
That is extremely weird and I have zero explanation for such behavior
ipyplot.plot_images([Image.open(local_path)])
this works
this works too ipyplot.plot_images([Image.open(i) for i in df.path.iloc[:10]])
all the others, list of path, df column with paths, df columns with loaded images don't work, I also see that bc of the use of Image the RAM goes up quite a bit like is loading all the images in
i have the same issue, when i try to load a list of strings, i get empty image symbols. when i load the images and insert a list of images to the function - it works fine. the problem is that i have many images and i wanted to leverage on the random selection of images from max_imgs_per_tab, loading all the images results in ram overload
Hi there, I am using ipyplot.plot_class_tabs where the images is a pd.Series of local paths when running the line, it doesn't show the images, only the icon of the image as it's not able to load them. the paths are already relative paths in a folder in the same directory of the notebook I am running Images are all jpg format
Am I missing something?
I also tried using the absolute path but still same issue Thank you for the help