pytorch_fnet icon indicating copy to clipboard operation
pytorch_fnet copied to clipboard

Training example issues with csv creation

Open SamPIngram opened this issue 5 years ago • 2 comments

Issues corresponding to trying to use the examples/download_and_train.py. This has been specifically tested when trying to run this example in a google colab notebook, so some issues may be specific to internal versions of python being used in colab.

Image_list CSV files are being created with no channel signal or channel target values leading list comprehension issues of trying to turn NaN into int during training start-up. This was being caused as the method in which "channel_signal" and "channel_target" are being added to the data frame is not working correctly and is resulting in NaN being parsed into those columns instead.

To fix this you can convert the numpy arrays to lists when assigning to the dataframe: df["channel_signal"] = data_manifest["ChannelNumberBrightfield"].tolist() df["channel_target"] = data_manifest["ChannelNumber405"].tolist()

SamPIngram avatar Mar 13 '20 13:03 SamPIngram

hi @singram12 can you post the exact error you're having?

gregjohnso avatar Mar 13 '20 14:03 gregjohnso

INFO:fnet.cli.train_model: Started training at: 2020-03-13 15:17:10.692903 INFO:fnet.cli.train_model: *** Training options *** INFO:fnet.cli.train_model: {'batch_size': 28, INFO:fnet.cli.train_model: 'bpds_kwargs': {'buffer_size': 16, INFO:fnet.cli.train_model: 'buffer_switch_interval': 2800, INFO:fnet.cli.train_model: 'patch_shape': [32, 64, 64]}, INFO:fnet.cli.train_model: 'dataset_train': 'fnet.data.MultiChTiffDataset', INFO:fnet.cli.train_model: 'dataset_train_kwargs': {'path_csv': '/content/pytorch_fnet/examples//image_list_train.csv'}, INFO:fnet.cli.train_model: 'dataset_val': 'fnet.data.MultiChTiffDataset', INFO:fnet.cli.train_model: 'dataset_val_kwargs': {'path_csv': '/content/pytorch_fnet/examples//image_list_test.csv'}, INFO:fnet.cli.train_model: 'fnet_model_class': 'fnet.fnet_model.Model', INFO:fnet.cli.train_model: 'fnet_model_kwargs': {'betas': [0.9, 0.999], INFO:fnet.cli.train_model: 'criterion_class': 'fnet.losses.WeightedMSE', INFO:fnet.cli.train_model: 'init_weights': False, INFO:fnet.cli.train_model: 'lr': 0.001, INFO:fnet.cli.train_model: 'nn_class': 'fnet.nn_modules.fnet_nn_3d.Net', INFO:fnet.cli.train_model: 'scheduler': None}, INFO:fnet.cli.train_model: 'gpu_ids': [0], INFO:fnet.cli.train_model: 'interval_checkpoint': 1000, INFO:fnet.cli.train_model: 'interval_save': 1000, INFO:fnet.cli.train_model: 'iter_checkpoint': [], INFO:fnet.cli.train_model: 'json': PosixPath('/content/pytorch_fnet/examples/model/prefs.json'), INFO:fnet.cli.train_model: 'n_iter': 5000, INFO:fnet.cli.train_model: 'path_json': PosixPath('/content/pytorch_fnet/examples/model/prefs.json'), INFO:fnet.cli.train_model: 'path_save_dir': '/content/pytorch_fnet/examples/model', INFO:fnet.cli.train_model: 'seed': None} INFO:fnet.cli.train_model: *** Model *** fnet.nn_modules.fnet_nn_3d.Net(**{}) iter: 3000 gpu: [0] INFO:fnet.cli.train_model: History loaded from: /content/pytorch_fnet/examples/model/losses.csv Traceback (most recent call last): File "/usr/local/bin/fnet", line 8, in sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/fnet/cli/main.py", line 41, in main func(args) File "/usr/local/lib/python3.6/dist-packages/fnet/cli/train_model.py", line 131, in main bpds_train = get_bpds_train(args) File "/usr/local/lib/python3.6/dist-packages/fnet/cli/train_model.py", line 63, in get_bpds_train ds = ds_fn(**args.dataset_train_kwargs) File "/usr/local/lib/python3.6/dist-packages/fnet/data/multichtiffdataset.py", line 31, in init self.df["channel_signal"] = [[int(ch)] for ch in self.df["channel_signal"]] File "/usr/local/lib/python3.6/dist-packages/fnet/data/multichtiffdataset.py", line 31, in self.df["channel_signal"] = [[int(ch)] for ch in self.df["channel_signal"]] ValueError: cannot convert float NaN to integer

SamPIngram avatar Mar 13 '20 15:03 SamPIngram