hoffstadt / hoffstadt/DearPyGui
Very high GPU and RAM use when displaying image series
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.6.2
Operating System: Windows 10
## My Issue/Question
I have noticed that when I display a texture the GPU usage in Task Manager is very high. I am displaying two textures (two PNG images of about 4MB each, though this also occurs with jpgs), and my GPU usage is about 90% (using a NVIDIA T1200 Laptop GPU).
The weirdest part is that if I am actively loading in new images, the GPU usage drops down to about 40%, but as soon as I stop loading new images in, the GPU goes to 90%.
Also, the frame-rate tanks to close to 20 FPS after the images have been loaded.
## To Reproduce
Steps to reproduce the behavior:
1. Create a DPG plot
2. Add a texture to the texture registry
3. Add the texture as an image series
4. Show the image series
5. Note the high GPU usage
## Expected behavior
DPG GPU usage would be high during loading and initial display, but lower after the image has been loaded.
## Screenshots/Video

You can see before clicking load images, after, and then after the application is closed in this small graph.

## Standalone, minimal, complete and verifiable example
Here's the [image](https://unsplash.com/photos/Yj1M5riCKk4/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8Mnx8c3BhY2V8ZW58MHx8fHwxNjU0NjMzMzUy&force=true) I used. I renamed it to `nasa.jpg`.
```python
# Here's some code anyone can copy and paste to reproduce your issue
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(title='Custom Title', width=1600, height=1000)
with dpg.window(label="View One", tag="view_one", min_size=(int(dpg.get_viewport_width()), dpg.get_viewport_height())):
dpg.add_plot(
tag=f"curr_image_plot_1",
height=-1,
width=-1,
crosshairs=True,
query=True,
equal_aspects=True,
)
dpg.add_plot_axis(label="Width",
axis=1,
tag=f"curr_image_plot_x_axis_1",
no_gridlines=False,
lock_min=False,
parent=f"curr_image_plot_1")
dpg.add_plot_axis(label="Height",
axis=2,
tag=f"curr_image_plot_y_axis_1",
no_gridlines=False,
lock_min=False,
parent=f"curr_image_plot_1")
def load_images():
width, height, _, data = dpg.load_image("nasa.jpg")
with dpg.texture_registry():
dpg.add_raw_texture(width=width, height=height, default_value=data, tag=f"test_texture")
dpg.add_image_series(f"test_texture", [0, 0], [width, height], parent=f"curr_image_plot_y_axis_1")
dpg.fit_axis_data(f"curr_image_plot_x_axis_1")
dpg.fit_axis_data(f"curr_image_plot_y_axis_1")
dpg.show_metrics()
dpg.hide_item("win_controls")
with dpg.window(label="Controls", autosize=True, tag="win_controls"):
dpg.add_button(label="Load Images", callback=load_images)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
dpg.destroy_context()
```
Contributor guide
Assessment
This issue has not been assessed yet.