On-Demand Image reading
Opened this issue · 3 comments
It seems that currently images are being read into memory all at once and then processed.
This has caused more than one experiment of mine to fill the memory, for example for more than 6000 1080p images.
Wouldn't it be better to read images on-demand, when they need to be processed?
This could even be achieved by creating a class (could even derive of cv2.Mat) that works with images and reads them only when their contents need to be accessed.
Yes, you are right. I think this is easily do-able. I will look into it after my on-going submission. Have you already solved this on your end?
I have not. I'm trying to get to a solution that won't involve rewriting every compute_map_features
function, but I'm not so sure that's possible because of the list-exclusive functions called (like len
)
For the future, I believe it's more pythonic to do for i,e in enumerate(list)
rather than for i in range(len(list))
, plus that would work with generators as well as lists. I might simply change that in every compute_map_features
and replace ref_images_list
with a generator.
edit: About the former, it seems it's only the case for CoHOG's compute_map_features