日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

MxNet教程:使用一台机器训练1400万张图片

發布時間:2023/12/31 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MxNet教程:使用一台机器训练1400万张图片 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

官網鏈接:http://mxnet.readthedocs.io/en/latest/tutorials/imagenet_full.html

Training Deep Net on 14 Million Images by Using A Single Machine

This note describes how to train a neural network on Full ImageNet Dataset [1] with 14,197,087 images in 21,841 classes.We achieved a state-of-art model by using 4 GeForce GTX 980 cards on a single machine in 8.5 days.

There are several technical challenges in this problem.

  • How to pack and store the massive data.
  • How to minimize the memory consumption of the network, so we can use net with more capacity than those used for ImageNet 1K
  • How to train the model fast.
  • We also released our pre-trained model for this full ImageNet dataset.

    此方法描述了如何是使用一臺機器 -4張GTX980互聯在一臺機器上,訓練8.5天訓練完整個ImageNet 數據集,此數據集有14,197,087張圖片。

    ???? ?? 1.存儲海量數據的方法。

    ??????? 2.最小化內存的計算代價。

    ??????? 3.如何快速訓練模型。


    Data Preprocessing

    The raw full ImageNet dataset is more than 1TB. Before training the network, we need to shuffle these images then load batch of images to feed the neural network. Before we describe how we solve it, let’s do some calculation first:

    原始的ImageNet數據超過1TB,在訓練之前,必須分批的形式載入神經網絡。在描述之前,先進行一些計算。

    假設的硬件速度:

    ?????????????????????????????????????????????? 4K 隨機讀取????????????????????????????????????? 順序存取

    ????????? 西數 黑盤:??? 0.43MB /s (110 IOPS)??????????????????????????? 170MB/s

    ????????? 三星 850PRO ssd?????? 40MB/s???????????????????????????????????????????? 550MB/s


    Assume we have two good storage device [2]:

    | Device | 4K Random Seek | Sequential Seek | | ------------------------- | --------------------- | --------------- | | WD Black (HDD) | 0.43 MB /s (110 IOPS) | 170 MB/s | | Samsung 850 PRO (SSD) | 40 MB/s (10,000 IOPS) | 550 MB/s |


    A very naive approach is loading from a list by random seeking. If use this approach, we will spend 677 hours with HDD or 6.7 hours with SSD respectively. This is only about read. Although SSD looks not bad, but 1TB SSD is not affordable for everyone.

    But we notice sequential seek is much faster than random seek. Also, loading batch by batch is a sequential action. Can we make a change? The answer is we can’t do sequential seek directly. We need random shuffle the training data first, then pack them into a sequential binary package.

    This is the normal solution used by most deep learning packages. However, unlike ImageNet 1K dataset, where wecannot? store the images in raw pixels format. Because otherwise we will need more than 1TB space. Instead, we need to pack the images in compressed format.

    一個普通的方法是 從一個列中隨機存取,若使用這種途徑,我們使用HDD 將使用667小時,或者SSD6.7小時。SSD缺點就是有點貴。

    序列化存取比隨機存取快,但有時隨機存取是必須的。

    另外,我們需要一種壓縮的格式進行存取數據。


    The key ingredients are

    • Store the images in jpeg format, and pack them into binary record.
    • Split the list, and pack several record files, instead of one file.
      • This allows us to pack the images in distributed fashion, because we will be eventually bounded by the IO cost during packing.
      • We need to make the package being able to read from several record files, which is not too hard.This will allow us to store the entire imagenet dataset in around 250G space.

    After packing, together with threaded buffer iterator, we can simply achieve an IO speed of around 3,000 images/sec on a normal HDD.

    主要過程是:

    ?????? 使用jpeg格式存儲數據,并進行二次壓縮;

    ?????? 將列表拆分;減輕 I/O 代價;

    ?????? 打包存儲可以 存儲整個 ImageNet的數據集到250GB的空間里。

    打包之后,我們可以多線程存取達到 3000張/秒 圖像。


    Training the model.訓練模型

    Now we have data. We need to consider which network structure to use. We use Inception-BN [3] style model, compared to other models such as VGG, it has fewer parameters, less parameters simplified sync problem. Considering our problem is much more challenging than 1k classes problem, we add suitable capacity into original Inception-BN structure, by increasing the size of filter by factor of 1.5 in bottom layers of original Inception-BN network.This however, creates a challenge for GPU memory. As GTX980 only have 4G of GPU RAM. We really need to minimize the memory consumption to fit larger batch-size into the training. To solve this problem we use the techniques such as node memory reuse, and inplace optimization, which reduces the memory consumption by half, more details can be found in memory optimization note

    收集數據完畢,我們需要確定使用哪種網絡結構。 在此,我們使用? Inception-BN [3] 形式的模型。相對于其他模型,它有更少的參數,因此有更少的參數同步問題。.............考慮到GTX980只有4G顯存,需要分批訓練。 我們使用? node memory reuse節點內存救援 的形式,減少一半的內存耗費,詳情請見memory optimization note。


    Finally, we cannot train the model using a single GPU because this is a really large net, and a lot of data. We use data parallelism on four GPUs to train this model, which involves smart synchronization of parameters between different GPUs, and overlap the communication and computation. A runtime denpdency engine is used to simplify this task, allowing us to run the training at around 170 images/sec.

    我們使用多個GPU進行訓練,緩解參數過多和數據過多的問題,使用數據并行的方式訓練模型,設計到少量的 參數同步。 一個? runtime denpdency engine 用于使這種工作簡單化, 可以達到 170張 圖片/每秒 的訓練速度。


    Here is a learning curve of the training process:


    訓練-學習曲線

    Evaluate the Performance

    Train Top-1 Accuracy over 21,841 classes: 37.19%

    訓練表現:

    ???? 在21841個類上達到 37.19% 的Top1 分辨率

    There is no official validation set over 21,841 classes, so we are using ILVRC2012 validation set to check the performance. Here is the result:

    | Accuracy | Over 1,000 classes | Over 21,841 classes | | -------- | ------------------ | ------------------- | | Top-1 | 68.3% | 41.9% | | Top-5 | 89.0% | 69.6% | | Top=20 | 96.0% | 83.6% |

    As we can see we get quite reasonable result after 9 iterations. Notably much less number of iterations is needed to achieve a stable performance, mainly due to we are facing a larger dataset.

    We should note that this result is by no means optimal, as we did not carefully pick the parameters and the experiment cycle is longer than the 1k dataset. We think there is definite space for improvement, and you are welcomed to try it out by yourself!


    The Code and Model.代碼和模型

    The code and step guide is publically available at https://github.com/dmlc/mxnet/tree/master/example/image-classification

    We also release a pretrained model under https://github.com/dmlc/mxnet-model-gallery/tree/master/imagenet-21k-inception


    How to Use The Model.使用模型

    We should point out it 21k classes is much more challenging than 1k. Directly use the raw prediction is not a reasonable way.

    Look at this picture which I took in Mount Rainier this summer:


    We can figure out there is a mountain, valley, tree and bridge. And the prediction probability is :

    對于 山巒、峽谷、樹木、橋梁的預測準確度:

    We notice there are several peaks. Let’s print out the label text in among 21k classes and ImageNet 1k classes:

    | Rank | Over 1,000 classes | Over 21,841 classes | | ----- | --------------------------- | -------------------------- | | Top-1 | n09468604 valley | n11620673 Fir | | Top-2 | n09332890 lakeside | n11624531 Spruce | | Top-3 | n04366367 suspension bridge | n11621281 Amabilis fir | | Top-4 | n09193705 alp | n11628456 Douglas fir | | Top-5 | n09428293 seashore | n11627908 Mountain hemlock |

    There is no doubt that directly use probability over 21k classes loss diversity of prediction. If you carefully choose a subset by using WordNet hierarchy relation, I am sure you will find more interesting results.

    Note

    [1] Deng, Jia, et al. “Imagenet: A large-scale hierarchical image database.” Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on. IEEE, 2009.

    [2] HDD/SSD data is from public website may not be accurate.

    [3] Ioffe, Sergey, and Christian Szegedy. “Batch normalization: Accelerating deep network training by reducing internal covariate shift.”arXiv preprint arXiv:1502.03167 (2015).


    總結

    以上是生活随笔為你收集整理的MxNet教程:使用一台机器训练1400万张图片的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 亚洲一区二区免费看 | 精品国产乱码久久久久久影片 | 国产伦精品一区二区三区千人斩 | 99爱爱视频 | 久久久久成人精品无码 | 日本熟妇毛茸茸丰满 | 男人天堂网av | 久久在线视频精品 | 99在线播放| 无码 制服 丝袜 国产 另类 | 白丝av| 男人的天堂成人 | 强行挺进白丝老师里呻吟 | 草莓视频一区二区三区 | 99欧美精品 | 伊人久久大香线蕉av一区 | 免费激情网站 | 国产尻逼| 超碰蜜桃 | 成人免费黄色大片v266 | 一区二区三区视频免费观看 | 国产黄频在线观看 | 色综合99| 手机亚洲第一页 | 欧美在线播放 | 九九小视频 | 国产精品交换 | 日韩欧美三级在线 | 视色视频在线观看 | 少妇人妻一区 | 在线观看色网 | 欧美精品区 | 国模私拍一区二区三区 | 就是喜欢被他干 | 国产精品一区二区在线播放 | 欧美极品少妇xxxxⅹ裸体艺术 | 免费看美女隐私网站 | 亚洲天堂男人 | 亚洲午夜片 | 国产一级性生活片 | 女生鸡鸡软件 | 亚洲日本一区二区 | 天天夜夜爽| 精品国产二区三区 | 欧美一级片在线视频 | 国产麻豆免费观看 | 亚洲成a人片77777kkkk | 手机在线看黄色 | 精品福利一区 | 丁香久久综合 | 99r精品视频 | 久久特黄视频 | 天天射天天草 | 18禁网站免费无遮挡无码中文 | 相亲对象是问题学生在线观看 | 成人午夜在线播放 | 91在线精品观看 | 国产亚洲女人久久久久毛片 | 综合久久影院 | 少妇第一次交换又紧又爽 | 欧美黄色性 | 欧美一区不卡 | 国产二区一区 | 天堂中文字幕在线 | 天天操天天操天天操天天操 | 午夜aa | 青青在线观看视频 | 日韩一区二区三区在线免费观看 | 欧美性受xxxx黑人xyx性 | 伊人色婷婷 | 国产最新自拍视频 | 色老头影视 | 日日骚一区二区 | 熟妇人妻中文字幕无码老熟妇 | 国产在视频线精品视频 | 色综合啪啪 | 日韩精品短片 | 亚洲97视频| 国产精品丝袜黑色高跟鞋 | 日本久久一级片 | 国产这里只有精品 | 午夜在线观看影院 | 国产成人无码www免费视频播放 | 真人一毛片 | 国产偷人视频 | 成人在线播放视频 | 一区二区三区四区高清视频 | 亚洲精品美女在线观看 | 三级精品在线观看 | 性欧美丰满熟妇xxxx性仙踪林 | 伊人草草 | 欧美一级在线视频 | 亚洲久久视频 | 欧美国产日本在线 | 超碰香蕉 | 午夜精品一区二区三区免费视频 | 伊人福利视频 | 国产精品久久久久久 | 欧美精品在线免费观看 |