Yes. The code is running a server. This is the error message i am getting now:
slurmstepd: error: Detected 1 oom-kill event(s) in step 9708662.batch cgroup. Some of your processes may have been killed by the cgroup out-of-memory handler.

Is there an alternative way I could change this code so it doesn’t copy the image each time. As this is likely causing the issue of running out of memory
    def __getitem__(self, idx):
        path = self.files[idx]        
        image = cv2.imread(path)
        sample = image.copy()
        # set blue and green channels to 0
        sample[:, :, 0] = 0
        sample[:, :, 1] = 0