Efficient update of image plots for interactive visualization

Hi guys,

I have recently experienced a performance issue trying to update several small image plots at interactive frame rates. I would like to achieve around 10 frames per second running the server in localhost, but I can’t get more than 3-4. I’m opening this thread here since I didn’t get any reply to my question in stackoverflow:

http://stackoverflow.com/questions/40908166/efficient-updates-of-image-plots-in-bokeh-for-interactive-visualization

In my application, I have a gridplot with 4x4 image plots of 64x64 elements and the data changes continuously according to some user interaction. I update the ColumnDataSources of the plot by replacing the data dict with a new one, doing something like this:

def update():

for row in grid:
for col in row:

new_data = {‘image’: new_image}
sources[row + “_” + col].data = new_data

``

I’ve posted a minimal working example in the SO post, simulating the user interaction with a periodic callback and I get a consistent time of ~300ms per frame, no matter what. Is this the expected performance or am I doing something wrong?

If my code is ok, I suspect the JSON encoding/decoding is the cause. I’m also aware of the ongoing discussion about improving the image plot sync performance by using base64 encoding:

https://github.com/bokeh/bokeh/issues/2204

https://github.com/bokeh/bokeh/pull/5429

and I would like to know if there is any realistic plan to use the base64 encoding in master soon. Actually, if some changes are needed in the synchronization mechanism to use base64 encoding for image plots, why not to leverage this opportunity and use base64 for any numeric column in a ColumnDataDource? I guess that if the columns are sent individually as 1d arrays, just using a base64 encoding could improve the performance without too many additional changes.

Thanks,

Enrique

Bokeh version: 0.12.3

Python version: 2.7.12

OS: Mac OSX 10.11.6 (El Capitan)

As it happens, as of this week the binary encoding is now actively being worked on by someone who has up to half-time to devote to it. It's certainly possible unforeseen problems or difficulties will crop up, but I think we have a handle on most issues. I'm hopeful it can be ready for 0.12.4 which is very currently only casually scheduled for "in a few weeks" / "before the holidays".

Thanks,

Bryan

···

On Dec 2, 2016, at 5:08 AM, [email protected] wrote:

Hi guys,

I have recently experienced a performance issue trying to update several small image plots at interactive frame rates. I would like to achieve around 10 frames per second running the server in localhost, but I can't get more than 3-4. I'm opening this thread here since I didn't get any reply to my question in stackoverflow:

python - Efficient updates of image plots in Bokeh for interactive visualization - Stack Overflow

In my application, I have a gridplot with 4x4 image plots of 64x64 elements and the data changes continuously according to some user interaction. I update the ColumnDataSources of the plot by replacing the data dict with a new one, doing something like this:

def update():
...
    for row in grid:
        for col in row:
            ...
            new_data = {'image': new_image}
            sources[row + "_" + col].data = new_data

I've posted a minimal working example in the SO post, simulating the user interaction with a periodic callback and I get a consistent time of ~300ms per frame, no matter what. Is this the expected performance or am I doing something wrong?

If my code is ok, I suspect the JSON encoding/decoding is the cause. I'm also aware of the ongoing discussion about improving the image plot sync performance by using base64 encoding:

https://github.com/bokeh/bokeh/issues/2204
experimental junk by bryevdv · Pull Request #5429 · bokeh/bokeh · GitHub

and I would like to know if there is any realistic plan to use the base64 encoding in master soon. Actually, if some changes are needed in the synchronization mechanism to use base64 encoding for image plots, why not to leverage this opportunity and use base64 for any numeric column in a ColumnDataDource? I guess that if the columns are sent individually as 1d arrays, just using a base64 encoding could improve the performance without too many additional changes.

Thanks,

       Enrique

Bokeh version: 0.12.3
Python version: 2.7.12
OS: Mac OSX 10.11.6 (El Capitan)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6d37707f-68ec-4950-afcb-fd62360ee896%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thank you for your quick answer and the great news, Bryan. I’m looking forward for 0.12.4 then.

Enrique

···

El viernes, 2 de diciembre de 2016, 16:11:54 (UTC+1), Bryan Van de ven escribió:

As it happens, as of this week the binary encoding is now actively being worked on by someone who has up to half-time to devote to it. It’s certainly possible unforeseen problems or difficulties will crop up, but I think we have a handle on most issues. I’m hopeful it can be ready for 0.12.4 which is very currently only casually scheduled for “in a few weeks” / “before the holidays”.

Thanks,

Bryan

On Dec 2, 2016, at 5:08 AM, [email protected] wrote:

Hi guys,

I have recently experienced a performance issue trying to update several small image plots at interactive frame rates. I would like to achieve around 10 frames per second running the server in localhost, but I can’t get more than 3-4. I’m opening this thread here since I didn’t get any reply to my question in stackoverflow:

http://stackoverflow.com/questions/40908166/efficient-updates-of-image-plots-in-bokeh-for-interactive-visualization

In my application, I have a gridplot with 4x4 image plots of 64x64 elements and the data changes continuously according to some user interaction. I update the ColumnDataSources of the plot by replacing the data dict with a new one, doing something like this:

def update():

for row in grid:
    for col in row:
        ...
        new_data = {'image': new_image}
        sources[row + "_" + col].data = new_data

I’ve posted a minimal working example in the SO post, simulating the user interaction with a periodic callback and I get a consistent time of ~300ms per frame, no matter what. Is this the expected performance or am I doing something wrong?

If my code is ok, I suspect the JSON encoding/decoding is the cause. I’m also aware of the ongoing discussion about improving the image plot sync performance by using base64 encoding:

https://github.com/bokeh/bokeh/issues/2204

https://github.com/bokeh/bokeh/pull/5429

and I would like to know if there is any realistic plan to use the base64 encoding in master soon. Actually, if some changes are needed in the synchronization mechanism to use base64 encoding for image plots, why not to leverage this opportunity and use base64 for any numeric column in a ColumnDataDource? I guess that if the columns are sent individually as 1d arrays, just using a base64 encoding could improve the performance without too many additional changes.

Thanks,

   Enrique

Bokeh version: 0.12.3

Python version: 2.7.12

OS: Mac OSX 10.11.6 (El Capitan)


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6d37707f-68ec-4950-afcb-fd62360ee896%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.