TobyPDE / FRRN

Full Resolution Residual Networks for Semantic Image Segmentation
MIT License
280 stars 93 forks source link

CudaNdarrayType error: Tried using dtype float64 for variable None #3

Closed amiltonwong closed 7 years ago

amiltonwong commented 7 years ago

Hi, @TobyPDE

After switching to install python3.5, I pass the command "python train.py". However, after inputing "path to ityScapes folder", "model filename", "log filename", it runs into the following troubles:

(root) root@milton-All-Series:/data/code/FRRN# python train.py 
Enter path to CityScapes folder [/data/CityScrapes_dataset/FRRN_data/leftImg8bit_trainvaltest/train]: /data/CityScrapes_dataset/FRRN_data/leftImg8bit_trainvaltest/train
Enter model filename [models/frrn_b.npz]: 
Enter log filename [logs/frrn_b.log]: 
Define network... [0.46s]
Load model... [0.90s]
Define loss... [0.88s]
Traceback (most recent call last):
  File "train.py", line 78, in <module>
    all_predictions, split_outputs = dltools.hybrid_training.get_split_outputs(network, deterministic=False)
  File "/data/code/FRRN/dltools/hybrid_training.py", line 18, in get_split_outputs
    all_outputs = lasagne.layers.get_output(network.output_layers + sum(network.splits, []), **kwargs)
  File "/root/anaconda3/lib/python3.5/site-packages/lasagne/layers/helper.py", line 191, in get_output
    all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs)
  File "/root/anaconda3/lib/python3.5/site-packages/lasagne/layers/special.py", line 52, in get_output_for
    return self.nonlinearity(input)
  File "/data/code/FRRN/dltools/architectures.py", line 88, in log_softmax_4d
    x = theano.sandbox.cuda.basic_ops.gpu_contiguous(x)
  File "/root/anaconda3/lib/python3.5/site-packages/theano/gof/op.py", line 604, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/root/anaconda3/lib/python3.5/site-packages/theano/sandbox/cuda/basic_ops.py", line 3910, in make_node
    input = as_cuda_ndarray_variable(input)
  File "/root/anaconda3/lib/python3.5/site-packages/theano/sandbox/cuda/basic_ops.py", line 46, in as_cuda_ndarray_variable
    return gpu_from_host(tensor_x)
  File "/root/anaconda3/lib/python3.5/site-packages/theano/gof/op.py", line 604, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/root/anaconda3/lib/python3.5/site-packages/theano/sandbox/cuda/basic_ops.py", line 132, in make_node
    dtype=x.dtype)()])
  File "/root/anaconda3/lib/python3.5/site-packages/theano/sandbox/cuda/type.py", line 95, in __init__
    (self.__class__.__name__, dtype, name))
TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None

Any suggestion to fix it?

Here are my packages installed: python 3.5.2 opencv 3.1.0 Theano 0.9.0.dev4 Lasagne 0.2.dev1 numpy 1.11.2 scikit-learn 0.17.1

Thanks~

amiltonwong commented 7 years ago

Fix! I forget to append config setting in file ~/.theanorc It works now

gavinmh commented 7 years ago

@amiltonwong I have the same TypeError. Can you explain what config setting you appended to ~/.theanorc?

Traceback (most recent call last):
  File "train.py", line 82, in <module>
    all_predictions, split_outputs = dltools.hybrid_training.get_split_outputs(network, deterministic=False)
  File "/home/gavin/FRRN/dltools/hybrid_training.py", line 18, in get_split_outputs
    all_outputs = lasagne.layers.get_output(network.output_layers + sum(network.splits, []), **kwargs)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/lasagne/layers/helper.py", line 191, in get_output
    all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/lasagne/layers/special.py", line 52, in get_output_for
    return self.nonlinearity(input)
  File "/home/gavin/FRRN/dltools/architectures.py", line 88, in log_softmax_4d
    x = theano.sandbox.cuda.basic_ops.gpu_contiguous(x)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/theano/gof/op.py", line 604, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/theano/sandbox/cuda/basic_ops.py", line 3910, in make_node
    input = as_cuda_ndarray_variable(input)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/theano/sandbox/cuda/basic_ops.py", line 46, in as_cuda_ndarray_variable
    return gpu_from_host(tensor_x)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/theano/gof/op.py", line 604, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/theano/sandbox/cuda/basic_ops.py", line 132, in make_node
    dtype=x.dtype)()])
  File "/home/gavin/FRRN/venv/lib/python3.5/site-packages/theano/sandbox/cuda/type.py", line 95, in __init__
    (self.__class__.__name__, dtype, name))
TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None
gavinmh commented 7 years ago

@amiltonwong never mind. I created ~/.theanorc and added the following lines:

[global]
floatX = float32
device = gpu0

[nvcc]
fastmath = True

Now it is training.