Realtime Data augmentation in Lasagne

房东的猫 提交于 2019-12-04 16:13:39

You can use Keras framework for real time data augmentation for CNN training. Here is the example code for CIFAR10 dataset from github. You can also change it to adapt your needs or copy source code and add to lasagne project but I have not tried importing to lasagne before. Basic idea behind this is randomly augmenting data in every batch. If you have for loop of batches that fits network, you can call your augmentation function before sending data to network.

Yes you can do real-time data augmentation in Lasagne. The simplest way is using the GaussianNoiseLayer. Simply insert it after your input layer. If Gaussian noise is not what you need, then at least you have GaussianNoiseLayer as an example for how to implement your own.

Note how the deterministic parameter is used in Lasagne. It is off by default, and so during training the noise is added. During testing you set deterministic=True and the augmentation is simply avoided.

Yes, the Facial Keypoints Recognition tutorial that you mention does use real-time (on the fly) augmentation to flip the input images (and target coordinates) at random.

The nolearn-utils library has a ton of examples of iterators that do several types of augmentation. E.g. AffineTransformBatchIteratorMixin does random affine transforms on the fly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!