Useful packages for DL
Project description
FusionLab
FusionLab is an open-source frameworks built for Deep Learning research written in PyTorch and Tensorflow. The code is easy to read and modify especially for newbie. Feel free to send pull requests :D
Installation
With pip
pip install fusionlab
For Mac M1 chip users
How to use
import fusionlab as fl
# PyTorch
encoder = fl.encoders.VGG16()
# Tensorflow
encoder = fl.encoders.TFVGG16()
Documentation
Encoders
Losses
- Dice Loss
- Tversky Loss
- IoU Loss
# Dice Loss (Multiclass)
import fusionlab as fl
# PyTorch
pred = torch.randn(1, 3, 4, 4) # (N, C, *)
target = torch.randint(0, 3, (1, 4, 4)) # (N, *)
loss_fn = fl.losses.DiceLoss()
loss = loss_fn(pred, target)
# Tensorflow
pred = tf.random.normal((1, 4, 4, 3), 0., 1.) # (N, *, C)
target = tf.random.uniform((1, 4, 4), 0, 3) # (N, *)
loss_fn = fl.losses.TFDiceLoss("multiclass")
loss = loss_fn(target, pred)
# Dice Loss (Binary)
# PyTorch
pred = torch.randn(1, 1, 4, 4) # (N, 1, *)
target = torch.randint(0, 3, (1, 4, 4)) # (N, *)
loss_fn = fl.losses.DiceLoss("binary")
loss = loss_fn(pred, target)
# Tensorflow
pred = tf.random.normal((1, 4, 4, 1), 0., 1.) # (N, *, 1)
target = tf.random.uniform((1, 4, 4), 0, 3) # (N, *)
loss_fn = fl.losses.TFDiceLoss("binary")
loss = loss_fn(target, pred)
Segmentation
import fusionlab as fl
# PyTorch UNet
unet = fl.segmentation.UNet(cin=3, num_cls=10)
# Tensorflow UNet
# Multiclass Segmentation
unet = tf.keras.Sequential([
fl.segmentation.TFUNet(num_cls=10, base_dim=64),
tf.keras.layers.Activation(tf.nn.softmax),
])
# Binary Segmentation
unet = tf.keras.Sequential([
fl.segmentation.TFUNet(num_cls=1, base_dim=64),
tf.keras.layers.Activation(tf.nn.sigmoid),
])
- UNet
- ResUNet
- UNet2plus
N Dimensional Model
some models can be used in 1D, 2D, 3D
import fusionlab as fl
resnet1d = fl.encoders.ResNet50V1(cin=3, spatial_dims=1)
resnet2d = fl.encoders.ResNet50V1(cin=3, spatial_dims=2)
resnet3d = fl.encoders.ResNet50V1(cin=3, spatial_dims=3)
unet1d = fl.segmentation.UNet(cin=3, num_cls=10, spatial_dims=1)
unet2d = fl.segmentation.UNet(cin=3, num_cls=10, spatial_dims=2)
unet3d = fl.segmentation.UNet(cin=3, num_cls=10, spatial_dims=3)
News
Acknowledgements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fusionlab-0.1.11.tar.gz
(63.2 kB
view hashes)
Built Distribution
fusionlab-0.1.11-py3-none-any.whl
(95.4 kB
view hashes)
Close
Hashes for fusionlab-0.1.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f89f0d29d16021af62ed75770af77f1c25ff6adf0c06cb1e416f6f1fa7a8346 |
|
MD5 | f1e542a26f978946725bf3a4d891b531 |
|
BLAKE2b-256 | d65e3f94d8baf2911c1e90c5ec3bcdc8b6abdee66a6497add7d4e4d72fb70a7a |