You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import efficientnet.keras as efn
base_model = efn.EfficientNetB7(weights=None, include_top=False,drop_connect_rate=0.4)
model.fit fails for the error "ValueError: rate must be a scalar tensor or a float in the range [0, 1), got 1" though a valid value is given for drop_connect_rate. If I remove and run it, works as expected
I faced this problem when I tried to use default EfficientNetL2. The dropout rate was gradually increased from 0.0125 to 1.0 as the number of blocks was increasing. I think maybe it is a good idea to modify the model.py file as follow,
--- a/efficientnet/model.py 2021-07-07 10:52:39.000000000 +0900
+++ b/efficientnet/model.py 2021-07-07 10:43:06.000000000 +0900
@@ -366,6 +366,8 @@
# The first block needs to take care of stride and filter size increase.
drop_rate = drop_connect_rate * float(block_num) / num_blocks_total
+ if drop_rate > 0.5:
+ drop_rate = 0.5
x = mb_conv_block(x, block_args,
activation=activation,
drop_rate=drop_rate,
@@ -378,6 +380,9 @@
# pylint: enable=protected-access
for bidx in xrange(block_args.num_repeat - 1):
drop_rate = drop_connect_rate * float(block_num) / num_blocks_total
+ if drop_rate > 0.5:
+ drop_rate = 0.5
block_prefix = 'block{}{}_'.format(
idx + 1,
string.ascii_lowercase[bidx + 1]
import efficientnet.keras as efn
base_model = efn.EfficientNetB7(weights=None, include_top=False,drop_connect_rate=0.4)
model.fit fails for the error "ValueError: rate must be a scalar tensor or a float in the range [0, 1), got 1" though a valid value is given for drop_connect_rate. If I remove and run it, works as expected
ValueError: in user code:
The text was updated successfully, but these errors were encountered: