efficientnet icon indicating copy to clipboard operation
efficientnet copied to clipboard

EfficientNetL2 tf.keras error

Open kurnianggoro opened this issue 4 years ago • 3 comments

Hello,

it seems that the efficientnetL2 is having problem i tried to load model but i got an error for both imagenet and noisy student checkpoint

the error message is something like this (i deleted some of them for simplicity)

/usr/local/lib/python3.6/dist-packages/efficientnet/model.py in EfficientNet(width_coefficient, depth_coefficient, default_resolution, dropout_rate, drop_connect_rate, depth_divisor, blocks_args, model_name, include_top, weights, input_tensor, input_shape, pooling, classes, **kwargs)
    386                                   activation=activation,
    387                                   drop_rate=drop_rate,
--> 388                                   prefix=block_prefix)
    389                 block_num += 1
    390 

/usr/local/lib/python3.6/dist-packages/efficientnet/model.py in mb_conv_block(inputs, block_args, activation, drop_rate, prefix)
    240             x = Dropout(drop_rate,
    241                         noise_shape=(None, 1, 1, 1),
--> 242                         name=prefix + 'drop')(x)
    243         x = layers.add([x, inputs], name=prefix + 'add')
    244 

'ValueError: rate must be a scalar tensor or a float in the range [0, 1), got 1'

You can check the code here https://colab.research.google.com/drive/1IyKFQut8q23jKeGOgXzSmn4e2qKGTyzl

I dont really understand why this is happened since the code for this model is basically same with the other versions but using different parameters in width_coefficient,depth_coefficient,default_resolution,dropout_rate

kurnianggoro avatar Jun 29 '20 03:06 kurnianggoro

Maybe related to this one #117

kurnianggoro avatar Jun 29 '20 03:06 kurnianggoro

So I did some digging, and it looks like this is not ready for use yet. First of all, there is an error when calculating the drop_rate here. The default value of drop_connect_rate will return a drop_rate of 1. You can get around this by calling efficientnetL2 with the parameter drop_connect_rate=0.05. However, there will be new errors when the weights for L2 are downloaded.

In the weights file, there is no key for efficientnet-l2. Checking the reference to the weights download release, you can see that there is indeed no weights for L2.

Basically, EfficientNetL2 does not seem to be implemented, nor are there weights for it yet.

kd2718 avatar Jul 08 '20 22:07 kd2718

What's the error involving drop_rate? Has it been fixed?

ucb-pb avatar Apr 13 '21 05:04 ucb-pb