Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khengyun/featurelayers
https://github.com/khengyun/featurelayers
ai keras-neural-networks keras-tensorflow python
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/khengyun/featurelayers
- Owner: khengyun
- Created: 2023-06-21T08:54:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-29T14:04:32.000Z (over 1 year ago)
- Last Synced: 2024-10-24T21:37:46.035Z (2 months ago)
- Topics: ai, keras-neural-networks, keras-tensorflow, python
- Language: Python
- Homepage: https://pypi.org/project/featurelayers/
- Size: 211 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FeatureLayers
## Installation
```bash
pip install featurelayers
```## Usage
### LBC Layers
```python
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Flatten
from featurelayers.layers.LBC import LBC# Create a simple Keras model
model = Sequential()
# Add the LBC layer as the first layer in the model
model.add(LBC(filters=32, kernel_size=3, stride=1, padding='same', activation='relu', sparsity=0.9, name='lbc_layer'))
# Add a Flatten layer to convert the output to 1D
model.add(Flatten())
# Add a Dense layer for classification
model.add(Dense(units=10, activation='softmax'))# Compile the model
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])# Generate some dummy data
x_train = np.random.rand(100, 28, 28, 1)
y_train = np.random.randint(0, 10, size=(100,))# Convert the labels to one-hot encoding
y_train = keras.utils.to_categorical(y_train, num_classes=10)# Train the model
model.fit(x_train, y_train, epochs=10, batch_size=32)```
__version__ = ""1.5.6""