While training on my own images, I'm getting this error,
chainer.utils.type_check.InvalidType:
Invalid operation is performed in: LinearFunction (Forward)
Expect: prod(in_types[0].shape[1:]) == in_types[1].shape[1]
Actual: 259656 != 27648
Can you give me a bit more info as to how this error came about? Are you using the command line tools or one of the model classes? Have you properly set the image sizes?
Hi there, I am jumping in as I have the same problem regardless of the model used. I am using the code from the notebook. My own images (64x64=4096) are loaded without trouble (dimensions are set). Here is the error (I am on OSX10.11):
Traceback (most recent call last):
File "test.py", line 12, in
vg.fit(x_all, save_freq=2, pic_freq=2, n_epochs=10, model_path = m_path, img_path=im_path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fauxtograph/fauxtograph.py", line 754, in fit
disc_samp, disc_batch = self._forward(x_batch)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fauxtograph/fauxtograph.py", line 592, in forward
disc_batch = self.disc(batch, dropout_ratio=self.dropout_ratio)[0]
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fauxtograph/vaegan.py", line 439, in call
batch = F.relu(getattr(self, 'linear%i' % i)(batch))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chainer/links/connection/linear.py", line 65, in call
return linear.linear(x, self.W, self.b)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chainer/functions/connection/linear.py", line 81, in linear
return LinearFunction()(x, W, b)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chainer/function.py", line 115, in call
self._check_data_type_forward(in_data)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chainer/function.py", line 190, in _check_data_type_forward
raise type_check.InvalidType(e.expect, e.actual, msg=msg)
chainer.utils.type_check.InvalidType:
Invalid operation is performed in: LinearFunction (Forward)
Expect: prod(in_types[0].shape[1:]) == in_types[1].shape[1]
Actual: 4096 != 12288
I would greatly appreciate if you could help!
Cheers.
I had the same issue, resolved by using the --shape flag to specify image size for the train command, ie:
fauxtograph train --kl_ratio 0.005 --shape 64 64 ./images ./models/modelname
Hi, @tjtorres and @RobGeada
have got the similar problem.. My Image size is 300X300 and Gray Scale
`fauxtograph train --kl_ratio 0.005 --shape 300 300 /home/dl-box/Arghya/arghya/lasttry/images/ ./models/VAE
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 49/49 [00:00<00:00, 1781.81it/s]
Image Files Loaded!
epoch: 1
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/usr/local/bin/fauxtograph", line 11, in
sys.exit(fauxtograph())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/fauxtograph/fauxto.py", line 123, in train
vae.fit(x_all, batch_size=batch, n_epochs=epoch)
File "/usr/local/lib/python2.7/dist-packages/fauxtograph/fauxtograph.py", line 317, in fit
out, kl_loss, rec_loss = self.model.forward(x_batch)
File "/usr/local/lib/python2.7/dist-packages/fauxtograph/vaegan.py", line 526, in forward
out, means, ln_vars = self.encode(batch, test=test)
File "/usr/local/lib/python2.7/dist-packages/fauxtograph/vaegan.py", line 509, in encode
x = self.enc(data, test=test)
File "/usr/local/lib/python2.7/dist-packages/fauxtograph/vaegan.py", line 152, in call
batch = F.relu(getattr(self, 'linear%i' % i)(batch))
File "/usr/local/lib/python2.7/dist-packages/chainer/links/connection/linear.py", line 65, in call
return linear.linear(x, self.W, self.b)
File "/usr/local/lib/python2.7/dist-packages/chainer/functions/connection/linear.py", line 81, in linear
return LinearFunction()(x, W, b)
File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 102, in call
self._check_data_type_forward(in_data)
File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 144, in _check_data_type_forward
raise type_check.InvalidType(e.expect, e.actual, msg=msg)
chainer.utils.type_check.InvalidType:
Invalid operation is performed in: LinearFunction (Forward)
Expect: prod(in_types[0].shape[1:]) == in_types[1].shape[1]
Actual: 90000 != 270000
`
I'm having the same issue. I was able to pass the colored images with --shape, but after I converted to gray scale, I get this error again. Even after converting them to 125x150 just to be sure.