efficientnet icon indicating copy to clipboard operation
efficientnet copied to clipboard

What does FixedDropout layer does?

Open xiankgx opened this issue 5 years ago • 5 comments

Dear author, your work on implementing EfficientNets for Keras is much appreciated.

I'm using your segmentation_models library which in turn uses this library. I trained a model in pure Keras (2.2.4) + TF v1.14.0. Using tensorflowjs_converter command line tool, I was able to convert the model to TF.js without any issues. However, when I try to do inference in TF.js, it is giving me two errors, swish activation function not implemented, and FixedDropout layer not implemented. I have implemented a custom swish layer in TF.js according to your code. However, I'm not too sure about FixedDropout.

According to your code, it says

"""Wrapper over custom dropout. Fix problem of ``None`` shape for tf.keras.
    It is not possible to define FixedDropout class as global object,
    because we do not have modules for inheritance at first time.
    Issue:
        https://github.com/tensorflow/tensorflow/issues/30946
    """

It seems it is just fixing some shape issue for tf.keras. Can I just subclass FixedDropout from Dropout in TensorFlow.js without overwriting the forward/call function?

xiankgx avatar Jun 22 '20 08:06 xiankgx

@xiankgx Thanks for your issue. I meet the same situation.

I trained a model in pure Keras(2.2.4) + TF 1.15.0. For HeadPoseEstimation task, I refered to the xiankg/HeadPoseEstimation-WHENet as my model and attempted to convert to a TF.js model.

So the question about the FixedDropout, Can I just subclass FixedDropout from Dropout in TensorFlow.js without overwriting the forward/call function?, does you solve it now?

And I'm new to TF.js, so I just wonder about the code. Can only refer the tensorflow.js official documents to deploy the code to mobile device or you use the other third party libraries available to help?

Thank you !

YifeiYang210 avatar May 03 '21 15:05 YifeiYang210

I am having the same issue when loading the model on raspberry Pi

bilaltahseen avatar May 04 '21 23:05 bilaltahseen

I succeed to load it. Subclass FixedDropout from Dropout MAY help!

YifeiYang210 avatar May 21 '21 09:05 YifeiYang210

@YifeiYang210 how did you create a subclass from that Dropout? I'm only able to create a subclass from Layer

jclaessens97 avatar Feb 11 '22 14:02 jclaessens97

any update on this? I would like to call FixedDropout as I do for the other layers, e.g. keras.layers.Conv2D but keras.layers.FixedDropout gives an error AttributeError: module 'keras.layers' has no attribute 'FixedDropout'

elliestath avatar Apr 06 '22 12:04 elliestath