Unfortunately it does not seems to work, when I create a model from the zoo, it seems that a postfix integer is added to the name of the parameter with a weird integer (as if it keeps track of the model I created).
For example with the following code:
I create two models from resnet152_v2, and I load the same parameters files. I expect that a function which check the equality between the two models states that the two models are identical.
net1 = models.get_model("resnet152_v2", ctx=ctx, pretrained=False)
net2 = models.get_model("resnet152_v2", ctx=ctx, pretrained=False)
params1 = net1.collect_params().items()
params2 = net2.collect_params().items()
same_model = True
for (name1, p1), (name2, p2) in zip(params1, params2):
if name1 != name2 or p1 != p2:
same_model = False
Actually, you do not need the parameters file to see that you code will not work. In my case, the name of the parameters are all different. It seems that there is a postfix attached to the name. For example for the first param1, the param name are: resnetv27_batchnorm0_gamma, resnetv27_batchnorm=_beta, …
however for the params, the names are resnetv28_batchnorm0_gamma, resnetv28_batchnorm=_beta, …
I could do a ugly hack and get this postfix removed, but is there any other solutions?