hanzhi713 / image-collage-maker

A photo mosaic (pixel collage) maker. Use all your friends' profile pictures to approximate your profile picture! 如何用 Python 制作一个炫酷的微信好友图
MIT License
150 stars 14 forks source link

[instability] GUI hang/unresponsive after tiles are loaded, cannot click to photomosaic #24

Closed Pizzanomicon closed 1 year ago

Pizzanomicon commented 1 year ago

This seems new to the recent version- over a certain size tile, the GUI does not seem to want to allow "Photomosaic" to be clicked, hanging and becoming unresponsive (Windows) but does not outright crash.

This seems to happen at some point just above 100px (perhaps 125) with a tileset of 300,000 tiles.

It also seems this problem has something to do with the continuous display of the resulting PNG, I suspect displaying a 105570x66015 image (for 135px tiles on a 782x489 grid) might be causing something akin to a memory leak.

Each version of this is exponentially more stable and useful, I have to commend you developers!

hanzhi713 commented 1 year ago

You're stressing the limit of my collage maker... A 105570x66015 RGB image in float32 takes about 77.88GB of memory. Considering that we need to keep both the tiles and the resulting collage in memory, we need double the amount.

At this size, all operations that operate on the collage will be extremely slow. This includes displaying it on GUI, resizing, blending, etc. GPU won't help either, as even Tesla A100 80GB can barely fit one such collage.

Displaying a 77.88GB image will most likely hang the GUI. A potential solution to this is to resize the collage to a reasonable size (say below 10000 pixel wide), and then display it. But the resize operation will be slow too. Let me know what you think.

By the way, given the scale of the problem you're working on, I'm curious about what kind of hardware do you have on your workstation.

hanzhi713 commented 1 year ago

Issue not active. Closed for now.