I am trying to store pixel data of 30227(1024 x 1024) images together by concatenating them in a list to form my training data. But I am receiving Out of memory error while doing so in my Jupyter notebook. Below are the lines of code that I have used.
train_data = []
mm_scaler = MinMaxScaler()
for file_id in data['patientId']:
file_name = train_images_path+"\\"+file_id.strip()+".dcm"
if os.path.exists(file_name):
image_data = mm_scaler.fit_transform(pydicom.dcmread(file_name).pixel_array)
train_data.append(image_data)
Is there any other way to store this data together which I can use later for training my model ? Please help me in this