I am using a script from https://towardsdatascience.com/a-keras-pipeline-for-image-segmentation-part-1-6515a421157d to split a data set. I don't understand what this part is doing
all_frames = os.listdir(FRAME_PATH)
all_masks = os.listdir(MASK_PATH)
all_frames.sort(key=lambda var:[int(x) if x.isdigit() else x
for x in re.findall(r'[^0-9]|[0-9]+', var)])
all_masks.sort(key=lambda var:[int(x) if x.isdigit() else x
for x in re.findall(r'[^0-9]|[0-9]+', var)])
More specifically I do not understand what the everything the var:
is doing. My first guess would be a list comprehension, but it does not follow the structure.
[ expression for item in list if conditional ]
Also what is the purpose of this part re.findall(r'[^0-9]|[0-9]+', var)
?
thank you