You started with filename=CellsDataset(args.data_dir,transform=ToTensor(),return_filenames=True), which I assume returns the names of the files you’re after, but then you try to assigned filename to be output.files, which fails because the output doesn’t have .files attribute.
Maybe try commenting this out and keep the first filename variable?