image-analogies
image-analogies copied to clipboard
Model Brute cannot convert to Tensor
Hi, I'm trying to run the sugarskull example with Tensorflow. Everything works as expected except when I specify -model=brute
. When I do, I get this error:
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Tensorflow detected. Forcing --a-scale-mode=match (A images are scaled to same size as B images)
Using brute-force model
Scale factor 0.25 "A" shape (1, 3, 644, 483) "B" shape (1, 3, 644, 483)
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties:
name: Tesla K80
major: 3 minor: 7 memoryClockRate (GHz) 0.8235
pciBusID 0000:00:1e.0
Total memory: 11.17GiB
Free memory: 11.11GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0)
Building loss...
Precomputing static features...
Building and combining losses...
Traceback (most recent call last):
File "/usr/local/bin/make_image_analogy.py", line 27, in <module>
image_analogy.main.main(args, model_class)
File "/usr/local/lib/python2.7/dist-packages/image_analogy/main.py", line 71, in main
model.build(a_image, ap_image, b_image, (1, img_num_channels, img_height, img_width))
File "/usr/local/lib/python2.7/dist-packages/image_analogy/models/base.py", line 23, in build
loss = self.build_loss(a_image, ap_image, b_image)
File "/usr/local/lib/python2.7/dist-packages/image_analogy/models/analogy.py", line 37, in build_loss
patch_stride=self.args.patch_stride)
File "/usr/local/lib/python2.7/dist-packages/image_analogy/losses/analogy.py", line 28, in analogy_loss
best_a_prime_patches = find_analogy_patches(a, a_prime, b, patch_size=patch_size, patch_stride=patch_stride)
File "/usr/local/lib/python2.7/dist-packages/image_analogy/losses/analogy.py", line 14, in find_analogy_patches
a_patches, a_patches_norm = patches.make_patches(K.variable(a), patch_size, patch_stride)
File "/usr/local/lib/python2.7/dist-packages/image_analogy/losses/patches.py", line 14, in make_patches
mode='valid')
File "/usr/local/lib/python2.7/dist-packages/theano/tensor/nnet/neighbours.py", line 553, in images2neibs
return Images2Neibs(mode)(ten4, neib_shape, neib_step)
File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 611, in __call__
node = self.make_node(*inputs, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/theano/tensor/nnet/neighbours.py", line 84, in make_node
ten4 = T.as_tensor_variable(ten4)
File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", line 208, in as_tensor_variable
raise AsTensorError("Cannot convert %s to TensorType" % str_x, type(x))
theano.tensor.var.AsTensorError: ('Cannot convert Tensor("ExpandDims:0", shape=(1, 256, 161, 120), dtype=float32) to TensorType', <class 'tensorflow.python.framework.ops.Tensor'>)
What is going wrong here?
any solve found? help~
i have figured out.
-
keras 2.x -> keras 1.1.2 pip uninstall keras pip install keras==1.1.2
-
set keras to use theano instead of tensorflow sudo vi ~/.keras/keras.json (change backend from tensorflow to theano)
@getarobo But what if I want to use Keras 2.x
@warrenronsiek I ran into the same roadblock. I would love to be able to use tensorflow with model=brute.