Closed SergeMv closed 6 years ago
This error was due to my implementation of data loader. You need to transpose image after loading, so the final result returned by the next() function is like [numberOfImagesInBatch, numberOfChannelsInImage, height, width]
imgs = [] ... imgObj = io.imread(filepath) imgObj = imgObj.astype("float32") imgObj /= 255.0
imgObj = np.transpose(imgObj, (2, 0, 1)) imgs.append(imgObj) ... return np.array(imgs, dtype=np.float32), np.array(masks, dtype=np.int32)
Hi @SimJeg , I'm getting this error on training "'int' object has no attribute 'dtype'" What can be a reason?
Traceback (most recent call last): File "train.py", line 259, in
initiate_training(cf)
File "train.py", line 223, in initiate_training
train(cf)
File "train.py", line 144, in train
history = batch_loop(train_iter, train_fn, epoch, 'train', history)
File "train.py", line 32, in batch_loop
loss, I, U, acc = f(X, Y[:, None, :, :])
File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 813, in call
allow_downcast=s.allow_downcast)
File "/usr/local/lib/python2.7/dist-packages/theano/tensor/type.py", line 124, in filter
up_dtype = scal.upcast(self.dtype, data.dtype)
File "/usr/local/lib/python2.7/dist-packages/theano/scalar/basic.py", line 79, in upcast
rval = str(z.dtype)
AttributeError: Bad input argument to theano function with name "train.py:114" at index 1 (0-based).
Backtrace when that variable is created:
File "train.py", line 254, in
cf = imp.load_source('config', arguments.config_path)
File "config/FC-DenseNet103.py", line 32, in
dropout_p=0.2)
File "/root/fcdn/FC-DenseNet.py", line 45, in init
self.target_var = T.tensor4('target_var', dtype='int32') # target
'int' object has no attribute 'dtype'