简体   繁体   中英

Python print file name from a Data class

I'm trying to print a filename from a class. The class is defined in here in the below code. The code runs without any issues but it doesn't print the filename, my guess is that i have an issue with calling the class.

I am trying to call the class in another file to print the file name into a CSV during training, and using this code to do this:

filename=CellsDataset(args.data_dir,transform=ToTensor(),return_filenames=True)
print(filename)

A CellsDataSet contains a list of filenames in its files attribute, so you can print all of them like this:

filename=CellsDataset(args.data_dir,transform=ToTensor(),return_filenames=True)
print(filename.files)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM