Epoch,Iterations and Batch_Size

最近复现论文的时候遇到的。原文说要把Alexnet训练800k个iteration,然而这个iteration具体是啥呢?网上下载下来的代码一般只给你指定一个args.Epoch,那么Iteration和batchsize和epoch数又有什么关系呢?
拿ImageNet的训练举例,Imagenet包含120w左右的训练集。一个epoch就是指模型在所有120w个数据上经过一次训练的过程。但实际上考虑到内存的限制,必须把120w的训练集分成小batch进行训练。一般地,设置batchsize为256,那么显然,训练经过大概5000个batch相当于一个epoch。这个5000就是一个epoch所需要的iteration次数。
对于论文所说的256batchsize下的800k个iteration,就是差不多 800 k 5 k \frac{800k}{5k} 5k800k次,大概160epoch。

We illustrate this issue by an example of ImageNet, which consist of 1200k images for training. A epoch denotes the procedure for the model to process all the images in dataset for one time. However, considering the computing memory, we must exploit the batchsize SGD to train. Therefore, when we set the batchsize to be 256,then it is obvious that it will cost approximately 5000 times for all the batches to go through the whole database for one epoch. This 5000 is the iterations number for one epoch.
So as for the original problems which mentioned 800k iterations with batchsize being 256, the epoch will be about 800k/5k times, i.e. 160 epochs. Problem solved.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值