Generating the inception network directly using the given code

I downloaded the lab for the face recognition assignment, but it does not run on my computer, because there is a problem with marshal data, probably version incompatibility. So, I am trying to generate the model directly (without reading it from JSON) using the given faceRecoModel.py module:

from inception_blocks_v2 import faceRecoModel
model = faceRecoModel((3, 160, 160))

I am getting the error:

ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 128, 20, 20), (None, 32, 20, 20), (None, 32, 16, 16), (None, 64, 20, 20)]

I tried putting the number of channels last, i.e. (160, 160, 3) but then I get:

ValueError: Negative dimension size caused by subtracting 3 from 1 for ‘{{node max_pooling2d_8/MaxPool}} = MaxPoolT=DT_FLOAT, data_format=“NCHW”, explicit_paddings=[], ksize=[1, 1, 3, 3], padding=“VALID”, strides=[1, 1, 2, 2]’ with input shapes: [?,192,20,1].

What am I doing wrong here?

Hi Meir,

Using the notebook, I inserted FRmodel.summary() in a cell after the cell in which model is assigned to FRmodel.

Looking at the layers, the model that is constructed from the json file appears to differ from the model presented as faceRecoModel. Probably it is best to see inception_blocks_v2.py as an illustration of the json model rather than a precise basis for it.

I don’t care if the model is somewhat different. What bothers me is that I am not succeeding to build a model using the provided module at all.

Hi Meir,

My point is that you will then have to make some changes to faceRecoModel so that the model it constructs becomes the same as the model constructed from the json file. Otherwise you get the error you mentioned.

You can deduce which changes you have to make by looking at the summary of the FRmodel as I indicated and compare this to the model constructed by faceRecoModel. Or you can use the json file.

I looks like there is a misunderstanding. I don’t get the error afterwards, but rather during the execution of the function from the module that generates the model.

I also get the error during generation (I reproduced the error you reported). The model constructed by faceRecoModel has a bug. This is why, if you want to use faceRecoModel, you have to make some changes to it. In this, it helps to compare it to the model that is created based on the json file.

I hereby request from the deeplearning.ai team to please provide us either with a model that loads without errors with all the reasonably recent versions of Python & TF or, alternatively, with a working code for generating the model.

Hi Meir,

I have passed your request on to people working on the backend @Mubsi.