the original code belongs to Raphael Pisoni and Github repo: https://github.com/sleepingcat4/sharpened-cosine-similarity/blob/main/keras/README.md
I wrapped the code around for this Python library
send me an email if you require help
How to use
from sharpcosine import CosSim2D
from sharpcosine import MaxAbsPool2D
model = tf.keras.Sequential(
[
tf.keras.layers.InputLayer(input_shape=input_shape),
CosSim2D(3, 32),
MaxAbsPool2D(2, True),
CosSim2D(3, 64,),
MaxAbsPool2D(2, True),
CosSim2D(3, 128),
MaxAbsPool2D(2, True),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(num_classes)
]
)
Credit: https://www.rpisoni.dev/posts/cossim-convolution-part2/
Release files for sharpcosine 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sharpcosine-0.1.1.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sharpcosine-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 kB