Giter Club home page Giter Club logo

convlstm-pytorch's Introduction

ConvLSTM-Pytorch

ConvRNN cell

Implement ConvLSTM/ConvGRU cell with Pytorch. This idea has been proposed in this paper: Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting

Experiments with ConvLSTM on MovingMNIST

Encoder-decoder structure. Takes in a sequence of 10 movingMNIST fames and attempts to output the remaining frames.

Instructions

Requires Pytorch v1.1 or later (and GPUs)

Clone repository

git clone https://github.com/jhhuang96/ConvLSTM-PyTorch.git

To run endoder-decoder network for prediction moving-mnist:

python main.py

Moving Mnist Generator

The script data/mm.py is the script to generate customized Moving Mnist based on MNIST.

MovingMNIST(is_train=True,
            root='data/',
            n_frames_input=args.frames_input,
            n_frames_output=args.frames_output,
            num_objects=[3])
  • is_train: If True, use script to generate data. If False, directly use Moving Mnist data downloaded from http://www.cs.toronto.edu/~nitish/unsupervised_video/
  • root: The path of MNIST data
  • n_frames_input: Number of input frames (int)
  • n_frames_output: Number of output frames (int)
  • num_objects: Number of digits in a frame (List) . [3] means there are 3 digits in each frame

Result

Result

  • The first line is the real data for the first 10 frames
  • The second line is prediction of the model for the last 10 frames

Citation

@inproceedings{xingjian2015convolutional,
  title={Convolutional LSTM network: A machine learning approach for precipitation nowcasting},
  author={Xingjian, SHI and Chen, Zhourong and Wang, Hao and Yeung, Dit-Yan and Wong, Wai-Kin and Woo, Wang-chun},
  booktitle={Advances in neural information processing systems},
  pages={802--810},
  year={2015}
}
@inproceedings{xingjian2017deep,
    title={Deep learning for precipitation nowcasting: a benchmark and a new model},
    author={Shi, Xingjian and Gao, Zhihan and Lausen, Leonard and Wang, Hao and Yeung, Dit-Yan and Wong, Wai-kin and Woo, Wang-chun},
    booktitle={Advances in Neural Information Processing Systems},
    year={2017}
}

convlstm-pytorch's People

Contributors

jhhuang96 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  avatar  avatar

convlstm-pytorch's Issues

Blurry results

Hello, awesome repo.
I have been playing with various convlstm/gru implementation as we don't have an official one in Pytorch.
I am having trouble getting good images as output. I am unable to get sharp images as the ones you showed.
I modified your model to output 2 classes per image, to produce binary values and train with CrossEntropy (I just put to 1 all pixels greater that 0.5, and zero the others).
I am also currently trying this UpsampleBlock from fastai2 Unet for the decoder with good results:

class UpsampleBlock(Module):
    "A quasi-UNet block, using `PixelShuffle_ICNR upsampling`."
    @delegates(ConvLayer.__init__)
    def __init__(self, in_ch, out_ch, final_div=True, blur=False, act_cls=defaults.activation,
                 self_attention=False, init=nn.init.kaiming_normal_, norm_type=None, **kwargs):
        self.shuf = PixelShuffle_ICNR(in_ch, in_ch//2, blur=blur, act_cls=act_cls, norm_type=norm_type)
        ni = in_ch//2
        nf = out_ch
        self.conv1 = ConvLayer(ni, nf, act_cls=act_cls, norm_type=norm_type, **kwargs)
        self.conv2 = ConvLayer(nf, nf, act_cls=act_cls, norm_type=norm_type,
                               xtra=SelfAttention(nf) if self_attention else None, **kwargs)
        self.relu = act_cls()
        apply_init(nn.Sequential(self.conv1, self.conv2), init)

    def forward(self, up_in):
        up_out = self.shuf(up_in)
        return self.conv2(self.conv1(up_out))

LOSS收敛问题

你好,请问是使用默认的batch_size=4吗,为什么跑了好久他的loss都不收敛,都是在0.010-0.019左右波动,大概需要跑多少个epoch才会收敛呢?

期待回复!!!

关于上下采样的部分

convlstm好像没有按照论文那种**,而是直接套用trajgru的encoder-forcaster结构么?我看预测器状态都是从高维传递

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.