DariusAf / MesoNet

"MesoNet: a Compact Facial Video Forgery Detection Network" (D. Afchar, V. Nozick) - IEEE WIFS 2018
Apache License 2.0
251 stars 112 forks source link

the dimensions aren't matched, what's the problem? thanks! #7

Closed futureisatyourhand closed 5 years ago

futureisatyourhand commented 5 years ago

the issue is "batch = np.concatenate((batch, np.expand_dims(self.resize_patch(patch), axis = 0)),axis = 0) ValueError: all the input array dimensions except for the concatenation axis must match exactly" in pipeline.py when running example.py, I print the shape of batch is (1, 256, 256, 3),but the shape of np.expand_dims(self.resize_patch(patch), axis = 0) isn't (1, 256, 256, 3). How should I modify it?

DariusAf commented 5 years ago

Hi,

Without more details, it is hard to tell.

If I recall correctly depending on your version of Python / Numpy, the shape can end up swapped in the incorrect order. You could try to print the shape and see what it is instead of (1, 256, 256, 3) and if you need to expand the dimension in a different order.

Another possible cause I can think of is if your image is black and white and thus only has two dimensions instead of three. You may add a function to convert your two-dimensional black and white to a tridimensional format if that's the case. Feel free to create a PR if you add such function.

One last trick I would try is to change the batch_size parameter, just to see how things change in the error.

DariusAf commented 5 years ago

Well, no answers, i assume you fixed your problem.