image-analogies
image-analogies copied to clipboard
Fix for issue #39.
This pull request is intended to fix issue #39 (ValueError: Layer weight shape (3, 3, 3, 64) not compatible with provided weight shape (64, 3, 3, 3) ) and to make the image-analogies package compatible with keras versions 2.0.0 and above.
I only made changes to the vgg16.py file.
The newly added code does the following:
-
It checks if your version of keras is version '2.0.0' or above;
-
If your version of keras is version '2.0.0' or above, then it (1) converts each element x of the list 'weights' into a numpy array, (2) transposes each of those arrays, and (3) saves the list of transposed arrays back to the 'weights' list.
weights_T = [np.array(x).T for x in weights] weights = weights_T
-
If your version of keras is version not '2.0.0' or above, the 'weights' list is left unchanged; the elements of 'weights' are left untransposed.
Transposing the weights is necessary for compatibility with keras is version '2.0.0' or above.
The code should still be compatible with earlier versions of keras before version '2.0.0'.
Thanks! curled this into my installed package and started working just fine!
This worked for me as well -- many thanks!
why i run the make_image_analoy.py,the result is that, i don't know how to solve it? thanks.