Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch size mismatch with Inception classifier #32

Open
catherio opened this issue Mar 29, 2018 · 10 comments · May be fixed by #40
Open

Batch size mismatch with Inception classifier #32

catherio opened this issue Mar 29, 2018 · 10 comments · May be fixed by #40

Comments

@catherio
Copy link
Contributor

With Tensorflow 1.6.0, the line pred = sess.run(softmax, {'ExpandDims:0': inp}) raises an error because the input to the softmax in the Inception classifier expects a batch dimension of 1:

ValueError: Cannot feed value of shape (100, 32, 32, 3) for Tensor u'ExpandDims:0', which has shape '(1, ?, ?, 3)'

I assume this didn't used to be the case? For now I've patched my local fork to hardcode bs = 1, but I assume that's not the optimal fix here.

If I drop a breakpoint right before that line to show what I'm calling this with:

ipdb> len(images)
1000
ipdb> inp.shape
(100, 32, 32, 3)
ipdb> tf.get_default_graph().get_tensor_by_name("ExpandDims:0")
<tf.Tensor 'ExpandDims:0' shape=(1, ?, ?, 3) dtype=float32>
@ptirupat
Copy link

ptirupat commented Apr 3, 2018

I have the same exact issue. I tried Tensorflow version 1.5 and 1.6 and it is same in both the cases. Really appreciate your help in resolving this.

@alexanderhanboli
Copy link

I have the same issue.

@kritiagg
Copy link

Any updates on this issue?

@HMJiangGatech
Copy link

An old version of tensorflow works.

@kritiagg
Copy link

kritiagg commented May 6, 2018

Yes, tf version 1.3 works.

@moniDLpro
Copy link

How should it work with tf version 1.3? It is not even working with version 1.2.1!
tensorflow/tensorflow#1021
With the provided model, only batch sizes of 1 are working.

@IPNUISTlegal
Copy link

how to fix this issue with tf version 1.8 ?
thks

@djsutherland
Copy link

djsutherland commented Aug 17, 2018

tf.contrib.gan.eval has functions that work in recent tensorflows.

Changing o._shape = ... to o.set_shape(...), as in #31, doesn't seem to have worked, because set_shape merges shape information instead of overriding it: tensorflow/tensorflow#5680 (comment)

@gargrohin
Copy link

Any updates on how to solve this? Or any alternatives?

@Kilichbek
Copy link

Hi, Everyone
for those who still have a problem, please, make sure that images have a channel-last format (h x w x 3). I hope it may help ...
I had the same problem, I confused Pytorch with Tensorflow format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants