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
Go to Install on Macbook M1 chip
How to use
import fusionlab as fl
# PyTorch
encoder = fl.encoders.VGG16()
# Tensorflow
encoder = fl.encoders.TFVGG16()
Encoders
Losses
- Dice Loss
- Tversky Loss
- IoU Loss
# Dice Loss (Multiclass)
import fusionlab as fl
import torch
import tensorflow as tf
# PyTorch
pred = torch.normal(0., 1., (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.normal(0, 1, (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, base_dim=64)
# Tensorflow UNet
import tensorflow as tf
# Multiclass Segmentation
unet = tf.keras.Sequential([
fl.segmentation.TFUNet(num_cls=10, base_dim=64),
tf.keras.layers.Activation(tf.nn.softmax),
])
unet.compile(loss=fl.losses.TFDiceLoss("multiclass"))
# Binary Segmentation
unet = tf.keras.Sequential([
fl.segmentation.TFUNet(num_cls=1, base_dim=64),
tf.keras.layers.Activation(tf.nn.sigmoid),
])
unet.compile(loss=fl.losses.TFDiceLoss("binary"))
- UNet
- ResUNet
- UNet2plus
News
0.0.52
- Tversky Loss for Torch and TF
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.2.tar.gz
(35.9 kB
view hashes)
Built Distribution
fusionlab-0.1.2-py3-none-any.whl
(60.3 kB
view hashes)
Close
Hashes for fusionlab-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62141e5178fd13577c4402f44638d6b075b8724eaf59ca730819d1912b41276d |
|
MD5 | 627e1feb9e54f524d33a5b6e05c5da5a |
|
BLAKE2b-256 | 660041bcbaca0b0744be711e82026860ac5b1f48a3f9647602e51ce8909b0051 |