marianocabezas / data_manipulation

CNN tests with pytorch and other tools
GNU General Public License v3.0
1 stars 1 forks source link

TypeError: `pad_width` must be of integral type. #1

Open RB61 opened 5 years ago

RB61 commented 5 years ago

Hi Getting Error

https://github.com/marianocabezas/data_manipulation/blob/893984b8841e0888e14ee2fafab31db8fe261eea/generate_features.py#L111

(base) D:\newwork\marianocabezas\challenges2018>python test_brats2018.py Using TensorFlow backend. [11:49:32] Testing the Unet 2018-11-08 11:49:33.102650: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX 2018-11-08 11:49:33.108934: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.

I get this error after a few minutes.

My python: (base) D:\newwork\marianocabezas\challenges2018>python Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

marianocabezas commented 5 years ago

From that snippet alone, I believe the problem comes from having floating point values on your variable centers (that you call on line 81 of data_creation). The centers of each patch must be of integer type and are actually voxel indices from your image. I don't know if that helps you.

songwaimai commented 4 years ago

Hi, do you resolve the problem??I meet the same error. I would appreciate your replay~

marianocabezas commented 4 years ago

Checking the code again, I feel the problem comes from using python 3. Keep in mind that the master branch was developed on python 2.7, where the / operator decides whether to use integer division or floating point division depending on the data being used. Python 3 changed that and introduced the integer operator (//) and the floating one (/). If you are both using python 3, I suggest using the branch python3 which was updated to python 3. I plan on merging all the changes into master, but I first want to check where I am using that package to make sure I don't break anything.

songwaimai commented 4 years ago

thanks your replay! that problem has resolved! But now i have another question:

           Loading x

Traceback (most recent call last): File "E:/slycode/challenges2017-master/train_test_iseg.py", line 115, in train_net net = load_model(net_name) File "C:\Users\63121\venv\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper return load_function(*args, **kwargs) File "C:\Users\63121\venv\lib\site-packages\keras\engine\saving.py", line 583, in load_model with H5Dict(filepath, mode='r') as h5dict: File "C:\Users\63121\venv\lib\site-packages\keras\utils\io_utils.py", line 191, in init self.data = h5py.File(path, mode=mode) File "C:\Users\63121\venv\lib\site-packages\h5py_hl\files.py", line 408, in init swmr=swmr) File "C:\Users\63121\venv\lib\site-packages\h5py_hl\files.py", line 173, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py\h5f.pyx", line 88, in h5py.h5f.open OSError: Unable to open file (unable to open file: name = 'E:\slycode\challenges2017-master\data\iSeg-2017-Training\iseg2017.fold0.baseline.D1.p17.c3c3c3c3c3.n32n32n32n32n32.d256.e50.mdl', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:/slycode/challenges2017-master/train_test_iseg.py", line 315, in main() File "E:/slycode/challenges2017-master/train_test_iseg.py", line 285, in main net = train_net(i, train_data, train_labels, options) File "E:/slycode/challenges2017-master/train_test_iseg.py", line 135, in train_net datatype=np.float32 File "E:\slycode\challenges2017-master\data_creation.py", line 570, in load_patches_train datatype File "E:\slycode\challenges2017-master\data_creation.py", line 136, in get_xy x = np.concatenate(x) File "<__array_function__ internals>", line 6, in concatenate TypeError: The first input argument needs to be a sequence

whether my input has some errors??

marianocabezas commented 4 years ago

It's hard to say, but just to check, what is the type and shape of x before you call np.concatenate(x)? Is it possible that it is an iterator?

songwaimai commented 4 years ago

Thank you very much! Indeed i did like you say and the first problem has been resolved. But TypeError: The first input argument needs to be a sequence still makes me confused... actually i run the code that challenge 2017 and i want to segment the dataset of iseg2017. But it can not work. I don not know whether the error is related with the version of python??