You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, great project! I have 8000 images, and I found that the memory increased a lot during training. My computer has 60G RAM but it is still not enough.
Off the bat, 8000 images is a lot and way more than I've benchmarked. Here is a short overview of where the bulk of the memory goes for each method:
GENERAL
for each backbone, the more feature maps it returns, the more heavy the computations will be.
SPADE
self.zlib <-- stack of feature vectors, float32
self.fmaps <-- list of stacks of feature maps, float32. This will become the bulk of the memory.
solution: use something like mmap (Memory-mapped file support) to build it outside RAM. faiss could also be used. You will likely sacrifice some inference speed.
PADIM
self.patch_lib <-- stack of 2D patches, float32. This will become the main bulk of the memory.
torch.linalg.inv(self.E) <--- this could cause memory issues if your 2D grid is large
solution: online calculation of mean and covar matrix when the samples are added to the training set
PatchCore
self.patch_lib <-- collection of patches, float32. This will become the main bulk of the memory.
coreset selection <-- can also eat quite some memory as you will need to calculate distances between vectors
solution: the authors of the paper use faiss in their implementation, likely because it solves a couple of memory issues as well.
In a nutshell:
implement one of these solutions (and make a PR :) ) or
select a smaller backbone (resnet18, efficientnet_b0) or
reduce your dataset
Second, I see you are using Streamingdataset.
For this to work you'd need to make a train instance and a test instance:
Hi, great project! I have 8000 images, and I found that the memory increased a lot during training. My computer has 60G RAM but it is still not enough.
The test picture does not seem to need to be transformed. Does it support pictures in other formats?
The text was updated successfully, but these errors were encountered: