Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compilation issue #4

Open
jojokeeps opened this issue Jul 2, 2023 · 3 comments
Open

Compilation issue #4

jojokeeps opened this issue Jul 2, 2023 · 3 comments

Comments

@jojokeeps
Copy link

Everything works up until the final part and I keep getting this issue:

numpy.core._exceptions._ArrayMemoryError: Unable to allocate 12.0 GiB for an array with shape (3, 720, 1280, 292) and data type complex 128

Any help?
Thanks!

@kodavatimahendra
Copy link

Hi,

Do not use the default parameters, they are the reason for running out of memory. Use the ones suggested inside the 'results' folder.

@kodavatimahendra
Copy link

kodavatimahendra commented Nov 19, 2023

Sorry my bad, inside each iteration of gaussian and laplacian functions, the lists are continuously appended. These lists aren't cleared until the end. Therefore for higher resolution or longer videos, the memory will overflow.

These functions have to be optimized.

@8188
Copy link

8188 commented Apr 3, 2024

The following function require less memory if using Gaussian kernel.

from scipy.fft import fft, ifft, fftfreq

def idealTemporalBandpassFilter_chunck(images, fps, freq_range, axis=0, chunk_size=200):
    num_frames = images.shape[axis]
    result = np.empty_like(images)

    for start in tqdm.tqdm(
        range(0, num_frames, chunk_size), ascii=True, desc="Gaussian Pyramids Filtering"
    ):
        end = min(start + chunk_size, num_frames)
        chunk = images.take(np.arange(start, end), axis=axis, mode="clip")
        fft_result = fft(chunk, axis=axis)
        frequencies = fftfreq(chunk.shape[0], d=1.0 / fps)

        low = (np.abs(frequencies - freq_range[0])).argmin()
        high = (np.abs(frequencies - freq_range[1])).argmin()

        fft_result[:low] = 0
        fft_result[high:] = 0

        result[start:end, ...] = ifft(fft_result, axis=0).real
    return result

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants