def MnistDataset(dataframe): return (Dataset.from_dataframe(dataframe).map(lambda row: ( Path(row["image_path"]), row["class_name"], )).starmap(lambda image_path, class_name: problem.Example( image=Image.open("prepare" / image_path).resize((32, 32)), class_name=class_name, )))
def MnistDataset(dataframe): return ( Dataset.from_dataframe(dataframe) .map(lambda row: ( Path(row['image_path']), row['class_name'], )) .starmap(lambda image_path, class_name: problem.Example( image=Image.open('prepare' / image_path), class_name=class_name, )) )
def CifarDataset(dataframe): return ( Dataset.from_dataframe(dataframe) .map( lambda row: ( Path(row["image_path"]), row["class_name"], ) ) .starmap( lambda image_path, class_name: problem.Example( image=np.array(Image.open("prepare" / image_path)), class_name=class_name, ) ) )