A Python package for time series augmentation

Overview

tsaug

Build Status Documentation Status Coverage Status PyPI Downloads Code style: black

tsaug is a Python package for time series augmentation. It offers a set of augmentation methods for time series, as well as a simple API to connect multiple augmenters into a pipeline.

See https://tsaug.readthedocs.io complete documentation.

Installation

Prerequisites: Python 3.5 or later.

It is recommended to install the most recent stable release of tsaug from PyPI.

pip install tsaug

Alternatively, you could install from source code. This will give you the latest, but unstable, version of tsaug.

git clone https://github.com/arundo/tsaug.git
cd tsaug/
git checkout develop
pip install ./

Examples

A first-time user may start with two examples:

Examples of every individual augmenter can be found here

For full references of implemented augmentation methods, please refer to References.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Please see Contributing for more details.

License

tsaug is licensed under the Apache License 2.0. See the LICENSE file for details.

Comments
  • How to cite this repo?

    How to cite this repo?

    Basically the title. I used this awesome repo and I would like to cite this repo in my paper. How to do it. If you could provide a bibtex entry that will be great

    question 
    opened by kowshikthopalli 2
  • Default _Augmentor arguments will raise an error

    Default _Augmentor arguments will raise an error

    While working on #1 I found that the default args for initializing an _Augmentor object could lead to the code trying to call None when expecting a function.

    See: https://github.com/arundo/tsaug/blob/ebf1955664991fe51f038a5cc8506f1bfc849d91/src/tsaug/augmentor.py#L5 https://github.com/arundo/tsaug/blob/ebf1955664991fe51f038a5cc8506f1bfc849d91/src/tsaug/augmentor.py#L6

    and

    https://github.com/arundo/tsaug/blob/ebf1955664991fe51f038a5cc8506f1bfc849d91/src/tsaug/augmentor.py#L47

    I know that it's not intended to be initialized without an augmenter function, function, but I was wondering if you want to explicitly prevent an error here.

    Or is something else supposed to be happening?

    bug 
    opened by roycoding 1
  • can't find the deepad python package

    can't find the deepad python package

    In the quickstart notebook https://github.com/arundo/tsaug/blob/master/docs/quickstart.ipynb from deepad.visualization import plot where can you find the deepad package to install?

    opened by xsqian 1
  • Missing function calls in documentation

    Missing function calls in documentation

    Hi!

    I noticed that documentation is actually missing few important notes.

    For instance, first example contains such snippet:

    >>> import numpy as np
    >>> X = np.load("./X.npy")
    >>> Y = np.load("./Y.npy")
    >>> from tsaug.visualization import plot
    >>> plot(X, Y)
    

    and shows a chart which suggests that it is immediately rendered after calling plot function.

    In configurations I've seen and worked on, plot function does not render any chart immediately. Instead it returns Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]. This means that we need to take first element of returned tuple and call .show() on it, so this example should rather be:

    >>> import numpy as np
    >>> X = np.load("./X.npy")
    >>> Y = np.load("./Y.npy")
    >>> from tsaug.visualization import plot
    >>> figure, _ = plot(X, Y)
    >>> figure.show()
    

    I can create a push request with such corrections if you're open for contribution

    opened by 15bubbles 0
  • Static random augmentation across multiple time series

    Static random augmentation across multiple time series

    Hello,

    I have a use case where I apply temporal augmentation with the same random anchor across multiple time series within a segmented object. I.e., I want certain augmentations to vary across objects, but remain constant within objects.

    In TimeWarp, e.g., I've added an optional keyword argument (static_rand):

        def __init__(
             self,
             n_speed_change: int = 3,
             max_speed_ratio: Union[float, Tuple[float, float], List[float]] = 3.0,
             repeats: int = 1,
             prob: float = 1.0,
             seed: Optional[int] = _default_seed,
             static_rand: Optional[bool] = False
         ):
    

    which is used by:

             if self.static_rand:                                                                                                                      
                 anchor_values = rand.uniform(low=0.0, high=1.0, size=self.n_speed_change + 1)
                 anchor_values = np.tile(anchor_values, (N, 1))
             else:
                 anchor_values = rand.uniform(
                     low=0.0, high=1.0, size=(N, self.n_speed_change + 1)
                 )
    

    Thus, instead of having N time series with different random anchor_values, I generate N time series with the same anchor value.

    I use this approach with TimeWarp and Drift. Would this be of any interest as a PR, or does it sound too specific?

    Thanks for the nice library.

    opened by jgrss 0
  • _Augmenter should be exposed properly as tsaug.Augmenter

    _Augmenter should be exposed properly as tsaug.Augmenter

    Might be related to https://github.com/arundo/tsaug/issues/1

    In the current state of the package, the _Augmenter class is an internal class that should not be used outside of the package itself... but it's also the base class for all usable classes from tsaug. This makes it very weird to type "generic" functions outside of tsaug, e.g.

    # this should not appear in a normal Python code
    from tsaug._augmenters.base import _Augmenter
    
    def apply_transformation(aug: _Augmenter):
        ...
    

    The _Augmenter class should be exposed as tsaug.Augmenter so that it can be used for proper typing outside of the tsaug package.

    help wanted 
    opened by Holt59 0
  • Equivalence in transformation names

    Equivalence in transformation names

    Hello

    I'm very interested to use and apply Tsaug library in my personal project.

    I have read the paper "Data Augmentation ofWearable Sensor Data for Parkinson’s Disease Monitoring using Convolutional Neural Networks" and I'm quite confused about the name of the transformations.

    What are the equivalent in TSAUG library for the transformations Jittering, Scaling, rotation, permutation, MagWarp mentioned in this paper?

    Also, I have read the blog "https://www.arundo.com/arundo_tech_blog/tsaug-an-open-source-python-package-for-time-series-augmentation", and I didn´t find the equivalent for RandomMagnify, RandomJitter, etc.

    Could you help me with these doubts.

    Best regards

    Oscar

    question 
    opened by ogreyesp 1
  • ValueError: The numbers of series in X and Y are different.

    ValueError: The numbers of series in X and Y are different.

    The shape of X is (54, 337) and the shape of y is (54,). But I am getting error. I am using the following code

    from tsaug import TimeWarp, Crop, Quantize, Drift, Reverse
    my_augmenter = (
        TimeWarp() * 5  # random time warping 5 times in parallel
        + Crop(size=300)  # random crop subsequences with length 300
        + Quantize(n_levels=[10, 20, 30])  # random quantize to 10-, 20-, or 30- level sets
        + Drift(max_drift=(0.1, 0.5)) @ 0.8  # with 80% probability, random drift the signal up to 10% - 50%
        + Reverse() @ 0.5  # with 50% probability, reverse the sequence
    )
    data, labels = my_augmenter.augment(data, labels)
    
    question 
    opened by talhaanwarch 3
  • How to augment multi_variate time series data?

    How to augment multi_variate time series data?

    I noticed that while augmenting multi-variate time series data, augmented data is concatenated on 0 axes, instead of being added to a new axis ie third axis. Let suppose data shape is (18,1000), after augmentation it turns to be (72,1000), but i believe it should be (4,18,1000). simply reshaping data.reshape(4,18,1000) resolve the problem or not?

    question 
    opened by talhaanwarch 2
Releases(v0.2.1)
Revisiting Discriminator in GAN Compression: A Generator-discriminator Cooperative Compression Scheme (NeurIPS2021)

Revisiting Discriminator in GAN Compression: A Generator-discriminator Cooperative Compression Scheme (NeurIPS2021) Overview Prerequisites Linux Pytho

Shaojie Li 34 Mar 31, 2022
Code for Ditto: Building Digital Twins of Articulated Objects from Interaction

Ditto: Building Digital Twins of Articulated Objects from Interaction Zhenyu Jiang, Cheng-Chun Hsu, Yuke Zhu CVPR 2022, Oral Project | arxiv News 2022

UT Robot Perception and Learning Lab 78 Dec 22, 2022
PassAPI is a password generator in hash format and fully developed in Python, with the aim of teaching how to handle and build

simple, elegant and safe Introduction PassAPI is a password generator in hash format and fully developed in Python, with the aim of teaching how to ha

Johnsz 2 Mar 02, 2022
Official code of paper "PGT: A Progressive Method for Training Models on Long Videos" on CVPR2021

PGT Code for paper PGT: A Progressive Method for Training Models on Long Videos. Install Run pip install -r requirements.txt. Run python setup.py buil

Bo Pang 27 Mar 30, 2022
An image processing project uses Viola-jones technique to detect faces and then use SIFT algorithm for recognition.

Attendance_System An image processing project uses Viola-jones technique to detect faces and then use LPB algorithm for recognition. Face Detection Us

8 Jan 11, 2022
TensorLight - A high-level framework for TensorFlow

TensorLight is a high-level framework for TensorFlow-based machine intelligence applications. It reduces boilerplate code and enables advanced feature

Benjamin Kan 10 Jul 31, 2022
Measuring Coding Challenge Competence With APPS

Measuring Coding Challenge Competence With APPS This is the repository for Measuring Coding Challenge Competence With APPS by Dan Hendrycks*, Steven B

Dan Hendrycks 218 Dec 27, 2022
Official PyTorch implementation of "Contrastive Learning from Extremely Augmented Skeleton Sequences for Self-supervised Action Recognition" in AAAI2022.

AimCLR This is an official PyTorch implementation of "Contrastive Learning from Extremely Augmented Skeleton Sequences for Self-supervised Action Reco

Gty 44 Dec 17, 2022
PyTorch implementation of PSPNet

PSPNet with PyTorch Unofficial implementation of "Pyramid Scene Parsing Network" (https://arxiv.org/abs/1612.01105). This repository is just for caffe

Kazuto Nakashima 52 Nov 16, 2022
StarGAN - Official PyTorch Implementation (CVPR 2018)

StarGAN - Official PyTorch Implementation ***** New: StarGAN v2 is available at https://github.com/clovaai/stargan-v2 ***** This repository provides t

Yunjey Choi 5.1k Jan 04, 2023
Some useful blender add-ons for SMPL skeleton's poses and global translation.

Blender add-ons for SMPL skeleton's poses and trans There are two blender add-ons for SMPL skeleton's poses and trans.The first is for making an offli

犹在镜中 154 Jan 04, 2023
we propose a novel deep network, named feature aggregation and refinement network (FARNet), for the automatic detection of anatomical landmarks.

Feature Aggregation and Refinement Network for 2D Anatomical Landmark Detection Overview Localization of anatomical landmarks is essential for clinica

aoyueyuan 0 Aug 28, 2022
A simple editor for captions in .SRT file extension

WaySRT A simple editor for captions in .SRT file extension The program doesn't use any external dependecies, just run: python way_srt.py {file_name.sr

Gustavo Lopes 3 Nov 16, 2022
MT-GAN-PyTorch - PyTorch Implementation of Learning to Transfer: Unsupervised Domain Translation via Meta-Learning

MT-GAN-PyTorch PyTorch Implementation of AAAI-2020 Paper "Learning to Transfer: Unsupervised Domain Translation via Meta-Learning" Dependency: Python

29 Oct 19, 2022
[Open Source]. The improved version of AnimeGAN. Landscape photos/videos to anime

[Open Source]. The improved version of AnimeGAN. Landscape photos/videos to anime

CC 4.4k Dec 27, 2022
Code for EMNLP 2021 main conference paper "Text AutoAugment: Learning Compositional Augmentation Policy for Text Classification"

Text-AutoAugment (TAA) This repository contains the code for our paper Text AutoAugment: Learning Compositional Augmentation Policy for Text Classific

LancoPKU 105 Jan 03, 2023
This repository is for DSA and CP scripts for reference.

dsa-script-collections This Repo is the collection of DSA and CP scripts for reference. Contents Python Bubble Sort Insertion Sort Merge Sort Quick So

Aditya Kumar Pandey 9 Nov 22, 2022
Node Editor Plug for Blender

NodeEditor Blender的程序化建模插件 Show Current 基本框架:自定义的tree-node-socket、tree中的node与socket采用字典查询、基于socket入度的拓扑排序 数据传递和处理依靠Tree中的字典,socket传递字典key TODO 增加更多的节点

Cuimi 11 Dec 03, 2022
Modeling CNN layers activity with Gaussian mixture model

GMM-CNN This code package implements the modeling of CNN layers activity with Gaussian mixture model and Inference Graphs visualization technique from

3 Aug 05, 2022
OSLO: Open Source framework for Large-scale transformer Optimization

O S L O Open Source framework for Large-scale transformer Optimization What's New: December 21, 2021 Released OSLO 1.0. What is OSLO about? OSLO is a

TUNiB 280 Nov 24, 2022