HealthML / self-supervised-3d-tasks

Apache License 2.0
185 stars 39 forks source link

(Pre-training model - cpc_3d_brats.json) ValueError: too many values to unpack (expected 4) #21

Closed lokeycookie closed 2 years ago

lokeycookie commented 2 years ago

Hi there,

I have a folder containing numpy files of brats which are all (128,128,128,4) and I have written in the path to this folder in cpc_3d_brats.json config file. However, when I tried to run train.py self_supervised_3d_tasks/configs/train/cpc_3d_brats.json, I obtain this following error.

Traceback (most recent call last): File "train.py", line 4, in main() File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/train.py", line 78, in main init(train_model) File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/utils/model_utils.py", line 67, in init f(**args) File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/train.py", line 69, in train_model steps_per_epoch=len(train_data), File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/data/generator_base.py", line 47, in len self.get_multiplicator() File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/data/generator_base.py", line 39, in get_multiplicator self.index_multiplicator = DataGeneratorBase.get_batch_size(self.__data_generation_intern([self.list_IDs[0]])[0]) File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/data/generator_base.py", line 124, in __data_generation_intern data_x, data_y = self.pre_proc_func(data_x, data_y) File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/algorithms/cpc.py", line 127, in f return preprocess_grid_2d(preprocess_2d(x, self.crop_size, self.patches_per_side)) File "/home/svu/e0310071/self-supervised-3d-tasks/self_supervised_3d_tasks/preprocessing/preprocess_cpc.py", line 34, in preprocess2d , w, h, _ = batch.shape ValueError: too many values to unpack (expected 4)

How do I resolve this error?

lokeycookie commented 2 years ago

Hello, just to add on, when I tried to run the pre-training 3dcpc algorithm, I got the above error. I used this command train.py self_supervised_3d_tasks/configs/train/cpc_3d_brats.json. The json file which I only change the data directory is as follows:

{ "algorithm": "cpc", "batch_size": 64, "data_dir": "/hpctmp/e0310071/BRATS_datatrain_128_numpy", "dataset_name": "brats", "train3D": true, "data_dim": 128, "n_channels": 4, "embed_dim": 128, "split_per_side": 4, "epochs": 500, "lr": 1e-3, "num_layers": 4 }

However, I got a ValueError: too many values to unpack (expected 4) as mentioned in the previous comment. Does anyone have this same error or does anyone know how to resolve this error?

lokeycookie commented 2 years ago

Hi, I tried just using the cpc_3d.json file instead of cpc_3d_brats.json file and the configurations in cpc_3d.json appears to make the code to run finish with no errors.

Do i just assume that the configurations in cpc_3d_brats.json don't work?

lokeycookie commented 2 years ago

I will assume that the current configurations in cpc_3d_brats.json do not work and we should use the configurations in cpc_3d.json. Will be closing for now.