Coder Social home page Coder Social logo

Comments (23)

karolzak avatar karolzak commented on August 23, 2024

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.)

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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:
image

Please provide the following info for me to try recreate your issue:

  • Which version of ipyplot, python and pandas are you using?

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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'>

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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?

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

No it doesn't

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

Are there any special characters in the image paths? Such as space, &, $, %?
Could you please share few actual strings from df.path?

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

No, here are some examples
0 img/60027106_1672795_141993.jpg
1 img/60027106_1672795_100199.jpg
2 img/60027106_1672795_15606.jpg

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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)

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

no, that doesn't work either

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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?

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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])

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

What's the error message when you try to open images with PIL?

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

That's super weird. As much as I'd like to help you, I'm afraid I'm out of ideas at this point..

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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 ?

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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!

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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

from ipyplot.

karolzak avatar karolzak commented on August 23, 2024

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

from ipyplot.

segalinc avatar segalinc commented on August 23, 2024

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

from ipyplot.

GonyRosenman avatar GonyRosenman commented on August 23, 2024

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

from ipyplot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.