Any ideas for how to use multiprocessing with dpg.load_image
?
#1792
-
I have an application I am working on that deals with a high number of large images. I am trying to load them based on a specified timestamp by the user. It is currently working, but it is rather slow. Upon profiling the code, I saw that I already have this code running in a separate thread, but likely due to the GIL, I am having issues with slowness, affecting the framerate of DPG significantly. I have tried to use multiprocessing to parallelize this more efficiently, but the issue I ran into is that the mvBuffer generated by Anyone out there have more experience and have some ideas? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
I have not seen any prior discussions with good analysis. Could you do a benchmark with PIL and OpenCV for example? There is this analysis for example. Maybe manually managing the mutex might help a bit. |
Beta Was this translation helpful? Give feedback.
-
so your loading images to use in the texture system or to do sort of image processing? |
Beta Was this translation helpful? Give feedback.
-
I created a feature request here. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/Pcothren/DearPyGui-Examples/blob/main/camera_capture_with_opencv.py https://www.youtube.com/watch?v=-JZK8h-3bNk This example uses Numpy for the conversion from OpenCV to DPG textures. There should be a built in conversion in OpenCV, but I don't know exactly how. Someone suggested using convertTo() and cvtColor(). Or maybe something like image = cv2.cvtColor(view , cv2.COLOR_BGR2RGB). Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
So that's interesting. OpenCV loads images much faster than DPG. There should be something to learn from OpenCV in that respect then... |
Beta Was this translation helpful? Give feedback.
https://github.com/Pcothren/DearPyGui-Examples/blob/main/camera_capture_with_opencv.py
https://www.youtube.com/watch?v=-JZK8h-3bNk
This example uses Numpy for the conversion from OpenCV to DPG textures. There should be a built in conversion in OpenCV, but I don't know exactly how. Someone suggested using convertTo() and cvtColor(). Or maybe something like image = cv2.cvtColor(view , cv2.COLOR_BGR2RGB).
Hope this helps.