Code
for file in zip(frames_list[:-round(0.2 * len(frames_list))], masks_list[:-round(0.2 * len(masks_list))]):
    # Convert tensors to numpy arrays # khawar

    frame = frame_batches.next().numpy().astype(np.uint8)
    mask = mask_batches.next().numpy().astype(np.uint8)

    # Convert numpy arrays to images
    frame = Image.fromarray(frame)
    mask = Image.fromarray(mask)

    # Save frames and masks to correct directories
    frame.save(DATA_PATH + '{}_frames/{}'.format(dir_name, dir_name) + '/' + file[0])
    mask.save(DATA_PATH + '{}_masks/{}'.format(dir_name, dir_name) + '/' + file[1])

Traceback (most recent call last):
  File "/home/khawar/Desktop/Khawar_Seg/main.py", line 181, in <module>
    generate_image_folder_structure(frame_tensors, masks_tensors, frames_list, masks_list)
  File "/home/khawar/Desktop/Khawar_Seg/main.py", line 148, in generate_image_folder_structure
    for file in zip(frames_list[:-round(0.2 * len(frames_list))], masks_list[:-round(0.2 * len(masks_list))]):