-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown layer: 'FixedDropout' #150
Comments
Hello, thank you for your interest in this project😉 |
I apologize for the delayed reply. This model was built using the EfficientNet library, which is a collection of state-of-the-art models for image classification. To use the model, you need to install the library and import it as follows: import efficientnet.tfkeras I hope this helps. Have a nice day! 😊 |
And if you want the 'FixedDropout' here is a implementation of it in the original repo with the wrapper def get_dropout(**kwargs):
"""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
"""
backend, layers, models, keras_utils = get_submodules_from_kwargs(kwargs)
class FixedDropout(layers.Dropout):
def _get_noise_shape(self, inputs):
if self.noise_shape is None:
return self.noise_shape
symbolic_shape = backend.shape(inputs)
noise_shape = [symbolic_shape[axis] if shape is None else shape
for axis, shape in enumerate(self.noise_shape)]
return tuple(noise_shape)
return FixedDropout |
And I added from tensorflow.keras import layers, backend
class FixedDropout(layers.Dropout):
def _get_noise_shape(self, inputs):
if self.noise_shape is None:
return self.noise_shape
symbolic_shape = backend.shape(inputs)
noise_shape = [symbolic_shape[axis] if shape is None else shape
for axis, shape in enumerate(self.noise_shape)]
return tuple(noise_shape)
def get_config(self):
config = super().get_config()
return config
@classmethod
def from_config(cls, config):
return cls(**config) Example: from Utils.FixedDropout import FixedDropout
from keras.models import load_model
# Load the model
model = load_model('PAI_model_T.h5', custom_objects={'FixedDropout': FixedDropout}) |
And the only thing that FixedDropout does |
can you please tell me which model should i use PAI_model_T.h5
and PAI_model_weights in my project .h5.what is difference between them
…On Fri, 9 Feb 2024 at 17:16, Aydin ***@***.***> wrote:
And I added Utils\FixedDropout.py for the layer:
from tensorflow.keras import layers, backend
class FixedDropout(layers.Dropout):
def _get_noise_shape(self, inputs):
if self.noise_shape is None:
return self.noise_shape
symbolic_shape = backend.shape(inputs)
noise_shape = [symbolic_shape[axis] if shape is None else shape
for axis, shape in enumerate(self.noise_shape)]
return tuple(noise_shape)
def get_config(self):
config = super().get_config()
return config
@classmethod
def from_config(cls, config):
return cls(**config)
Example:
from Utils.FixedDropout import FixedDropoutfrom keras.models import load_model
# Load the modelmodel = load_model('PAI_model_T.h5', custom_objects={'FixedDropout': FixedDropout})
—
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXY5LKXEOG66KNQDAJ23RALYSYD7RAVCNFSM6AAAAABC6B3Z2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVG44DIMZSHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
from Utils.FixedDropout import FixedDropout
from keras.models import load_model
# Load the model
model = load_model('PAI_model_T.h5', custom_objects={'FixedDropout': FixedDropout}) and if you want a smaller model use PAI_model_light_T.h5 the acc is the same but its smaller and lighter. |
yes issue is resolved thankyou for replying and resolving my issue
…On Fri, 9 Feb 2024 at 17:30, Aydin ***@***.***> wrote:
Can you please confirm if the issue is resolved for you or if you need any
further assistance?
—
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXY5LKRM3WYKBEHZCFMVDSTYSYFURAVCNFSM6AAAAABC6B3Z2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVHAYDGNZSGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Can you please send code only related to the efficient.net B7.it very
confusing
On Wed, Feb 28, 2024, 1:06 PM Gharabidi Sunil ***@***.***>
wrote:
… yes issue is resolved thankyou for replying and resolving my issue
On Fri, 9 Feb 2024 at 17:30, Aydin ***@***.***> wrote:
> Can you please confirm if the issue is resolved for you or if you need
> any further assistance?
>
> —
> Reply to this email directly, view it on GitHub
> <#150 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AXY5LKRM3WYKBEHZCFMVDSTYSYFURAVCNFSM6AAAAABC6B3Z2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVHAYDGNZSGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Certainly! It seems you’re asking for specific parts of the code related to EfficientNet B7. To clarify, are you looking for the code that involves creating the EfficientNet B7 model, or are you seeking the code for making predictions using a pre-trained EfficientNet B7 model? |
And if possible create a new issue about your problem. |
It will be good if you provide both the code separately
…On Wed, Apr 24, 2024, 12:36 AM Aydin ***@***.***> wrote:
Certainly! It seems you’re asking for specific parts of the code related
to EfficientNet B7. To clarify, are you looking for the code that involves
creating the EfficientNet B7 model, or are you seeking the code for making
predictions using a pre-trained EfficientNet B7 model?
And if you want to just try the model download this GUI I made Link
<https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/releases/download/V1.0.3/Interface_GUI.exe>
—
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXY5LKRLQ4PGC7SWSS2M4F3Y62WKNAVCNFSM6AAAAABC6B3Z2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZTGIYTMNZQGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Code related to the efficient net B7-V6 model in which we get 97.12%
…On Wed, Apr 24, 2024, 12:36 AM Aydin ***@***.***> wrote:
Certainly! It seems you’re asking for specific parts of the code related
to EfficientNet B7. To clarify, are you looking for the code that involves
creating the EfficientNet B7 model, or are you seeking the code for making
predictions using a pre-trained EfficientNet B7 model?
And if you want to just try the model download this GUI I made Link
<https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/releases/download/V1.0.3/Interface_GUI.exe>
—
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXY5LKRLQ4PGC7SWSS2M4F3Y62WKNAVCNFSM6AAAAABC6B3Z2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZTGIYTMNZQGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If you're interested in the code for the model, I'm using this library: EfficientNet The code that trains the model is in a Jupyter notebook named Please note that there are no separate notebooks for each model. This is because the data processing and training parts are the same for every model. In the notebook, there are multiple cells from which you can choose any model. You can find the code for creating the EfficientNet B7 model in the same notebook. |
But it is confusing I am not able to fetch the particular code
…On Thu, Apr 25, 2024, 7:09 PM Aydin ***@***.***> wrote:
If you're interested in the code for the model, I'm using this library:
EfficientNet <https://github.com/qubvel/efficientnet>
The code that trains the model is in a Jupyter notebook named
Model_T&T.ipynb. There are also backups for the codes of older models.
Please note that there are no separate notebooks for each model. This is
because the data processing and training parts are the same for every
model. In the notebook, there are multiple cells from which you can choose
any model.
You can find the code for creating the EfficientNet B7 model in the same
notebook.
—
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXY5LKUDQRFHF7YMWCTAWA3Y7EBQFAVCNFSM6AAAAABC6B3Z2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXGIYTONRYGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I'm truly sorry but I can`t help you |
Error loading the model: Unknown layer: 'FixedDropout'. Please ensure you are using a
keras.utils.custom_object_scope
and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.this is issue i am facing can you provide custom layer.py file where fixeddropout is defined
The text was updated successfully, but these errors were encountered: