Giter VIP home page Giter VIP logo

solt's Introduction

slide

PyPI version CI codecov License DOI

Description

A data augmentation library for Deep Learning that supports images, segmentation masks, labels, and keypoints. Furthermore, SOLT is fast and has OpenCV in its backend. Full auto-generated docs and examples are available at https://oulu-imeds.github.io/solt/.

Features

  • Support of Images, masks, and keypoints for all the transforms (including multiple items at the time)
  • Fast and PyTorch-integrated
  • Convenient and flexible serialization API
  • Excellent documentation
  • Easy to extend
  • 100% Code coverage

Examples

Images: Cats Images + Keypoints: Cats Medical Images + Binary Masks: Brain MRI Medical Images + Multiclass Masks Knee MRI

E.g. the last row is generated using the following transforms stream.

stream = solt.Stream([
    slt.Rotate(angle_range=(-20, 20), p=1, padding='r'),
    slt.Crop((256, 256)),
    solt.SelectiveStream([
        slt.GammaCorrection(gamma_range=0.5, p=1),
        slt.Noise(gain_range=0.1, p=1),
        slt.Blur()    
    ], n=3)
])

img_aug, mask_aug = stream({'image': img, 'mask': mask})

If you want to visualize the results, you need to modify the execution of the transforms:

img_aug, mask_aug = stream({'image': img, 'mask': mask}, return_torch=False).data

Installation

The most recent version is available in pip:

pip install solt

You can fetch the most fresh changes from this repository:

pip install git+https://github.com/MIPT-Oulu/solt

Benchmark

We propose a fair benchmark based on the refactored version of the one proposed by albumentations team. Still, here, we also convert the results into a PyTorch tensor and do the ImageNet normalization. The following numbers support a realistic and honest comparison between the libraries (number of images per second, the higher - the better):

albumentations
0.4.3
torchvision (Pillow-SIMD backend)
0.5.0
augmentor
0.2.8
solt
0.1.9
HorizontalFlip 2253 2549 2561 3530
VerticalFlip 2380 2557 2572 3740
RotateAny 1479 1389 670 2070
Crop224 2566 1966 1981 4281
Crop128 5467 5738 5720 7186
Crop64 9285 9112 9049 10345
Crop32 11979 10550 10607 12348
Pad300 1642 109 - 2631
VHFlipRotateCrop 1574 1334 616 1889
HFlipCrop 2391 1943 1917 3572

Python and library versions: Python 3.7.0 (default, Oct 9 2018, 10:31:47) [GCC 7.3.0], numpy 1.18.1, pillow-simd 7.0.0.post3, opencv-python 4.2.0.32, scikit-image 0.16.2, scipy 1.4.1.

The code was run on AMD Threadripper 1900. Please find the details about the benchmark here.

How to contribute

Follow the guidelines described here.

Author

Aleksei Tiulpin, Research Unit of Health Sciences and Technology Faculty of Medicine University of Oulu, Finland.

How to cite

If you use SOLT and cite it in your research, please, don't hesitate to send an email to Aleksei Tiulpin. All the papers that use SOLT are listed here.

@misc{solt2019,
  author       = {Aleksei Tiulpin},
  title        = {SOLT: Streaming over Lightweight Transformations},
  month        = jul,
  year         = 2019,
  version      = {v0.1.9},
  doi          = {10.5281/zenodo.3702819},
  url          = {https://doi.org/10.5281/zenodo.3702819}
}

solt's People

Contributors

dependabot[bot] avatar imelekhov avatar lext avatar soupault avatar tiulpin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

solt's Issues

Improve serialization

Current serialization needs improvement. I does not work correctly all the time. We also need to make sure that we can load the transforms back after serialization

Docs aren't building

Warning, treated as error:
/home/travis/miniconda/envs/solt_test_env/lib/python3.7/site-packages/solt/transforms/_transforms.py:docstring of solt.transforms.IntensityRemap:15:Footnote [1] is not referenced.

@soupault Please fix.

Crashed without clear error message when tranforming multiple images with different shapes

Code to reproduce:

import solt
import solt.transforms as slt
import numpy as np


if __name__ == "__main__":
    trf = solt.Stream([slt.Resize(resize_to=(50, 50)),
                       slt.Flip()])
    img1 = np.ones((100, 100, 3), dtype=np.int32)
    img2 = np.ones((110, 110, 3), dtype=np.int32)
    trf_img = trf({'images': (img1, img2)})
    print('Done')

Adding a resize transformation at the beginning doesn't help. A clear error message is needed for this case.

Fix documentation website

Repository has been moved to new location, and we thus need to adjust the deployment of docs on the website

Compatibility issues with latest pytorch

Works fine with 1.1, but not 1.5.
Traceback:

    as_dict=as_dict, scale_keypoints=scale_keypoints, normalize=normalize, mean=mean, std=std,
  File ".../site-packages/solt/core/_data.py", line 273, in to_torch
    img.sub_(mean)
RuntimeError: output with backend CPU and dtype Byte doesn't match the desired backend CPU and dtype Float
Process finished with exit code 1

Add bounding box datatype

Existing API allows to do this already. Bounding box is simply a label + 4 keypoints.

Bounding Boxes need to support different formats, such as COCO.

Fair benchmark with the other libraries

the augbench package needs further development and its results need to be reported in the README.

the benchmark needs to cover random transformations rather than the static ones. It is important to make comparison for three cases: image, image mask, and image+10 masks (instance segmentation task).

Add class-specific probability

Would be useful to increase the probability of augmentation for rare classes. This should also work in a multi-label setting

Interpolation settings per data item

For segmentation it is often good to use nearest neighbors interpolation for masks, while for images bilinear or bicubic still needed to be kept.

3D transforms

Module 3D transforms would be nice to have. First suggested transforms are crops, flips and rotations 90 degrees

NameError: name 'ktps' is not defined

While testing one of the notebook algorithm, this error occured:
kpts = None for annotation_fname in glob.glob(os.path.join('Data', 'helen_annotations', '*.txt')): with open(annotation_fname) as f: if f.readline()[:-1] == fname.split('.')[0]: ktps = [] for l in f: tmp = l.split() ktps.append([float(tmp[0]), float(tmp[2])]) break kpts = np.array(ktps)

Specific Error:

NameError Traceback (most recent call last)
in
8 ktps.append([float(tmp[0]), float(tmp[2])])
9 break
---> 10 kpts = np.array(ktps)

NameError: name 'ktps' is not defined

Add numerc type

I found useful to have multi-modal setups in some projects, thus, it might be of need to have also a numeric type, and remove the label type at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.