Skip to content

Commit

Permalink
The import for conv_utils does not work. (#19)
Browse files Browse the repository at this point in the history
* The import for conv_utils does not work.

* Update to import the function from tensorflow.python.keras.utils

* * Utilizing conv_util import
  • Loading branch information
fuzhanrahmanian authored Oct 21, 2021
1 parent e97ad19 commit e228b8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions luna/pretrained_models/googlenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from tensorflow.keras.layers import Layer, Input, Dense, Conv2D, MaxPooling2D
from tensorflow.keras.layers import AveragePooling2D, ZeroPadding2D, Dropout, Flatten
from tensorflow.keras.layers import Concatenate, Activation
from tensorflow.python.keras.utils import conv_utils
from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.python.keras.utils.conv_utils import convert_kernel


class PoolHelper(Layer):
Expand Down Expand Up @@ -445,7 +445,7 @@ def create_googlenet(user_weight_path=None):
for layer in googlenet.layers:
if layer.__class__.__name__ == 'Conv2D':
original_w = tf.compat.v1.keras.backend.get_value(layer.kernel)
converted_w = convert_kernel(original_w)
converted_w = conv_utils(original_w)
tf.compat.v1.assign(layer.kernel, converted_w)

return googlenet

0 comments on commit e228b8f

Please sign in to comment.