Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Extractor feature OOM #9

Open
StarsTesla opened this issue Oct 10, 2022 · 2 comments
Open

Extractor feature OOM #9

StarsTesla opened this issue Oct 10, 2022 · 2 comments

Comments

@StarsTesla
Copy link

Hi there, I tried the code, at the beginning , everything sames fine, but when I try to use the extractor on my own images, more specificly, extract feature of high resolution pciture and visualize the pca picture. I tried the code on 100 800 x 800 images, set the load_size=224 and stride=2, it seems fine, so the code maybe run the image separately?

How should I calculate the memory of GPU and Could the Extractor could modify to using on multiple GPUs?

@ShirAmir
Copy link
Owner

ShirAmir commented Oct 10, 2022

Hi @StarsTesla,

The current PCA computation code extracts features from each image using the GPU. AFAIK, There are two possible options to the OOM error you receive:
(1) Your GPU doesn't contain enough RAM to extract features for a single high resolution image. (You receive the OOM error before even extracting a single image). In this case you can either
(i) run on CPU (by setting device='cpu' here).
(ii) reduce load_size increase stride (e.g. load_size=224, stride=8).

(2) Your GPU manages to extract a single image in this manner and doesn't handle properly many extracted images (You receive the OOM error after extracting features for several images). In this case I would recommend:
(i) Running on CPU in the same manner as (1)(i).
(ii) Create a script that extracts features for a single image and saves the features do disk, run it with GPU on all the images (the GPU RAM will be freed between each run of the script) and alter the PCA script to load descriptors from disc.
(iii) Purge the GPU RAM after each features extraction in the original script.

Hope this helps, and good luck!

@StarsTesla
Copy link
Author

@ShirAmir
Well,Is there a way to make a high resolution extraction? Upsampling seems lose alot of details.

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

No branches or pull requests

2 participants