Skip to content

Commit

Permalink
Merge pull request #156 from Aydinhamedi/Alpha-b
Browse files Browse the repository at this point in the history
Alpha b
  • Loading branch information
Aydinhamedi authored Feb 9, 2024
2 parents 57382b9 + 67bdc10 commit 1bb5a14
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ Samples/*
/Interface/GUI/GUI_DEV.cmd

# Exclude logs in GUI interface
/Interface/GUI/Data/logs
/Interface/GUI/Data/logs
/Test_ENV_G.py
19 changes: 19 additions & 0 deletions Utils/FixedDropout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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)
10 changes: 10 additions & 0 deletions Utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
## Grad_cam (by GPT-4 😁)

## Other.py (by Me)

## FixedDropout.py (by Me)
For EfficientNet model. Example:
```python
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})
```

0 comments on commit 1bb5a14

Please sign in to comment.