TensorFlow IBR5, IBR6, and fused IBR algorithms with MobileNetV2 variants
Project description
ibr-defused-algorithms
Independent PyPI module for:
IBR5Net(5-stage from-scratch CNN)IBR6Net(6-stage from-scratch CNN)FusedIBR5IBR6(late fusion of IBR5 + IBR6 features)IBR5MobileNetV2(MobileNetV2 IBR5-style branch)IBR6MobileNetV2(MobileNetV2 IBR6-style branch)FusedIBR5IBR6MobileNetV2(fused MobileNetV2 branches)
TensorFlow/Keras backend only.
Install
pip install ibr-defused-algorithms
TensorFlow/Keras Usage
import tensorflow as tf
from ibr_defused_algo import (
FusedIBR5IBR6,
FusedIBR5IBR6MobileNetV2,
IBR5MobileNetV2,
IBR5Net,
IBR6MobileNetV2,
IBR6Net,
)
# TensorFlow models expect NHWC tensors: [batch, height, width, channels]
x = tf.random.normal((4, 224, 224, 3))
ibr5 = IBR5Net(num_classes=7)
ibr6 = IBR6Net(num_classes=7)
fused = FusedIBR5IBR6(num_classes=7)
ibr5_mnv2 = IBR5MobileNetV2(num_classes=7, pretrained=False)
ibr6_mnv2 = IBR6MobileNetV2(num_classes=7, pretrained=False)
fused_mnv2 = FusedIBR5IBR6MobileNetV2(num_classes=7, pretrained=False)
print(ibr5(x).shape) # [4, 7]
print(ibr6(x).shape) # [4, 7]
print(fused(x).shape) # [4, 7]
print(ibr5_mnv2(x).shape) # [4, 7]
print(ibr6_mnv2(x).shape) # [4, 7]
print(fused_mnv2(x).shape) # [4, 7]
# Compile and train:
ibr5.compile(
optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy']
)
# ibr5.fit(train_ds, epochs=10)
Framework sanity check (recommended in notebooks)
import tensorflow as tf
from ibr_defused_algo.tensorflow_models import IBR5Net
print("Module:", IBR5Net.__module__) # should be: ibr_defused_algo.tensorflow_models
model = IBR5Net(num_classes=7)
print("Is tf.keras.Model:", isinstance(model, tf.keras.Model))
If that last line prints False, the runtime is importing the wrong backend. Reinstall and restart kernel.
Build & Publish
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ibr_defused_algorithms-0.3.2.tar.gz.
File metadata
- Download URL: ibr_defused_algorithms-0.3.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99ead5ba22992ad2131c64f1e1d491a09abaf70dc722c4c7c70cf01ebd714945
|
|
| MD5 |
b0c0456d52134777f85e1e3f3feef4c0
|
|
| BLAKE2b-256 |
a0bb28dd8178f871c380ad20aac717228175701b7c030b4d9506e1289eb6aa2b
|
File details
Details for the file ibr_defused_algorithms-0.3.2-py3-none-any.whl.
File metadata
- Download URL: ibr_defused_algorithms-0.3.2-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc36509eafb374fd35fc6f3253a50e182c0933913e225cc50dadc9defe34156a
|
|
| MD5 |
21fd2731233b9a4f0617fc60054880e3
|
|
| BLAKE2b-256 |
ecf5d496b4cba55594ba19642caa80a07426a1b89215842dc3ba2911648be13a
|