An example of time series augmentation methods with Keras

Overview

Time Series Augmentation

This is a collection of time series data augmentation methods and an example use using Keras.

News

  • 2020/04/16: Repository Created.
  • 2020/06/22: Accepted to ICPR 2020 - B. K. Iwana and S. Uchida, Time Series Data Augmentation for Neural Networks by Time Warping with a Discriminative Teacher, ICPR 2020 LINK
  • 2020/07/31: Survey Paper Posted on arXiv - B. K. Iwana and S. Uchida An Empirical Survey of Data Augmentation for Time Series Classification with Neural Networks, arXiv LINK
  • 2021/05/11: Tensorflow v1 branched. The master will now support Tensorflow v2.
  • 2021/07/15: Survey Paper Published on PLOS ONE - B. K. Iwana and S. Uchida An Empirical Survey of Data Augmentation for Time Series Classification with Neural Networks, PLOS ONE 16(7): e0254841, LINK

Requires

This code was developed in Python 3.6.9. and requires Tensorflow 2.4.1 and Keras 2.2.4

Normal Install

pip install tensorflow-gpu==2.4.1 keras==2.2.4 numpy==1.19.5 matplotlib==2.2.2 scikit-image==0.15.0 tqdm

Docker

cd docker
sudo docker build -t tsa .
docker run --runtime nvidia -rm -it -p 127.0.0.1:8888:8888 -v `pwd`:/work -w /work tsa jupyter notebook --allow-root

Newer docker installs might use --gpus all instead of --runtime nvidia

Dataset

main.py was designed to use the UCR Time Series Archive 2018 datasets. To install the datasets, download the .zip file from https://www.cs.ucr.edu/~eamonn/time_series_data_2018/ and extract the contents into the data folder.

Usage

Description of Time Series Augmentation Methods

Augmentation description

Jupyter Example

Jupyter Notebook

Keras Example

Example: To train a 1D VGG on the FiftyWords dataset from the UCR Time Series Archive 2018 with 4x the training dataset in Jittering, use:

python3 main.py --gpus=0 --dataset=CBF --preset_files --ucr2018 --normalize_input --train --save --jitter --augmentation_ratio=4 --model=vgg

Citation

B. K. Iwana and S. Uchida, "An Empirical Survey of Data Augmentation for Time Series Classification with Neural Networks," arXiv, 2020.

@article{iwana2020empirical,
  title={An Empirical Survey of Data Augmentation for Time Series Classification
  with Neural Networks},
  author={Iwana, Brian Kenji and Uchida, Seiichi},
  journal={arXiv preprint arXiv:2007.15951},
  year={2020}
}
Comments
  • Format of the input

    Format of the input

    Hi!

    Great work with Discriminative Guided Warping, I want to it out by myself with some of my own datasets but I'm not quite sure about the format of the input. In the docs, it says it should be in the format (batch, time_steps, channel). In the case of my dataset, which is a table with sales data over multiple years with let's say 1000 samples (days) and 10 features/channels (like sales of certain products, weekday, date, etc.). So I would have to split this dataset into sequences with the sequence length time_steps and batch would be the number of sequences I have after splitting, am I right? Channel would still be the number of features, of course.

    Kind regards!

    opened by Zepp3 5
  • Weird progress prints

    Weird progress prints

    Hi,

    while executing the aug.discriminative_guided_warp() method, I get weird progress print, not like the self-filling progress bar as it should appear, but instead like this:

      1%|▊                                                                                                                                                       | 6/1086 [00:00<00:23, 45.20it/s]
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
      2%|███▊                                                                                                                                                   | 27/1086 [00:00<00:18, 58.39it/s]
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    There is only one pattern of class 0
    

    Is there a way to suppress this?

    Kind regards!

    opened by Zepp3 4
  • CUDA support and theoretical question

    CUDA support and theoretical question

    Hi!

    DGW does in my case not use gpu, even though one would be available. From the code, I see that theoretically, CUDA support should be available. Does anyone else have a similar problem?

    Also, I have a theoretical question: would you classify your model as a machine learning model? DGW does not actually use a neural network if I read the code correctly.

    Kind regards!

    opened by Zepp3 1
  • Local Python Script Installation Help

    Local Python Script Installation Help

    The docs say i need to install:

    pip install tensorflow-gpu==2.4.1 keras==2.2.4 numpy==1.19.5 matplotlib==2.2.2 
    scikit-image==0.15.0 tqdm
    

    But when running the jupyter notebook everything runs fine without having to install anything. Thus, if I want to move the code to a python script how would I use:

    import utils.augmentation as aug
    

    Do I need to install a library or copy over this code to my project? I do not need to run this on a GPU.

    Is the only file I need to generate augmented data?:

    augmentation.py
    

    If only using that file then the only thing I would need to install would be the following;

    pip install tqdm
    
    opened by wwjd1234 1
  • Theoretical question to the discriminator

    Theoretical question to the discriminator

    Hi!

    From the paper, I have not yet quite understood how the discriminator selects the reference, and in that context, I don't know what is meant by "class" in this paper.

    Kind regards!

    opened by Zepp3 0
Owner
九州大学 ヒューマンインタフェース研究室
Human Interface Laboratory, Kyushu University
九州大学 ヒューマンインタフェース研究室
Time-series-deep-learning - Developing Deep learning LSTM, BiLSTM models, and NeuralProphet for multi-step time-series forecasting of stock price.

Stock Price Prediction Using Deep Learning Univariate Time Series Predicting stock price using historical data of a company using Neural networks for

Abdultawwab Safarji 7 Nov 27, 2022
TAug :: Time Series Data Augmentation using Deep Generative Models

TAug :: Time Series Data Augmentation using Deep Generative Models Note!!! The package is under development so be careful for using in production! Fea

null 35 Dec 6, 2022
The source code for the Cutoff data augmentation approach proposed in this paper: "A Simple but Tough-to-Beat Data Augmentation Approach for Natural Language Understanding and Generation".

Cutoff: A Simple Data Augmentation Approach for Natural Language This repository contains source code necessary to reproduce the results presented in

Dinghan Shen 49 Dec 22, 2022
Image transformations designed for Scene Text Recognition (STR) data augmentation. Published at ICCV 2021 Workshop on Interactive Labeling and Data Augmentation for Vision.

Data Augmentation for Scene Text Recognition (ICCV 2021 Workshop) (Pronounced as "strog") Paper Arxiv Why it matters? Scene Text Recognition (STR) req

Rowel Atienza 152 Dec 28, 2022
Keras-1D-ACGAN-Data-Augmentation

Keras-1D-ACGAN-Data-Augmentation What is the ACGAN(Auxiliary Classifier GANs) ? Related Paper : [Abstract : Synthesizing high resolution photorealisti

Jae-Hoon Shim 7 Dec 23, 2022
aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)

Bayesian Methods for Hackers Using Python and PyMC The Bayesian method is the natural approach to inference, yet it is hidden from readers behind chap

Cameron Davidson-Pilon 25.1k Jan 2, 2023
A PyTorch-based open-source framework that provides methods for improving the weakly annotated data and allows researchers to efficiently develop and compare their own methods.

Knodle (Knowledge-supervised Deep Learning Framework) - a new framework for weak supervision with neural networks. It provides a modularization for se

null 93 Nov 6, 2022
Implementation of temporal pooling methods studied in [ICIP'20] A Comparative Evaluation Of Temporal Pooling Methods For Blind Video Quality Assessment

Implementation of temporal pooling methods studied in [ICIP'20] A Comparative Evaluation Of Temporal Pooling Methods For Blind Video Quality Assessment

Zhengzhong Tu 5 Sep 16, 2022
This is an implementation of Googles Yogi-Optimizer in Keras (tf.keras)

Yogi-Optimizer_Keras This is an implementation of Googles Yogi-Optimizer in Keras (tf.keras) The NeurIPS-Paper can be found here: http://papers.nips.c

null 14 Sep 13, 2022
Keras udrl - Keras implementation of Upside Down Reinforcement Learning

keras_udrl Keras implementation of Upside Down Reinforcement Learning This is me

Eder Santana 7 Jan 24, 2022
Classification models 1D Zoo - Keras and TF.Keras

Classification models 1D Zoo - Keras and TF.Keras This repository contains 1D variants of popular CNN models for classification like ResNets, DenseNet

Roman Solovyev 12 Jan 6, 2023
Neon-erc20-example - Example of creating SPL token and wrapping it with ERC20 interface in Neon EVM

Example of wrapping SPL token by ERC2-20 interface in Neon Requirements Install

null 7 Mar 28, 2022
Python-kafka-reset-consumergroup-offset-example - Python Kafka reset consumergroup offset example

Python Kafka reset consumergroup offset example This is a simple example of how

Willi Carlsen 1 Feb 16, 2022
Using NumPy to solve the equations of fluid mechanics together with Finite Differences, explicit time stepping and Chorin's Projection methods

Computational Fluid Dynamics in Python Using NumPy to solve the equations of fluid mechanics ?? ?? ?? together with Finite Differences, explicit time

Felix Köhler 4 Nov 12, 2022
A keras-based real-time model for medical image segmentation (CFPNet-M)

CFPNet-M: A Light-Weight Encoder-Decoder Based Network for Multimodal Biomedical Image Real-Time Segmentation This repository contains the implementat

null 268 Nov 27, 2022
Instant Real-Time Example-Based Style Transfer to Facial Videos

FaceBlit: Instant Real-Time Example-Based Style Transfer to Facial Videos The official implementation of FaceBlit: Instant Real-Time Example-Based Sty

Aneta Texler 131 Dec 19, 2022
A unified framework for machine learning with time series

Welcome to sktime A unified framework for machine learning with time series We provide specialized time series algorithms and scikit-learn compatible

The Alan Turing Institute 6k Jan 8, 2023
Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting

Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting This is the origin Pytorch implementation of Informer in the followin

Haoyi 3.1k Dec 29, 2022