chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"<h1>Capsule Networks</h1>\n<p>This is a <a href=\"https://pytorch.org\">PyTorch</a> implementation/tutorial of <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n<p>Capsule network is a neural network architecture that embeds features as capsules and routes them with a voting mechanism to next layer of capsules.</p>\n<p>Unlike in other implementations of models, we've included a sample, because it is difficult to understand some concepts with just the modules. <a href=\"mnist.html\">This is the annotated code for a model that uses capsules to classify MNIST dataset</a></p>\n<p>This file holds the implementations of the core modules of Capsule Networks.</p>\n<p>I used <a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">jindongwang/Pytorch-CapsuleNet</a> to clarify some confusions I had with the paper.</p>\n<p>Here's a notebook for training a Capsule Network on MNIST dataset.</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a></p>\n": "<h1>\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af</h1>\n<p><a href=\"https://arxiv.org/abs/1710.09829\">\u3053\u308c\u306f\u3001<a href=\"https://pytorch.org\">\u30ab\u30d7\u30bb\u30eb\u9593\u306e\u52d5\u7684\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306ePyTorch\u5b9f\u88c5/\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u3059</a>\u3002</a></p>\n<p>\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306f\u3001\u30d5\u30a3\u30fc\u30c1\u30e3\u3092\u30ab\u30d7\u30bb\u30eb\u3068\u3057\u3066\u57cb\u3081\u8fbc\u307f\u3001\u6295\u7968\u30e1\u30ab\u30cb\u30ba\u30e0\u3092\u4f7f\u7528\u3057\u3066\u6b21\u306e\u30ab\u30d7\u30bb\u30eb\u5c64\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3059\u308b\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3067\u3059\u3002</p>\n<p>\u4ed6\u306e\u30e2\u30c7\u30eb\u306e\u5b9f\u88c5\u3068\u306f\u7570\u306a\u308a\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u3060\u3051\u3067\u306f\u4e00\u90e8\u306e\u6982\u5ff5\u3092\u7406\u89e3\u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u305f\u3081\u3001\u30b5\u30f3\u30d7\u30eb\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002</p><a href=\"mnist.html\">\u3053\u308c\u306f\u3001\u30ab\u30d7\u30bb\u30eb\u3092\u4f7f\u7528\u3057\u3066 MNIST \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u5206\u985e\u3059\u308b\u30e2\u30c7\u30eb\u306e\u6ce8\u91c8\u4ed8\u304d\u30b3\u30fc\u30c9\u3067\u3059\u3002</a>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001Capsule Networks \u306e\u30b3\u30a2\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5b9f\u88c5\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059\u3002</p>\n<p><a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">Jindongwang/Pytorch-Capsulenet\u3092\u4f7f\u3063\u3066</a>\u3001\u8ad6\u6587\u306b\u95a2\u3059\u308b\u6df7\u4e71\u3092\u89e3\u6d88\u3057\u307e\u3057\u305f\u3002</p>\n<p>\u3053\u308c\u306f\u3001MNIST\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3059\u308b\u305f\u3081\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3067\u3059\u3002</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a></p>\n",
|
||||
"<h2>Margin loss for class existence</h2>\n<p>A separate margin loss is used for each output capsule and the total loss is the sum of them. The length of each output capsule is the probability that class is present in the input.</p>\n<p>Loss for each output capsule or class <span translate=no>_^_0_^_</span> is, <span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span> is <span translate=no>_^_3_^_</span> if the class <span translate=no>_^_4_^_</span> is present and <span translate=no>_^_5_^_</span> otherwise. The first component of the loss is <span translate=no>_^_6_^_</span> when the class is not present, and the second component is <span translate=no>_^_7_^_</span> if the class is present. The <span translate=no>_^_8_^_</span> is used to avoid predictions going to extremes. <span translate=no>_^_9_^_</span> is set to be <span translate=no>_^_10_^_</span> and <span translate=no>_^_11_^_</span> to be <span translate=no>_^_12_^_</span> in the paper.</p>\n<p>The <span translate=no>_^_13_^_</span> down-weighting is used to stop the length of all capsules from falling during the initial phase of training.</p>\n": "<h2>\u30af\u30e9\u30b9\u5b58\u5728\u306b\u3088\u308b\u30de\u30fc\u30b8\u30f3\u30ed\u30b9</h2>\n<p>\u51fa\u529b\u30ab\u30d7\u30bb\u30eb\u3054\u3068\u306b\u500b\u5225\u306e\u30de\u30fc\u30b8\u30f3\u30ed\u30b9\u304c\u4f7f\u7528\u3055\u308c\u3001\u5408\u8a08\u640d\u5931\u306f\u305d\u308c\u3089\u306e\u5408\u8a08\u306b\u306a\u308a\u307e\u3059\u3002\u5404\u51fa\u529b\u30ab\u30d7\u30bb\u30eb\u306e\u9577\u3055\u306f\u3001\u5165\u529b\u306b\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3059\u308b\u78ba\u7387\u3067\u3059\u3002</p>\n<p><span translate=no>_^_0_^_</span>\u5404\u51fa\u529b\u30ab\u30d7\u30bb\u30eb\u307e\u305f\u306f\u30af\u30e9\u30b9\u306e\u640d\u5931\u306f\u3001<span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span><span translate=no>_^_3_^_</span>\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u3001<span translate=no>_^_4_^_</span><span translate=no>_^_5_^_</span>\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3067\u3059\u3002<span translate=no>_^_6_^_</span>\u640d\u5931\u306e\u6700\u521d\u306e\u8981\u7d20\u306f\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u3067\u3001<span translate=no>_^_7_^_</span> 2\u756a\u76ee\u306e\u8981\u7d20\u306f\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u3067\u3059\u3002<span translate=no>_^_8_^_</span>\u4e88\u6e2c\u304c\u6975\u7aef\u306b\u306a\u308b\u306e\u3092\u9632\u3050\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<span translate=no>_^_9_^_</span><span translate=no>_^_10_^_</span><span translate=no>_^_11_^_</span><span translate=no>_^_12_^_</span>\u65b0\u805e\u306b\u63b2\u8f09\u3055\u308c\u308b\u4e88\u5b9a\u3067\u3001\u63b2\u8f09\u3055\u308c\u308b\u4e88\u5b9a\u3067\u3059\u3002</p>\n<p><span translate=no>_^_13_^_</span>\u30c0\u30a6\u30f3\u30a6\u30a8\u30a4\u30c8\u306f\u3001\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u306e\u521d\u671f\u6bb5\u968e\u3067\u3059\u3079\u3066\u306e\u30ab\u30d7\u30bb\u30eb\u306e\u9577\u3055\u304c\u843d\u3061\u308b\u306e\u3092\u9632\u3050\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002</p>\n",
|
||||
"<h2>Routing Algorithm</h2>\n<p>This is the routing mechanism described in the paper. You can use multiple routing layers in your models.</p>\n<p>This combines calculating <span translate=no>_^_0_^_</span> for this layer and the routing algorithm described in <em>Procedure 1</em>.</p>\n": "<h2>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0</h2>\n<p>\u3053\u308c\u306f\u3001\u3053\u306e\u30db\u30ef\u30a4\u30c8\u30da\u30fc\u30d1\u30fc\u3067\u8aac\u660e\u3055\u308c\u3066\u3044\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30e1\u30ab\u30cb\u30ba\u30e0\u3067\u3059\u3002\u30e2\u30c7\u30eb\u3067\u306f\u8907\u6570\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30ec\u30a4\u30e4\u30fc\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002</p>\n<p>\u3053\u308c\u306f\u3001<span translate=no>_^_0_^_</span><em>\u3053\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u8a08\u7b97\u3068\u624b\u98061\u3067\u8aac\u660e\u3057\u305f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u3082\u306e\u3067\u3059</em>\u3002</p>\n",
|
||||
"<h2>Squash</h2>\n<p>This is <strong>squashing</strong> function from paper, given by equation <span translate=no>_^_0_^_</span>.</p>\n<p><span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span> normalizes the length of all the capsules, whilst <span translate=no>_^_3_^_</span> shrinks the capsules that have a length smaller than one .</p>\n": "<h2>\u30b9\u30ab\u30c3\u30b7\u30e5</h2>\n<p>\u3053\u308c\u306f\u3001<strong>\u65b9\u7a0b\u5f0f\u3067\u4e0e\u3048\u3089\u308c\u308b\u7d19\u304b\u3089\u306e\u62bc\u3057\u3064\u3076\u3057\u95a2\u6570\u3067\u3059</strong>\u3002<span translate=no>_^_0_^_</span></p>\n<p><span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span>\u3059\u3079\u3066\u306e\u30ab\u30d7\u30bb\u30eb\u306e\u9577\u3055\u3092\u6b63\u898f\u5316\u3057\u3001\u9577\u3055\u304c 1 <span translate=no>_^_3_^_</span> \u3088\u308a\u77ed\u3044\u30ab\u30d7\u30bb\u30eb\u3092\u7e2e\u5c0f\u3057\u307e\u3059\u3002</p>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span> is the number of capsules, and <span translate=no>_^_1_^_</span> is the number of features per capsule from the layer below. <span translate=no>_^_2_^_</span> and <span translate=no>_^_3_^_</span> are the same for this layer.</p>\n<p><span translate=no>_^_4_^_</span> is the number of routing iterations, symbolized by <span translate=no>_^_5_^_</span> in the paper.</p>\n": "<p><span translate=no>_^_0_^_</span>\u306f\u30ab\u30d7\u30bb\u30eb\u306e\u6570\u3067\u3001<span translate=no>_^_1_^_</span>\u306f\u4e0b\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u30ab\u30d7\u30bb\u30eb\u3042\u305f\u308a\u306e\u30d5\u30a3\u30fc\u30c1\u30e3\u6570\u3067\u3059\u3002<span translate=no>_^_2_^_</span><span translate=no>_^_3_^_</span>\u3053\u306e\u30ec\u30a4\u30e4\u30fc\u3067\u3082\u540c\u3058\u3067\u3059\u3002</p>\n<p><span translate=no>_^_4_^_</span>\u306f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u53cd\u5fa9\u56de\u6570\u3067\u3001<span translate=no>_^_5_^_</span>\u8ad6\u6587\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002</p>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span>, <span translate=no>_^_1_^_</span> are the squashed output capsules. This has shape <span translate=no>_^_2_^_</span>; that is, there is a capsule for each label.</p>\n<p><span translate=no>_^_3_^_</span> are the labels, and has shape <span translate=no>_^_4_^_</span>.</p>\n": "<p><span translate=no>_^_0_^_</span>\u3001<span translate=no>_^_1_^_</span>\u306f\u62bc\u3057\u3064\u3076\u3055\u308c\u305f\u51fa\u529b\u30ab\u30d7\u30bb\u30eb\u3067\u3059\u3002\u3053\u308c\u306b\u306f\u5f62\u304c\u3042\u308a\u307e\u3059<span translate=no>_^_2_^_</span>\u3002\u3064\u307e\u308a\u3001\u30e9\u30d9\u30eb\u3054\u3068\u306b\u30ab\u30d7\u30bb\u30eb\u304c\u3042\u308a\u307e\u3059\u3002</p>\n<p><span translate=no>_^_3_^_</span>\u306f\u30e9\u30d9\u30eb\u3067\u3001\u5f62\u3092\u3057\u3066\u3044\u307e\u3059<span translate=no>_^_4_^_</span>\u3002</p>\n",
|
||||
"<p> The shape of <span translate=no>_^_0_^_</span> is <span translate=no>_^_1_^_</span>. These are the capsules from the lower layer.</p>\n": "<p><span translate=no>_^_0_^_</span>\u306e\u5f62\u306f<span translate=no>_^_1_^_</span>.\u3053\u308c\u3089\u306f\u4e0b\u5c64\u306e\u30ab\u30d7\u30bb\u30eb\u3067\u3059</p>\u3002\n",
|
||||
"<p> The shape of <span translate=no>_^_0_^_</span> is <span translate=no>_^_1_^_</span></p>\n": "<p><span translate=no>_^_0_^_</span>\u306e\u5f62\u306f <span translate=no>_^_1_^_</span></p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> </p>\n": "<p><span translate=no>_^_0_^_</span></p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> <span translate=no>_^_1_^_</span> has shape <span translate=no>_^_2_^_</span>. We have parallelized the computation of <span translate=no>_^_3_^_</span> for for all <span translate=no>_^_4_^_</span>. </p>\n": "<p><span translate=no>_^_0_^_</span><span translate=no>_^_1_^_</span>\u5f62\u304c\u3042\u308a\u307e\u3059<span translate=no>_^_2_^_</span>\u3002<span translate=no>_^_3_^_</span>for \u306e\u8a08\u7b97\u3092\u4e26\u5217\u5316\u3057\u307e\u3057\u305f</p>\u3002<span translate=no>_^_4_^_</span>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> <span translate=no>_^_1_^_</span> is one-hot encoded labels of shape <span translate=no>_^_2_^_</span> </p>\n": "<p><span translate=no>_^_0_^_</span><span translate=no>_^_1_^_</span>\u30ef\u30f3\u30db\u30c3\u30c8\u30a8\u30f3\u30b3\u30fc\u30c9\u3055\u308c\u305f\u5f62\u72b6\u306e\u30e9\u30d9\u30eb\u3067\u3059 <span translate=no>_^_2_^_</span></p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> Here <span translate=no>_^_1_^_</span> is used to index capsules in this layer, whilst <span translate=no>_^_2_^_</span> is used to index capsules in the layer below (previous). </p>\n": "<p><span translate=no>_^_0_^_</span>\u3053\u3053\u3067\u306f<span translate=no>_^_1_^_</span>\u3001\u3053\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u30ab\u30d7\u30bb\u30eb\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210\u3057\u3001\u4e0b\u306e\u30ec\u30a4\u30e4\u30fc\uff08\u524d\u306e\u30ec\u30a4\u30e4\u30fc\uff09\u306e\u30ab\u30d7\u30bb\u30eb\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<span translate=no>_^_2_^_</span></p>\n",
|
||||
"<p>Initial logits <span translate=no>_^_0_^_</span> are the log prior probabilities that capsule <span translate=no>_^_1_^_</span> should be coupled with <span translate=no>_^_2_^_</span>. We initialize these at zero </p>\n": "<p><span translate=no>_^_0_^_</span>\u521d\u671f\u30ed\u30b8\u30c3\u30c8\u306f\u3001<span translate=no>_^_1_^_</span>\u30ab\u30d7\u30bb\u30eb\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3079\u304d\u5bfe\u6570\u4e8b\u524d\u78ba\u7387\u3067\u3059\u3002<span translate=no>_^_2_^_</span>\u3053\u308c\u3089\u306f\u30bc\u30ed\u3067\u521d\u671f\u5316\u3057\u307e\u3059</p>\u3002\n",
|
||||
"<p>Iterate </p>\n": "<p>\u7e70\u308a\u8fd4\u3057</p>\n",
|
||||
"<p>This is the weight matrix <span translate=no>_^_0_^_</span>. It maps each capsule in the lower layer to each capsule in this layer </p>\n": "<p><span translate=no>_^_0_^_</span>\u3053\u308c\u306f\u30a6\u30a7\u30a4\u30c8\u30de\u30c8\u30ea\u30c3\u30af\u30b9\u3067\u3059\u3002\u4e0b\u4f4d\u30ec\u30a4\u30e4\u30fc\u306e\u5404\u30ab\u30d7\u30bb\u30eb\u3092\u3053\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u5404\u30ab\u30d7\u30bb\u30eb\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3057\u307e\u3059</p>\u3002\n",
|
||||
"<p>We add an epsilon when calculating <span translate=no>_^_0_^_</span> to make sure it doesn't become zero. If this becomes zero it starts giving out <span translate=no>_^_1_^_</span> values and training fails. <span translate=no>_^_2_^_</span> </p>\n": "<p>\u30bc\u30ed\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u3001<span translate=no>_^_0_^_</span>\u8a08\u7b97\u6642\u306b\u30a4\u30d7\u30b7\u30ed\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u308c\u304c\u30bc\u30ed\u306b\u306a\u308b\u3068\u3001<span translate=no>_^_1_^_</span>\u5024\u304c\u4e0e\u3048\u3089\u308c\u59cb\u3081\u3001\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u306f\u5931\u6557\u3057\u307e\u3059\u3002<span translate=no>_^_2_^_</span></p>\n",
|
||||
"<p>routing softmax <span translate=no>_^_0_^_</span> </p>\n": "<p>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30bd\u30d5\u30c8\u30de\u30c3\u30af\u30b9 <span translate=no>_^_0_^_</span></p>\n",
|
||||
"Capsule Networks": "\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af",
|
||||
"PyTorch implementation and tutorial of Capsule Networks. Capsule network is a neural network architecture that embeds features as capsules and routes them with a voting mechanism to next layer of capsules.": "PyTorch\u306e\u5b9f\u88c5\u3068\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3002\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306f\u3001\u30d5\u30a3\u30fc\u30c1\u30e3\u3092\u30ab\u30d7\u30bb\u30eb\u3068\u3057\u3066\u57cb\u3081\u8fbc\u307f\u3001\u6295\u7968\u30e1\u30ab\u30cb\u30ba\u30e0\u3092\u4f7f\u7528\u3057\u3066\u6b21\u306e\u30ab\u30d7\u30bb\u30eb\u5c64\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3059\u308b\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3067\u3059\u3002"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"<h1>Capsule Networks</h1>\n<p>This is a <a href=\"https://pytorch.org\">PyTorch</a> implementation/tutorial of <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n<p>Capsule network is a neural network architecture that embeds features as capsules and routes them with a voting mechanism to next layer of capsules.</p>\n<p>Unlike in other implementations of models, we've included a sample, because it is difficult to understand some concepts with just the modules. <a href=\"mnist.html\">This is the annotated code for a model that uses capsules to classify MNIST dataset</a></p>\n<p>This file holds the implementations of the core modules of Capsule Networks.</p>\n<p>I used <a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">jindongwang/Pytorch-CapsuleNet</a> to clarify some confusions I had with the paper.</p>\n<p>Here's a notebook for training a Capsule Network on MNIST dataset.</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a></p>\n": "<h1>\u80f6\u56ca\u7f51\u7edc</h1>\n<p>\u8fd9\u662f<a href=\"https://arxiv.org/abs/1710.09829\">\u80f6\u56ca\u95f4\u52a8\u6001\u8def\u7531</a>\u7684 <a href=\"https://pytorch.org\">PyTorch</a> \u5b9e\u73b0/\u6559\u7a0b\u3002</p>\n<p>Capsule \u7f51\u7edc\u662f\u4e00\u79cd\u795e\u7ecf\u7f51\u7edc\u67b6\u6784\uff0c\u5b83\u4ee5\u80f6\u56ca\u7684\u5f62\u5f0f\u5d4c\u5165\u7279\u5f81\uff0c\u5e76\u901a\u8fc7\u6295\u7968\u673a\u5236\u5c06\u5b83\u4eec\u8def\u7531\u5230\u4e0b\u4e00\u5c42\u80f6\u56ca\u3002</p>\n<p>\u4e0e\u5176\u4ed6\u6a21\u578b\u5b9e\u73b0\u4e0d\u540c\uff0c\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u4e2a\u793a\u4f8b\uff0c\u56e0\u4e3a\u4ec5\u4f7f\u7528\u6a21\u5757\u5f88\u96be\u7406\u89e3\u67d0\u4e9b\u6982\u5ff5\u3002<a href=\"mnist.html\">\u8fd9\u662f\u4f7f\u7528\u80f6\u56ca\u5bf9 MNIST \u6570\u636e\u96c6\u8fdb\u884c\u5206\u7c7b\u7684\u6a21\u578b\u7684\u5e26\u6ce8\u91ca\u7684\u4ee3\u7801</a></p>\n<p>\u8be5\u6587\u4ef6\u5305\u542b\u4e86 Capsule Networks \u6838\u5fc3\u6a21\u5757\u7684\u5b9e\u73b0\u3002</p>\n<p>\u6211\u7528 <a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">jindongwang/pytorch-CapsuleNet</a> \u6765\u6f84\u6e05\u6211\u5bf9\u8fd9\u7bc7\u8bba\u6587\u7684\u4e00\u4e9b\u56f0\u60d1\u3002</p>\n<p>\u8fd9\u662f\u4e00\u672c\u5728 MNIST \u6570\u636e\u96c6\u4e0a\u8bad\u7ec3 Capsule \u7f51\u7edc\u7684\u7b14\u8bb0\u672c\u3002</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a></p>\n",
|
||||
"<h2>Margin loss for class existence</h2>\n<p>A separate margin loss is used for each output capsule and the total loss is the sum of them. The length of each output capsule is the probability that class is present in the input.</p>\n<p>Loss for each output capsule or class <span translate=no>_^_0_^_</span> is, <span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span> is <span translate=no>_^_3_^_</span> if the class <span translate=no>_^_4_^_</span> is present and <span translate=no>_^_5_^_</span> otherwise. The first component of the loss is <span translate=no>_^_6_^_</span> when the class is not present, and the second component is <span translate=no>_^_7_^_</span> if the class is present. The <span translate=no>_^_8_^_</span> is used to avoid predictions going to extremes. <span translate=no>_^_9_^_</span> is set to be <span translate=no>_^_10_^_</span> and <span translate=no>_^_11_^_</span> to be <span translate=no>_^_12_^_</span> in the paper.</p>\n<p>The <span translate=no>_^_13_^_</span> down-weighting is used to stop the length of all capsules from falling during the initial phase of training.</p>\n": "<h2>\u9636\u7ea7\u5b58\u5728\u7684\u4fdd\u8bc1\u91d1\u635f\u5931</h2>\n<p>\u6bcf\u4e2a\u8f93\u51fa\u80f6\u56ca\u4f7f\u7528\u5355\u72ec\u7684\u4fdd\u8bc1\u91d1\u635f\u5931\uff0c\u603b\u4e8f\u635f\u662f\u5b83\u4eec\u7684\u603b\u548c\u3002\u6bcf\u4e2a\u8f93\u51fa\u80f6\u56ca\u7684\u957f\u5ea6\u662f\u8f93\u5165\u4e2d\u5b58\u5728\u7c7b\u7684\u6982\u7387\u3002</p>\n<p>\u6bcf\u4e2a\u8f93\u51fa\u80f6\u56ca\u6216\u7c7b\u7684\u635f\u5931<span translate=no>_^_0_^_</span>\u4e3a\uff0c<span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span><span translate=no>_^_4_^_</span>\u662f\u7c7b<span translate=no>_^_3_^_</span>\u662f\u5426\u5b58\u5728\uff0c<span translate=no>_^_5_^_</span>\u5426\u5219\u3002\u635f\u5931\u7684\u7b2c\u4e00\u4e2a\u7ec4\u6210\u90e8\u5206\u662f<span translate=no>_^_6_^_</span>\u5f53\u7c7b\u4e0d\u5b58\u5728\u65f6\uff0c\u7b2c\u4e8c\u4e2a\u7ec4\u6210\u90e8\u5206\u662f\u7c7b<span translate=no>_^_7_^_</span>\u662f\u5426\u5b58\u5728\u3002<span translate=no>_^_8_^_</span>\u7528\u4e8e\u907f\u514d\u9884\u6d4b\u8d70\u5411\u6781\u7aef\u3002<span translate=no>_^_9_^_</span>\u88ab\u8bbe\u7f6e<span translate=no>_^_11_^_</span>\u4e3a<span translate=no>_^_10_^_</span>\u548c\u5c06\u5728<span translate=no>_^_12_^_</span>\u62a5\u7eb8\u4e0a\u3002</p>\n<p>\u5728\u8bad\u7ec3<span translate=no>_^_13_^_</span>\u7684\u521d\u59cb\u9636\u6bb5\uff0c\u51cf\u91cd\u7528\u4e8e\u9632\u6b62\u6240\u6709\u80f6\u56ca\u7684\u957f\u5ea6\u6389\u843d\u3002</p>\n",
|
||||
"<h2>Routing Algorithm</h2>\n<p>This is the routing mechanism described in the paper. You can use multiple routing layers in your models.</p>\n<p>This combines calculating <span translate=no>_^_0_^_</span> for this layer and the routing algorithm described in <em>Procedure 1</em>.</p>\n": "<h2>\u8def\u7531\u7b97\u6cd5</h2>\n<p>\u8fd9\u662f\u767d\u76ae\u4e66\u4e2d\u63cf\u8ff0\u7684\u8def\u7531\u673a\u5236\u3002\u53ef\u4ee5\u5728\u6a21\u578b\u4e2d\u4f7f\u7528\u591a\u4e2a\u5e03\u7ebf\u5c42\u3002</p>\n<p>\u8fd9\u7ed3\u5408\u4e86\u6b64\u5c42<span translate=no>_^_0_^_</span>\u7684\u8ba1\u7b97\u548c<em>\u8fc7\u7a0b 1</em> \u4e2d\u63cf\u8ff0\u7684\u8def\u7531\u7b97\u6cd5\u3002</p>\n",
|
||||
"<h2>Squash</h2>\n<p>This is <strong>squashing</strong> function from paper, given by equation <span translate=no>_^_0_^_</span>.</p>\n<p><span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span> normalizes the length of all the capsules, whilst <span translate=no>_^_3_^_</span> shrinks the capsules that have a length smaller than one .</p>\n": "<h2>\u58c1\u7403</h2>\n<p>\u8fd9\u662f\u6765\u81ea\u7eb8\u5f20\u7684<strong>\u6324\u538b</strong>\u51fd\u6570\uff0c\u7531\u65b9\u7a0b\u7ed9\u51fa<span translate=no>_^_0_^_</span>\u3002</p>\n<p><span translate=no>_^_1_^_</span></p>\n<p><span translate=no>_^_2_^_</span>\u6807\u51c6\u5316\u6240\u6709\u80f6\u56ca\u7684\u957f\u5ea6\uff0c\u540c\u65f6<span translate=no>_^_3_^_</span>\u7f29\u5c0f\u957f\u5ea6\u5c0f\u4e8e\u4e00\u4e2a\u7684\u80f6\u56ca\u3002</p>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span> is the number of capsules, and <span translate=no>_^_1_^_</span> is the number of features per capsule from the layer below. <span translate=no>_^_2_^_</span> and <span translate=no>_^_3_^_</span> are the same for this layer.</p>\n<p><span translate=no>_^_4_^_</span> is the number of routing iterations, symbolized by <span translate=no>_^_5_^_</span> in the paper.</p>\n": "<p><span translate=no>_^_0_^_</span>\u662f\u80f6\u56ca\u7684\u6570\u91cf\uff0c<span translate=no>_^_1_^_</span>\u662f\u4e0b\u65b9\u56fe\u5c42\u4e2d\u6bcf\u4e2a\u80f6\u56ca\u7684\u7279\u5f81\u6570\u3002<span translate=no>_^_2_^_</span>\u5bf9\u4e8e\u8fd9\u4e2a\u5c42\u6765\u8bf4<span translate=no>_^_3_^_</span>\u662f\u76f8\u540c\u7684\u3002</p>\n<p><span translate=no>_^_4_^_</span>\u662f\u8def\u7531\u8fed\u4ee3\u6b21\u6570\uff0c\u5728\u8bba\u6587<span translate=no>_^_5_^_</span>\u4e2d\u7528\u7b26\u53f7\u8868\u793a\u3002</p>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span>, <span translate=no>_^_1_^_</span> are the squashed output capsules. This has shape <span translate=no>_^_2_^_</span>; that is, there is a capsule for each label.</p>\n<p><span translate=no>_^_3_^_</span> are the labels, and has shape <span translate=no>_^_4_^_</span>.</p>\n": "<p><span translate=no>_^_0_^_</span>\uff0c<span translate=no>_^_1_^_</span>\u662f\u538b\u6241\u7684\u8f93\u51fa\u80f6\u56ca\u3002\u5b83\u6709\u5f62\u72b6<span translate=no>_^_2_^_</span>\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u6bcf\u4e2a\u6807\u7b7e\u90fd\u6709\u4e00\u4e2a\u80f6\u56ca\u3002</p>\n<p><span translate=no>_^_3_^_</span>\u662f\u6807\u7b7e\uff0c\u6709\u5f62\u72b6<span translate=no>_^_4_^_</span>\u3002</p>\n",
|
||||
"<p> The shape of <span translate=no>_^_0_^_</span> is <span translate=no>_^_1_^_</span>. These are the capsules from the lower layer.</p>\n": "<p>\u7684\u5f62\u72b6<span translate=no>_^_0_^_</span>\u662f<span translate=no>_^_1_^_</span>\u3002\u8fd9\u4e9b\u662f\u4e0b\u5c42\u7684\u80f6\u56ca\u3002</p>\n",
|
||||
"<p> The shape of <span translate=no>_^_0_^_</span> is <span translate=no>_^_1_^_</span></p>\n": "<p>\u7684\u5f62\u72b6<span translate=no>_^_0_^_</span>\u662f<span translate=no>_^_1_^_</span></p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> </p>\n": "<p><span translate=no>_^_0_^_</span></p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> <span translate=no>_^_1_^_</span> has shape <span translate=no>_^_2_^_</span>. We have parallelized the computation of <span translate=no>_^_3_^_</span> for for all <span translate=no>_^_4_^_</span>. </p>\n": "<p><span translate=no>_^_0_^_</span><span translate=no>_^_1_^_</span>\u6709\u5f62\u72b6<span translate=no>_^_2_^_</span>\u3002\u6211\u4eec\u5df2\u7ecf\u5e76\u884c\u5316\u4e86 for all<span translate=no>_^_3_^_</span> \u7684\u8ba1\u7b97<span translate=no>_^_4_^_</span>\u3002</p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> <span translate=no>_^_1_^_</span> is one-hot encoded labels of shape <span translate=no>_^_2_^_</span> </p>\n": "<p><span translate=no>_^_0_^_</span><span translate=no>_^_1_^_</span>\u662f\u5f62\u72b6\u7684\u4e00\u70ed\u7f16\u7801\u6807\u7b7e<span translate=no>_^_2_^_</span></p>\n",
|
||||
"<p><span translate=no>_^_0_^_</span> Here <span translate=no>_^_1_^_</span> is used to index capsules in this layer, whilst <span translate=no>_^_2_^_</span> is used to index capsules in the layer below (previous). </p>\n": "<p><span translate=no>_^_0_^_</span>\u8fd9\u91cc<span translate=no>_^_1_^_</span>\u7528\u4e8e\u7d22\u5f15\u8be5\u5c42\u4e2d\u7684\u80f6\u56ca\uff0c\u800c<span translate=no>_^_2_^_</span>\u7528\u4e8e\u7d22\u5f15\u4e0b\u5c42\uff08\u4e0a\u4e00\u5c42\uff09\u4e2d\u7684\u80f6\u56ca\u3002</p>\n",
|
||||
"<p>Initial logits <span translate=no>_^_0_^_</span> are the log prior probabilities that capsule <span translate=no>_^_1_^_</span> should be coupled with <span translate=no>_^_2_^_</span>. We initialize these at zero </p>\n": "<p>\u521d\u59cb\u5bf9\u6570<span translate=no>_^_0_^_</span>\u662f\u80f6\u56ca<span translate=no>_^_1_^_</span>\u5e94\u4e0e\u4e4b\u76f8\u7ed3\u5408\u7684\u5bf9\u6570\u5148\u9a8c\u6982\u7387<span translate=no>_^_2_^_</span>\u3002\u6211\u4eec\u5c06\u5b83\u4eec\u521d\u59cb\u5316\u4e3a\u96f6</p>\n",
|
||||
"<p>Iterate </p>\n": "<p>\u8fed\u4ee3</p>\n",
|
||||
"<p>This is the weight matrix <span translate=no>_^_0_^_</span>. It maps each capsule in the lower layer to each capsule in this layer </p>\n": "<p>\u8fd9\u662f\u6743\u91cd\u77e9\u9635<span translate=no>_^_0_^_</span>\u3002\u5b83\u5c06\u4e0b\u5c42\u4e2d\u7684\u6bcf\u4e2a\u80f6\u56ca\u6620\u5c04\u5230\u8be5\u5c42\u4e2d\u7684\u6bcf\u4e2a\u80f6\u56ca\u4f53</p>\n",
|
||||
"<p>We add an epsilon when calculating <span translate=no>_^_0_^_</span> to make sure it doesn't become zero. If this becomes zero it starts giving out <span translate=no>_^_1_^_</span> values and training fails. <span translate=no>_^_2_^_</span> </p>\n": "<p>\u6211\u4eec\u5728\u8ba1\u7b97\u65f6\u6dfb\u52a0\u4e00\u4e2a epsilon<span translate=no>_^_0_^_</span>\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e0d\u4f1a\u53d8\u4e3a\u96f6\u3002\u5982\u679c\u8be5\u503c\u53d8\u4e3a\u96f6\uff0c\u5219\u5f00\u59cb\u7ed9\u51fa<span translate=no>_^_1_^_</span>\u503c\uff0c\u5e76\u4e14\u8bad\u7ec3\u5931\u8d25\u3002<span translate=no>_^_2_^_</span></p>\n",
|
||||
"<p>routing softmax <span translate=no>_^_0_^_</span> </p>\n": "<p>\u8def\u7531\u8f6f\u6700\u5927<span translate=no>_^_0_^_</span></p>\n",
|
||||
"Capsule Networks": "\u80f6\u56ca\u7f51\u7edc",
|
||||
"PyTorch implementation and tutorial of Capsule Networks. Capsule network is a neural network architecture that embeds features as capsules and routes them with a voting mechanism to next layer of capsules.": "PyTorch \u5b9e\u73b0\u548c\u80f6\u56ca\u7f51\u7edc\u6559\u7a0b\u3002\u80f6\u56ca\u7f51\u7edc\u662f\u4e00\u79cd\u795e\u7ecf\u7f51\u7edc\u67b6\u6784\uff0c\u5b83\u4ee5\u80f6\u56ca\u7684\u5f62\u5f0f\u5d4c\u5165\u7279\u5f81\uff0c\u5e76\u901a\u8fc7\u6295\u7968\u673a\u5236\u5c06\u5b83\u4eec\u8def\u7531\u5230\u4e0b\u4e00\u5c42\u80f6\u56ca\u3002"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"<h1>Classify MNIST digits with Capsule Networks</h1>\n<p>This is an annotated PyTorch code to classify MNIST digits with PyTorch.</p>\n<p>This paper implements the experiment described in paper <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n": "<h1>\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3088\u308b MNIST \u30c7\u30a3\u30b8\u30c3\u30c8\u306e\u5206\u985e</h1>\n<p>\u3053\u308c\u306f\u3001MNIST\u306e\u6570\u5b57\u3092PyTorch\u3067\u5206\u985e\u3059\u308b\u305f\u3081\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u4ed8\u304d\u306ePyTorch\u30b3\u30fc\u30c9\u3067\u3059\u3002</p>\n<p>\u3053\u306e\u8ad6\u6587\u3067\u306f\u3001\u8ad6\u6587\u300c<a href=\"https://arxiv.org/abs/1710.09829\">\u30ab\u30d7\u30bb\u30eb\u9593\u306e\u52d5\u7684\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0</a>\u300d\u3067\u8aac\u660e\u3055\u308c\u3066\u3044\u308b\u5b9f\u9a13\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002</p>\n",
|
||||
"<h2>Model for classifying MNIST digits</h2>\n": "<h2>MNIST \u30c7\u30a3\u30b8\u30c3\u30c8\u3092\u5206\u985e\u3059\u308b\u305f\u3081\u306e\u30e2\u30c7\u30eb</h2>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span> are the MNIST images, with shape <span translate=no>_^_1_^_</span></p>\n": "<p><span translate=no>_^_0_^_</span>MNIST \u306e\u753b\u50cf\u306f\u5f62\u72b6\u4ed8\u304d\u3067\u3059 <span translate=no>_^_1_^_</span></p>\n",
|
||||
"<p> Configurations with MNIST data and Train & Validation setup</p>\n": "<p>MNIST\u30c7\u30fc\u30bf\u3068\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3068\u691c\u8a3c\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3092\u542b\u3080\u69cb\u6210</p>\n",
|
||||
"<p> Run the experiment</p>\n": "<p>\u5b9f\u9a13\u3092\u5b9f\u884c\u3059\u308b</p>\n",
|
||||
"<p> This method gets called by the trainer</p>\n": "<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u30c8\u30ec\u30fc\u30ca\u30fc\u306b\u3088\u3063\u3066\u547c\u3073\u51fa\u3055\u308c\u307e\u3059</p>\n",
|
||||
"<p>Calculate the total loss </p>\n": "<p>\u7dcf\u640d\u5931\u306e\u8a08\u7b97</p>\n",
|
||||
"<p>Call accuracy metric </p>\n": "<p>\u901a\u8a71\u7cbe\u5ea6\u6307\u6a19</p>\n",
|
||||
"<p>Create a mask to maskout all the other capsules </p>\n": "<p>\u30de\u30b9\u30af\u3092\u4f5c\u6210\u3057\u3066\u3001\u4ed6\u306e\u3059\u3079\u3066\u306e\u30ab\u30d7\u30bb\u30eb\u3092\u8986\u3044\u96a0\u3057\u3066\u304f\u3060\u3055\u3044</p>\n",
|
||||
"<p>First convolution layer has <span translate=no>_^_0_^_</span>, <span translate=no>_^_1_^_</span> convolution kernels </p>\n": "<p>\u6700\u521d\u306e\u7573\u307f\u8fbc\u307f\u5c64\u306b\u306f<span translate=no>_^_0_^_</span>\u3001<span translate=no>_^_1_^_</span>\u7573\u307f\u8fbc\u307f\u30ab\u30fc\u30cd\u30eb\u304c\u3042\u308a\u307e\u3059</p>\n",
|
||||
"<p>Get masks for reconstructioon </p>\n": "<p>\u5fa9\u8208\u7528\u30de\u30b9\u30af\u3092\u5165\u624b</p>\n",
|
||||
"<p>Get the images and labels and move them to the model's device </p>\n": "<p>\u753b\u50cf\u3068\u30e9\u30d9\u30eb\u3092\u53d6\u5f97\u3057\u3066\u30e2\u30c7\u30eb\u306e\u30c7\u30d0\u30a4\u30b9\u306b\u79fb\u52d5\u3057\u307e\u3059</p>\n",
|
||||
"<p>Increment step in training mode </p>\n": "<p>\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30e2\u30fc\u30c9\u3067\u306e\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u30b9\u30c6\u30c3\u30d7</p>\n",
|
||||
"<p>Log parameters and gradients </p>\n": "<p>\u30ed\u30b0\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3</p>\n",
|
||||
"<p>Mask the digit capsules to get only the capsule that made the prediction and take it through decoder to get reconstruction </p>\n": "<p>\u6570\u5b57\u306e\u30ab\u30d7\u30bb\u30eb\u3092\u30de\u30b9\u30af\u3057\u3066\u4e88\u6e2c\u3092\u884c\u3063\u305f\u30ab\u30d7\u30bb\u30eb\u306e\u307f\u3092\u53d6\u5f97\u3057\u3001\u305d\u308c\u3092\u30c7\u30b3\u30fc\u30c0\u30fc\u306b\u901a\u3057\u3066\u518d\u69cb\u6210\u3057\u307e\u3059</p>\n",
|
||||
"<p>Pass through the first convolution layer. Output of this layer has shape <span translate=no>_^_0_^_</span> </p>\n": "<p>\u6700\u521d\u306e\u7573\u307f\u8fbc\u307f\u5c64\u3092\u901a\u904e\u3057\u307e\u3059\u3002\u3053\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u51fa\u529b\u306b\u306f\u5f62\u72b6\u304c\u3042\u308a\u307e\u3059 <span translate=no>_^_0_^_</span></p>\n",
|
||||
"<p>Pass through the second convolution layer. Output of this has shape <span translate=no>_^_0_^_</span>. <em>Note that this layer has a stride length of <span translate=no>_^_1_^_</span></em>. </p>\n": "<p>2 \u756a\u76ee\u306e\u7573\u307f\u8fbc\u307f\u5c64\u3092\u901a\u904e\u3057\u307e\u3059\u3002\u3053\u308c\u306e\u51fa\u529b\u306b\u306f\u5f62\u72b6\u304c\u3042\u308a\u307e\u3059<span translate=no>_^_0_^_</span>\u3002<em><span translate=no>_^_1_^_</span>\u3053\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u30b9\u30c8\u30e9\u30a4\u30c9\u306e\u9577\u3055\u306f\u3067\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044</em></p>\u3002\n",
|
||||
"<p>Print losses and accuracy to screen </p>\n": "<p>\u5370\u5237\u30ed\u30b9\u3068\u753b\u9762\u306e\u7cbe\u5ea6</p>\n",
|
||||
"<p>Reshape the reconstruction to match the image dimensions </p>\n": "<p>\u753b\u50cf\u306e\u30b5\u30a4\u30ba\u306b\u5408\u308f\u305b\u3066\u518d\u69cb\u6210\u306e\u5f62\u72b6\u3092\u5909\u66f4</p>\n",
|
||||
"<p>Resize and permutate to get the capsules </p>\n": "<p>\u30b5\u30a4\u30ba\u3092\u5909\u66f4\u3057\u3066\u4e26\u3079\u66ff\u3048\u3066\u30ab\u30d7\u30bb\u30eb\u306b\u3059\u308b</p>\n",
|
||||
"<p>Routing layer gets the <span translate=no>_^_0_^_</span> primary capsules and produces <span translate=no>_^_1_^_</span> capsules. Each of the primary capsules have <span translate=no>_^_2_^_</span> features, while output capsules (Digit Capsules) have <span translate=no>_^_3_^_</span> features. The routing algorithm iterates <span translate=no>_^_4_^_</span> times. </p>\n": "<p><span translate=no>_^_0_^_</span>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u5c64\u306f\u4e00\u6b21\u30ab\u30d7\u30bb\u30eb\u3092\u53d6\u5f97\u3057\u3001<span translate=no>_^_1_^_</span>\u30ab\u30d7\u30bb\u30eb\u3092\u751f\u6210\u3057\u307e\u3059\u3002<span translate=no>_^_2_^_</span>\u5404\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ab\u30d7\u30bb\u30eb\u306b\u306f\u7279\u5fb4\u304c\u3042\u308a\u3001\u51fa\u529b\u30ab\u30d7\u30bb\u30eb\uff08\u30c7\u30a3\u30b8\u30c3\u30c8\u30ab\u30d7\u30bb\u30eb\uff09\u306b\u306f\u7279\u5fb4\u304c\u3042\u308a\u307e\u3059\u3002<span translate=no>_^_3_^_</span><span translate=no>_^_4_^_</span>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u4f55\u56de\u3082\u7e70\u308a\u8fd4\u3057\u307e\u3059\u3002</p>\n",
|
||||
"<p>Run the model </p>\n": "<p>\u30e2\u30c7\u30eb\u3092\u5b9f\u884c</p>\n",
|
||||
"<p>Set the model </p>\n": "<p>\u30e2\u30c7\u30eb\u3092\u8a2d\u5b9a\u3059\u308b</p>\n",
|
||||
"<p>Set the model mode </p>\n": "<p>\u30e2\u30c7\u30eb\u30e2\u30fc\u30c9\u3092\u8a2d\u5b9a</p>\n",
|
||||
"<p>Squash the capsules </p>\n": "<p>\u30ab\u30d7\u30bb\u30eb\u3092\u62bc\u3057\u3064\u3076\u3059</p>\n",
|
||||
"<p>Take them through the router to get digit capsules. This has shape <span translate=no>_^_0_^_</span>. </p>\n": "<p>\u305d\u308c\u3089\u3092\u30eb\u30fc\u30bf\u30fc\u306b\u901a\u3057\u3066\u3001\u6570\u5b57\u306e\u30ab\u30d7\u30bb\u30eb\u3092\u5165\u624b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u5f62\u304c\u3042\u308a\u307e\u3059<span translate=no>_^_0_^_</span>\u3002</p>\n",
|
||||
"<p>The prediction by the capsule network is the capsule with longest length </p>\n": "<p>\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3088\u308b\u4e88\u6e2c\u3067\u306f\u3001\u9577\u3055\u304c\u6700\u3082\u9577\u3044\u30ab\u30d7\u30bb\u30eb\u3067\u3059</p>\n",
|
||||
"<p>The second layer (Primary Capsules) s a convolutional capsule layer with <span translate=no>_^_0_^_</span> channels of convolutional <span translate=no>_^_1_^_</span> capsules (<span translate=no>_^_2_^_</span> features per capsule). That is, each primary capsule contains 8 convolutional units with a 9 \u00d7 9 kernel and a stride of 2. In order to implement this we create a convolutional layer with <span translate=no>_^_3_^_</span> channels and reshape and permutate its output to get the capsules of <span translate=no>_^_4_^_</span> features each. </p>\n": "<p>2 \u756a\u76ee\u306e\u5c64 (\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ab\u30d7\u30bb\u30eb) \u306f\u3001\u7573\u307f\u8fbc\u307f\u30ab\u30d7\u30bb\u30eb (\u30ab\u30d7\u30bb\u30eb\u3054\u3068\u306e\u30d5\u30a3\u30fc\u30c1\u30e3) <span translate=no>_^_0_^_</span> <span translate=no>_^_1_^_</span> \u306e\u30c1\u30e3\u30cd\u30eb\u304c\u3042\u308b\u7573\u307f\u8fbc\u307f\u30ab\u30d7\u30bb\u30eb\u5c64\u3067\u3059\u3002<span translate=no>_^_2_^_</span>\u3064\u307e\u308a\u3001\u5404\u30d7\u30e9\u30a4\u30de\u30ea\u30ab\u30d7\u30bb\u30eb\u306b\u306f\u30019 \u00d7 9 \u306e\u30ab\u30fc\u30cd\u30eb\u3068\u30b9\u30c8\u30e9\u30a4\u30c9\u304c 2 \u306e 8 \u3064\u306e\u7573\u307f\u8fbc\u307f\u30e6\u30cb\u30c3\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306b\u3001<span translate=no>_^_3_^_</span>\u30c1\u30e3\u30cd\u30eb\u3092\u542b\u3080\u7573\u307f\u8fbc\u307f\u5c64\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u51fa\u529b\u3092\u5f62\u72b6\u5909\u66f4\u304a\u3088\u3073\u7f6e\u63db\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u7279\u5fb4\u306e\u30ab\u30d7\u30bb\u30eb\u3092\u53d6\u5f97\u3057\u307e\u3059</p>\u3002<span translate=no>_^_4_^_</span>\n",
|
||||
"<p>This is the decoder mentioned in the paper. It takes the outputs of the <span translate=no>_^_0_^_</span> digit capsules, each with <span translate=no>_^_1_^_</span> features to reproduce the image. It goes through linear layers of sizes <span translate=no>_^_2_^_</span> and <span translate=no>_^_3_^_</span> with <span translate=no>_^_4_^_</span> activations. </p>\n": "<p>\u3053\u308c\u306f\u8ad6\u6587\u3067\u8a00\u53ca\u3055\u308c\u3066\u3044\u308b\u30c7\u30b3\u30fc\u30c0\u30fc\u3067\u3059\u3002<span translate=no>_^_0_^_</span>\u6570\u5b57\u30ab\u30d7\u30bb\u30eb\u306e\u51fa\u529b\u3092\u53d7\u3051\u53d6\u308a\u3001<span translate=no>_^_1_^_</span>\u305d\u308c\u305e\u308c\u306b\u753b\u50cf\u3092\u518d\u73fe\u3059\u308b\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002<span translate=no>_^_2_^_</span><span translate=no>_^_3_^_</span><span translate=no>_^_4_^_</span>\u30b5\u30a4\u30ba\u3084\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30b7\u30e7\u30f3\u304c\u76f4\u7dda\u7684\u306b\u7e70\u308a\u8fd4\u3055\u308c\u307e\u3059</p>\u3002\n",
|
||||
"<p>We need to set the metrics to calculate them for the epoch for training and validation </p>\n": "<p>\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3068\u691c\u8a3c\u306e\u305f\u3081\u306b\u3001\u30a8\u30dd\u30c3\u30af\u306b\u5408\u308f\u305b\u3066\u305d\u308c\u3089\u3092\u8a08\u7b97\u3059\u308b\u30e1\u30c8\u30ea\u30c3\u30af\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059</p>\n",
|
||||
"<p>Whether to log activations </p>\n": "<p>\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30b7\u30e7\u30f3\u3092\u30ed\u30b0\u306b\u8a18\u9332\u3059\u308b\u304b\u3069\u3046\u304b</p>\n",
|
||||
"Classify MNIST digits with Capsule Networks": "\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3088\u308b MNIST \u30c7\u30a3\u30b8\u30c3\u30c8\u306e\u5206\u985e",
|
||||
"Code for training Capsule Networks on MNIST dataset": "MNIST \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067 Capsule \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"<h1>Classify MNIST digits with Capsule Networks</h1>\n<p>This is an annotated PyTorch code to classify MNIST digits with PyTorch.</p>\n<p>This paper implements the experiment described in paper <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n": "<h1>\u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0da2\u0dcf\u0dbd \u0dc3\u0db8\u0d9f MNIST \u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0dc0\u0dbb\u0dca\u0d9c\u0dd3\u0d9a\u0dbb\u0dab\u0dba \u0d9a\u0dbb\u0db1\u0dca\u0db1</h1>\n<p>\u0db8\u0dd9\u0dbaPyTorch \u0dc3\u0db8\u0d9f MNIST \u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0dc0\u0dbb\u0dca\u0d9c\u0dd3\u0d9a\u0dbb\u0dab\u0dba \u0d9a\u0dd2\u0dbb\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0dc0\u0dd2\u0db1\u0dd3\u0dad \u0db4\u0dba\u0dd2\u0da7\u0ddd\u0da0\u0dca \u0d9a\u0dda\u0dad\u0dba\u0d9a\u0dd2. </p>\n<p>\u0db8\u0dd9\u0db8\u0dbd\u0dd2\u0db4\u0dd2\u0dba \u0d9a\u0da9\u0daf\u0dcf\u0dc3\u0dd2 \u0dc0\u0dd2\u0dc3\u0dca\u0dad\u0dbb \u0d9a\u0dbb \u0d87\u0dad\u0dd2 \u0d85\u0dad\u0dca\u0dc4\u0daf\u0dcf \u0db6\u0dd0\u0dbd\u0dd3\u0db8 \u0d9a\u0dca\u0dbb\u0dd2\u0dba\u0dcf\u0dad\u0dca\u0db8\u0d9a \u0d9a\u0dbb\u0dba\u0dd2 <a href=\"https://arxiv.org/abs/1710.09829\">\u0da9\u0dba\u0dd2\u0db1\u0db8\u0dd2\u0d9a\u0dca \u0dbb\u0dc0\u0dd4\u0da7\u0dd2\u0db1\u0dca \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0d85\u0dad\u0dbb</a>. </p>\n",
|
||||
"<h2>Model for classifying MNIST digits</h2>\n": "<h2>MNIST\u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0dc0\u0dbb\u0dca\u0d9c\u0dd3\u0d9a\u0dbb\u0dab\u0dba \u0d9a\u0dd2\u0dbb\u0dd3\u0db8\u0dda \u0d86\u0d9a\u0dd8\u0dad\u0dd2\u0dba</h2>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span> are the MNIST images, with shape <span translate=no>_^_1_^_</span></p>\n": "<p> <span translate=no>_^_0_^_</span> \u0dc4\u0dd0\u0da9\u0dba \u0dc3\u0dc4\u0dd2\u0dad MNIST \u0dbb\u0dd6\u0db4 <span translate=no>_^_1_^_</span></p>\n",
|
||||
"<p> Configurations with MNIST data and Train & Validation setup</p>\n": "<p> MNIST\u0daf\u0dad\u0dca\u0dad \u0dc3\u0dc4 \u0daf\u0dd4\u0db8\u0dca\u0dbb\u0dd2\u0dba \u0dc3\u0dc4 \u0dc0\u0dbd\u0d82\u0d9c\u0dd4 \u0d9a\u0dd2\u0dbb\u0dd3\u0db8\u0dda \u0dc3\u0dd0\u0d9a\u0dc3\u0dd4\u0db8 \u0dc3\u0db8\u0d9f \u0dc0\u0dd2\u0db1\u0dca\u0dba\u0dcf\u0dc3 \u0d9a\u0dd2\u0dbb\u0dd3\u0db8\u0dca</p>\n",
|
||||
"<p> Run the experiment</p>\n": "<p> \u0d85\u0dad\u0dca\u0dc4\u0daf\u0dcf\u0db6\u0dd0\u0dbd\u0dd3\u0db8 \u0d9a\u0dca\u0dbb\u0dd2\u0dba\u0dcf\u0dad\u0dca\u0db8\u0d9a \u0d9a\u0dbb\u0db1\u0dca\u0db1</p>\n",
|
||||
"<p> This method gets called by the trainer</p>\n": "<p> \u0db8\u0dd9\u0db8\u0d9a\u0dca\u0dbb\u0db8\u0dba \u0db4\u0dd4\u0dc4\u0dd4\u0dab\u0dd4\u0d9a\u0dbb\u0dd4 \u0dc0\u0dd2\u0dc3\u0dd2\u0db1\u0dca \u0d9a\u0dd0\u0db3\u0dc0\u0db1\u0dd4 \u0dbd\u0dd0\u0db6\u0dda</p>\n",
|
||||
"<p>Calculate the total loss </p>\n": "<p>\u0dc3\u0db8\u0dca\u0db4\u0dd6\u0dbb\u0dca\u0dab\u0d85\u0dbd\u0dcf\u0db7\u0dba \u0d9c\u0dab\u0db1\u0dba \u0d9a\u0dbb\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Call accuracy metric </p>\n": "<p>\u0d87\u0db8\u0dad\u0dd4\u0db8\u0dca\u0db1\u0dd2\u0dbb\u0dc0\u0daf\u0dca\u0dba\u0dad\u0dcf\u0dc0 \u0db8\u0dd9\u0da7\u0dca\u0dbb\u0dd2\u0d9a\u0dca </p>\n",
|
||||
"<p>Create a mask to maskout all the other capsules </p>\n": "<p>\u0d85\u0db1\u0dd9\u0d9a\u0dca\u0dc3\u0dd2\u0dba\u0dbd\u0dd4\u0db8 \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0dc0\u0dd9\u0dc3\u0dca\u0db8\u0dd4\u0dc4\u0dd4\u0dab \u0daf\u0dd3\u0db8\u0da7 \u0dc0\u0dd9\u0dc3\u0dca\u0db8\u0dd4\u0dc4\u0dd4\u0dab\u0d9a\u0dca \u0dc3\u0dcf\u0daf\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>First convolution layer has <span translate=no>_^_0_^_</span>, <span translate=no>_^_1_^_</span> convolution kernels </p>\n": "<p>\u0db4\u0dc5\u0db8\u0dd4\u0d9a\u0dd0\u0da7\u0dd2 \u0d9c\u0dd0\u0dc3\u0dd4\u0dab\u0dd4 \u0dc3\u0dca\u0dae\u0dbb\u0dba <span translate=no>_^_0_^_</span>, <span translate=no>_^_1_^_</span> convolution \u0d9a\u0dbb\u0dca\u0db1\u0dbd\u0dca </p>\n",
|
||||
"<p>Get masks for reconstructioon </p>\n": "<p>\u0db4\u0dca\u0dbb\u0dad\u0dd2\u0db1\u0dd2\u0dbb\u0dca\u0db8\u0dcf\u0dab\u0dba\u0dc3\u0db3\u0dc4\u0dcf \u0dc0\u0dd9\u0dc3\u0dca \u0db8\u0dd4\u0dc4\u0dd4\u0dab\u0dd4 \u0dbd\u0db6\u0dcf \u0d9c\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Get the images and labels and move them to the model's device </p>\n": "<p>\u0db4\u0dd2\u0db1\u0dca\u0dad\u0dd6\u0dbb\u0dc3\u0dc4 \u0dbd\u0dda\u0db6\u0dbd\u0dca \u0dbd\u0db6\u0dcf\u0d9c\u0dd9\u0db1 \u0d92\u0dc0\u0dcf \u0d86\u0d9a\u0dd8\u0dad\u0dd2\u0dba\u0dda \u0d8b\u0db4\u0dcf\u0d82\u0d9c\u0dba\u0da7 \u0d9c\u0dd9\u0db1 \u0dba\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Increment step in training mode </p>\n": "<p>\u0db4\u0dd4\u0dc4\u0dd4\u0dab\u0dd4\u0db8\u0dcf\u0daf\u0dd2\u0dbd\u0dd2\u0dba\u0dda \u0dc0\u0dbb\u0dca\u0db0\u0d9a \u0db4\u0dd2\u0dba\u0dc0\u0dbb </p>\n",
|
||||
"<p>Log parameters and gradients </p>\n": "<p>\u0dbd\u0ddc\u0d9c\u0dca\u0db4\u0dbb\u0dcf\u0db8\u0dd2\u0dad\u0dd3\u0db1\u0dca \u0dc3\u0dc4 \u0d85\u0db1\u0dd4\u0d9a\u0dca\u0dbb\u0db8\u0dd2\u0d9a </p>\n",
|
||||
"<p>Mask the digit capsules to get only the capsule that made the prediction and take it through decoder to get reconstruction </p>\n": "<p>\u0d85\u0db1\u0dcf\u0dc0\u0dd0\u0d9a\u0dd2\u0dba\u0d9a\u0dc5 \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0dba \u0db4\u0db8\u0dab\u0d9a\u0dca \u0dbd\u0db6\u0dcf \u0d9c\u0dd0\u0db1\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd Mask \u0d9a\u0dbb \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0db1\u0dd2\u0dbb\u0dca\u0db8\u0dcf\u0dab\u0dba \u0dbd\u0db6\u0dcf \u0d9c\u0dd0\u0db1\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0dc0\u0dd2\u0d9a\u0dda\u0dad\u0d9a\u0dba \u0dc4\u0dbb\u0dc4\u0dcf \u0d91\u0dba \u0dbb\u0dd0\u0d9c\u0dd9\u0db1 \u0dba\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Pass through the first convolution layer. Output of this layer has shape <span translate=no>_^_0_^_</span> </p>\n": "<p>\u0db4\u0dc5\u0db8\u0dd4\u0d9a\u0dd0\u0da7\u0dd2 \u0d9c\u0dd0\u0dc3\u0dd4\u0dab\u0dd4 \u0dc3\u0dca\u0dad\u0dbb\u0dba \u0dc4\u0dbb\u0dc4\u0dcf \u0d9c\u0db8\u0db1\u0dca \u0d9a\u0dbb\u0db1\u0dca\u0db1. \u0db8\u0dd9\u0db8 \u0dc3\u0dca\u0dae\u0dbb\u0dba\u0dda \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0daf\u0dcf\u0db1\u0dba \u0dc4\u0dd0\u0da9\u0dba \u0d87\u0dad <span translate=no>_^_0_^_</span> </p>\n",
|
||||
"<p>Pass through the second convolution layer. Output of this has shape <span translate=no>_^_0_^_</span>. <em>Note that this layer has a stride length of <span translate=no>_^_1_^_</span></em>. </p>\n": "<p>\u0daf\u0dd9\u0dc0\u0db1\u0d9a\u0dd0\u0da7\u0dd2 \u0d9c\u0dd0\u0dc3\u0dd4\u0dab\u0dd4 \u0dc3\u0dca\u0dad\u0dbb\u0dba \u0dc4\u0dbb\u0dc4\u0dcf \u0d9c\u0db8\u0db1\u0dca \u0d9a\u0dbb\u0db1\u0dca\u0db1. \u0db8\u0dd9\u0db8 \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0daf\u0dcf\u0db1\u0dba \u0dc4\u0dd0\u0da9\u0dba \u0d87\u0dad <span translate=no>_^_0_^_</span>. <em>\u0db8\u0dd9\u0db8\u0dc3\u0dca\u0dae\u0dbb\u0dba\u0da7 \u0daf\u0dd2\u0d9c\u0dd4 \u0daf\u0dd2\u0d9c\u0d9a\u0dca \u0d87\u0dad\u0dd2 \u0db6\u0dc0 \u0dc3\u0dbd\u0d9a\u0db1\u0dca\u0db1 <span translate=no>_^_1_^_</span></em>. </p>\n",
|
||||
"<p>Print losses and accuracy to screen </p>\n": "<p>\u0db4\u0dcf\u0da9\u0dd4\u0dc3\u0dc4 \u0db1\u0dd2\u0dbb\u0dc0\u0daf\u0dca\u0dba\u0dad\u0dcf\u0dc0 \u0dad\u0dd2\u0dbb\u0dba\u0da7 \u0db8\u0dd4\u0daf\u0dca\u0dbb\u0dab\u0dba \u0d9a\u0dbb\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Reshape the reconstruction to match the image dimensions </p>\n": "<p>\u0dbb\u0dd6\u0db4\u0db8\u0dcf\u0db1\u0dba\u0db1\u0dca \u0d9c\u0dd0\u0dbd\u0db4\u0dd9\u0db1 \u0db4\u0dbb\u0dd2\u0daf\u0dd2 \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0db1\u0dd2\u0dbb\u0dca\u0db8\u0dcf\u0dab\u0dba \u0db1\u0dd0\u0dc0\u0dad \u0dc3\u0d9a\u0dc3\u0dca \u0d9a\u0dbb\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Resize and permutate to get the capsules </p>\n": "<p>\u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0dbd\u0db6\u0dcf \u0d9c\u0dd0\u0db1\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0db4\u0dca\u0dbb\u0db8\u0dcf\u0dab\u0dba \u0dc0\u0dd9\u0db1\u0dc3\u0dca \u0d9a\u0dbb permutate \u0d9a\u0dbb\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Routing layer gets the <span translate=no>_^_0_^_</span> primary capsules and produces <span translate=no>_^_1_^_</span> capsules. Each of the primary capsules have <span translate=no>_^_2_^_</span> features, while output capsules (Digit Capsules) have <span translate=no>_^_3_^_</span> features. The routing algorithm iterates <span translate=no>_^_4_^_</span> times. </p>\n": "<p>\u0dbb\u0dc0\u0dd4\u0da7\u0dd2\u0db1\u0dca\u0dc3\u0dca\u0dad\u0dbb\u0dba <span translate=no>_^_0_^_</span> \u0db4\u0dca\u0dbb\u0dcf\u0dae\u0db8\u0dd2\u0d9a \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0dbd\u0dd0\u0db6\u0dd9\u0db1 \u0d85\u0dad\u0dbb <span translate=no>_^_1_^_</span> \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0db1\u0dd2\u0dc2\u0dca\u0db4\u0dcf\u0daf\u0db1\u0dba \u0d9a\u0dbb\u0dba\u0dd2. \u0dc3\u0dd1\u0db8 \u0db4\u0dca\u0dbb\u0dcf\u0dae\u0db8\u0dd2\u0d9a \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0dba\u0d9a\u0db8 <span translate=no>_^_2_^_</span> \u0dc0\u0dd2\u0dc1\u0dda\u0dc2\u0dcf\u0d82\u0d9c \u0d87\u0dad\u0dd2 \u0d85\u0dad\u0dbb \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0daf\u0dcf\u0db1 \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd (\u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd) <span translate=no>_^_3_^_</span> \u0dc0\u0dd2\u0dc1\u0dda\u0dc2\u0dcf\u0d82\u0d9c \u0d87\u0dad. \u0dbb\u0dc0\u0dd4\u0da7\u0dd2\u0db1\u0dca \u0d87\u0dbd\u0dca\u0d9c\u0ddc\u0dbb\u0dd2\u0dad\u0db8 <span translate=no>_^_4_^_</span> \u0dc0\u0dbb\u0d9a\u0dca \u0db4\u0dd4\u0db1\u0dbb\u0dcf\u0dc0\u0dbb\u0dca\u0dad\u0db1\u0dba \u0dc0\u0dda. </p>\n",
|
||||
"<p>Run the model </p>\n": "<p>\u0d86\u0d9a\u0dd8\u0dad\u0dd2\u0dba\u0db0\u0dcf\u0dc0\u0db1\u0dba \u0d9a\u0dbb\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Set the model </p>\n": "<p>\u0d86\u0d9a\u0dd8\u0dad\u0dd2\u0dba\u0dc3\u0d9a\u0dc3\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Set the model mode </p>\n": "<p>\u0d86\u0daf\u0dbb\u0dca\u0dc1\u0db4\u0dca\u0dbb\u0d9a\u0dcf\u0dbb\u0dba \u0dc3\u0d9a\u0dc3\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Squash the capsules </p>\n": "<p>\u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0dc3\u0dca\u0d9a\u0ddc\u0dc2\u0dca \u0d9a\u0dbb\u0db1\u0dca\u0db1 </p>\n",
|
||||
"<p>Take them through the router to get digit capsules. This has shape <span translate=no>_^_0_^_</span>. </p>\n": "<p>\u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca\u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0dbd\u0db6\u0dcf \u0d9c\u0dd0\u0db1\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0dbb\u0dc0\u0dd4\u0da7\u0dbb\u0dba \u0dc4\u0dbb\u0dc4\u0dcf \u0d92\u0dc0\u0dcf \u0dbb\u0dd0\u0d9c\u0dd9\u0db1 \u0dba\u0db1\u0dca\u0db1. \u0db8\u0dd9\u0dba \u0dc4\u0dd0\u0da9\u0dba \u0d87\u0dad <span translate=no>_^_0_^_</span>. </p>\n",
|
||||
"<p>The prediction by the capsule network is the capsule with longest length </p>\n": "<p>\u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0da2\u0dcf\u0dbd\u0dba \u0dc0\u0dd2\u0dc3\u0dd2\u0db1\u0dca \u0db4\u0dd4\u0dbb\u0ddd\u0d9a\u0dae\u0db1\u0dba \u0d9a\u0dbb\u0db1\u0dd4 \u0dbd\u0db6\u0db1\u0dca\u0db1\u0dda \u0daf\u0dd2\u0d9c\u0db8 \u0daf\u0dd2\u0d9c \u0dc3\u0dc4\u0dd2\u0dad \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0dba\u0dba\u0dd2 </p>\n",
|
||||
"<p>The second layer (Primary Capsules) s a convolutional capsule layer with <span translate=no>_^_0_^_</span> channels of convolutional <span translate=no>_^_1_^_</span> capsules (<span translate=no>_^_2_^_</span> features per capsule). That is, each primary capsule contains 8 convolutional units with a 9 \u00d7 9 kernel and a stride of 2. In order to implement this we create a convolutional layer with <span translate=no>_^_3_^_</span> channels and reshape and permutate its output to get the capsules of <span translate=no>_^_4_^_</span> features each. </p>\n": "<p>\u0daf\u0dd9\u0dc0\u0db1\u0dc3\u0dca\u0dae\u0dbb\u0dba (\u0db4\u0dca\u0dbb\u0dcf\u0dae\u0db8\u0dd2\u0d9a \u0d9a\u0dbb\u0dbd\u0dca) s convolutional \u0d9a\u0dbb\u0dbd\u0dca <span translate=no>_^_0_^_</span> \u0db1\u0dcf\u0dbd\u0dd2\u0d9a\u0dcf (\u0d9a\u0dbb\u0dbd\u0d9a\u0dca \u0d85\u0db1\u0dd4\u0dc0<span translate=no>_^_2_^_</span> \u0dbd\u0d9a\u0dca\u0dc2\u0dab) \u0dc3\u0db8\u0d9c convolutional <span translate=no>_^_1_^_</span> \u0d9a\u0dbb\u0dbd\u0d9a\u0dca \u0dc3\u0dca\u0dae\u0dbb\u0dba. \u0d91\u0db1\u0db8\u0dca, \u0dc3\u0dd1\u0db8 \u0db4\u0dca\u0dbb\u0dcf\u0dae\u0db8\u0dd2\u0d9a \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd\u0dba\u0d9a\u0db8 9 \u00d7 9 \u0d9a\u0dbb\u0dca\u0db1\u0dbd\u0dba\u0d9a\u0dca \u0dc3\u0dc4 2 \u0d9a \u0d89\u0dbb\u0dd2 \u0dc3\u0dc4\u0dd2\u0dad \u0dc3\u0d82\u0dba\u0dd4\u0d9a\u0dca\u0dad \u0d92\u0d9a\u0d9a 8 \u0d9a\u0dca \u0d85\u0da9\u0d82\u0d9c\u0dd4 \u0dc0\u0dda. \u0db8\u0dd9\u0dba \u0d9a\u0dca\u0dbb\u0dd2\u0dba\u0dcf\u0dad\u0dca\u0db8\u0d9a \u0d9a\u0dd2\u0dbb\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0d85\u0db4\u0dd2 <span translate=no>_^_3_^_</span> \u0db1\u0dcf\u0dbd\u0dd2\u0d9a\u0dcf \u0dc3\u0dc4\u0dd2\u0dad \u0dc3\u0d82\u0dc0\u0dc4\u0db1 \u0dad\u0da7\u0dca\u0da7\u0dd4\u0dc0\u0d9a\u0dca \u0db1\u0dd2\u0dbb\u0dca\u0db8\u0dcf\u0dab\u0dba \u0d9a\u0dbb \u0d91\u0d9a\u0dca \u0d91\u0d9a\u0dca <span translate=no>_^_4_^_</span> \u0dc0\u0dd2\u0dc1\u0dda\u0dc2\u0dcf\u0d82\u0d9c \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0dbd\u0db6\u0dcf \u0d9c\u0dd0\u0db1\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0d91\u0dc4\u0dd2 \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0daf\u0dcf\u0db1\u0dba \u0db1\u0dd0\u0dc0\u0dad \u0dc3\u0d9a\u0dc3\u0dca \u0d9a\u0dbb \u0db4\u0dbb\u0dd2\u0db4\u0dd6\u0dbb\u0dca\u0dab \u0d9a\u0dbb\u0db8\u0dd4. </p>\n",
|
||||
"<p>This is the decoder mentioned in the paper. It takes the outputs of the <span translate=no>_^_0_^_</span> digit capsules, each with <span translate=no>_^_1_^_</span> features to reproduce the image. It goes through linear layers of sizes <span translate=no>_^_2_^_</span> and <span translate=no>_^_3_^_</span> with <span translate=no>_^_4_^_</span> activations. </p>\n": "<p>\u0db8\u0dd9\u0db8\u0d9a\u0da9\u0daf\u0dcf\u0dc3\u0dd2 \u0dc3\u0db3\u0dc4\u0db1\u0dca \u0dc0\u0dd2\u0d9a\u0dda\u0dad\u0d9a\u0dba \u0dc0\u0dda. <span translate=no>_^_0_^_</span> \u0d91\u0dba \u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0dc0\u0dbd \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0daf\u0dcf\u0db1\u0dba\u0db1\u0dca \u0d9c\u0db1\u0dd3, \u0d91\u0d9a\u0dca \u0d91\u0d9a\u0dca \u0dbb\u0dd6\u0db4\u0dba \u0db4\u0dca\u0dbb\u0dad\u0dd2\u0db1\u0dd2\u0dc2\u0dca\u0db4\u0dcf\u0daf\u0db1\u0dba \u0d9a\u0dd2\u0dbb\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf <span translate=no>_^_1_^_</span> \u0dc0\u0dd2\u0dc1\u0dda\u0dc2\u0dcf\u0d82\u0d9c \u0d87\u0dad. \u0d91\u0dba \u0db4\u0dca\u0dbb\u0db8\u0dcf\u0dab\u0dc0\u0dbd\u0dd2\u0db1\u0dca \u0dbb\u0dda\u0d9b\u0dd3\u0dba \u0dc3\u0dca\u0dae\u0dbb \u0dc4\u0dbb\u0dc4\u0dcf <span translate=no>_^_2_^_</span> \u0dc3\u0dc4 <span translate=no>_^_4_^_</span> \u0dc3\u0d9a\u0dca\u0dbb\u0dd2\u0dba \u0d9a\u0dd2\u0dbb\u0dd3\u0db8\u0dca <span translate=no>_^_3_^_</span> \u0dc3\u0db8\u0d9f \u0d9c\u0db8\u0db1\u0dca \u0d9a\u0dbb\u0dba\u0dd2. </p>\n",
|
||||
"<p>We need to set the metrics to calculate them for the epoch for training and validation </p>\n": "<p>\u0db4\u0dd4\u0dc4\u0dd4\u0dab\u0dd4\u0dc0\u0dc3\u0dc4 \u0dc0\u0dbd\u0d82\u0d9c\u0dd4 \u0d9a\u0dd2\u0dbb\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0d91\u0db4\u0ddd\u0da0\u0dca \u0dc3\u0db3\u0dc4\u0dcf \u0d92\u0dc0\u0dcf \u0d9c\u0dab\u0db1\u0dba \u0d9a\u0dd2\u0dbb\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0db4\u0dca\u0dbb\u0db8\u0dd2\u0dad\u0dd2\u0d9a \u0dc3\u0d9a\u0dc3\u0dca \u0d9a\u0dc5 \u0dba\u0dd4\u0dad\u0dd4\u0dba </p>\n",
|
||||
"<p>Whether to log activations </p>\n": "<p>\u0dc3\u0d9a\u0dca\u0dbb\u0dd2\u0dba\u0d9a\u0dd2\u0dbb\u0dd3\u0db8\u0dca \u0dbd\u0ddc\u0d9c\u0dca \u0d9a\u0dc5 \u0dba\u0dd4\u0dad\u0dd4\u0daf \u0dba\u0db1\u0dca\u0db1 </p>\n",
|
||||
"Classify MNIST digits with Capsule Networks": "\u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0da2\u0dcf\u0dbd \u0dc3\u0db8\u0d9f MNIST \u0d89\u0dbd\u0d9a\u0dca\u0d9a\u0db8\u0dca \u0dc0\u0dbb\u0dca\u0d9c\u0dd3\u0d9a\u0dbb\u0dab\u0dba \u0d9a\u0dbb\u0db1\u0dca\u0db1",
|
||||
"Code for training Capsule Networks on MNIST dataset": "MNIST \u0daf\u0dad\u0dca\u0dad \u0d9a\u0da7\u0dca\u0da7\u0dbd\u0dba\u0dda \u0d9a\u0dd0\u0db4\u0dca\u0dc3\u0dd2\u0dba\u0dd4\u0dbd \u0da2\u0dcf\u0dbd \u0db4\u0dd4\u0dc4\u0dd4\u0dab\u0dd4 \u0d9a\u0dd2\u0dbb\u0dd3\u0db8 \u0dc3\u0db3\u0dc4\u0dcf \u0d9a\u0dda\u0dad\u0dba"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"<h1>Classify MNIST digits with Capsule Networks</h1>\n<p>This is an annotated PyTorch code to classify MNIST digits with PyTorch.</p>\n<p>This paper implements the experiment described in paper <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n": "<h1>\u4f7f\u7528\u80f6\u56ca\u7f51\u7edc\u5bf9 MNIST \u6570\u5b57\u8fdb\u884c\u5206\u7c7b</h1>\n<p>\u8fd9\u662f\u4e00\u4e2a\u5e26\u6ce8\u91ca\u7684 PyTorch \u4ee3\u7801\uff0c\u7528\u4e8e\u4f7f\u7528 PyTorch \u5bf9 MNIST \u6570\u5b57\u8fdb\u884c\u5206\u7c7b\u3002</p>\n<p>\u672c\u6587\u5b9e\u65bd\u4e86\u8bba\u6587\u300a<a href=\"https://arxiv.org/abs/1710.09829\">\u80f6\u56ca\u95f4\u52a8\u6001\u8def\u7531</a>\u300b\u4e2d\u63cf\u8ff0\u7684\u5b9e\u9a8c\u3002</p>\n",
|
||||
"<h2>Model for classifying MNIST digits</h2>\n": "<h2>\u7528\u4e8e\u5bf9 MNIST \u6570\u5b57\u8fdb\u884c\u5206\u7c7b\u7684\u6a21\u578b</h2>\n",
|
||||
"<p> <span translate=no>_^_0_^_</span> are the MNIST images, with shape <span translate=no>_^_1_^_</span></p>\n": "<p><span translate=no>_^_0_^_</span>\u662f MNIST \u56fe\u50cf\uff0c\u6709\u5f62\u72b6<span translate=no>_^_1_^_</span></p>\n",
|
||||
"<p> Configurations with MNIST data and Train & Validation setup</p>\n": "<p>\u4f7f\u7528 MNIST \u6570\u636e\u548c\u8bad\u7ec3\u4e0e\u9a8c\u8bc1\u8bbe\u7f6e\u7684\u914d\u7f6e</p>\n",
|
||||
"<p> Run the experiment</p>\n": "<p>\u8fd0\u884c\u5b9e\u9a8c</p>\n",
|
||||
"<p> This method gets called by the trainer</p>\n": "<p>\u8fd9\u4e2a\u65b9\u6cd5\u88ab\u8bad\u7ec3\u5668\u8c03\u7528</p>\n",
|
||||
"<p>Calculate the total loss </p>\n": "<p>\u8ba1\u7b97\u603b\u635f\u5931</p>\n",
|
||||
"<p>Call accuracy metric </p>\n": "<p>\u547c\u53eb\u51c6\u786e\u5ea6\u6307\u6807</p>\n",
|
||||
"<p>Create a mask to maskout all the other capsules </p>\n": "<p>\u521b\u5efa\u906e\u7f69\u4ee5\u906e\u76d6\u6240\u6709\u5176\u4ed6\u80f6\u56ca</p>\n",
|
||||
"<p>First convolution layer has <span translate=no>_^_0_^_</span>, <span translate=no>_^_1_^_</span> convolution kernels </p>\n": "<p>\u7b2c\u4e00\u4e2a\u5377\u79ef\u5c42\u6709<span translate=no>_^_0_^_</span>\uff0c<span translate=no>_^_1_^_</span>\u5377\u79ef\u5185\u6838</p>\n",
|
||||
"<p>Get masks for reconstructioon </p>\n": "<p>\u83b7\u53d6\u7528\u4e8e\u91cd\u5efa\u7684\u53e3\u7f69</p>\n",
|
||||
"<p>Get the images and labels and move them to the model's device </p>\n": "<p>\u83b7\u53d6\u56fe\u50cf\u548c\u6807\u7b7e\u5e76\u5c06\u5176\u79fb\u52a8\u5230\u6a21\u7279\u7684\u8bbe\u5907\u4e0a</p>\n",
|
||||
"<p>Increment step in training mode </p>\n": "<p>\u5728\u8bad\u7ec3\u6a21\u5f0f\u4e2d\u589e\u52a0\u6b65\u6570</p>\n",
|
||||
"<p>Log parameters and gradients </p>\n": "<p>\u65e5\u5fd7\u53c2\u6570\u548c\u68af\u5ea6</p>\n",
|
||||
"<p>Mask the digit capsules to get only the capsule that made the prediction and take it through decoder to get reconstruction </p>\n": "<p>\u63a9\u76d6\u6570\u5b57\u80f6\u56ca\u4ee5\u4ec5\u83b7\u5f97\u505a\u51fa\u9884\u6d4b\u7684\u80f6\u56ca\uff0c\u7136\u540e\u5c06\u5176\u901a\u8fc7\u89e3\u7801\u5668\u8fdb\u884c\u91cd\u5efa</p>\n",
|
||||
"<p>Pass through the first convolution layer. Output of this layer has shape <span translate=no>_^_0_^_</span> </p>\n": "<p>\u7a7f\u8fc7\u7b2c\u4e00\u4e2a\u5377\u79ef\u5c42\u3002\u6b64\u56fe\u5c42\u7684\u8f93\u51fa\u5177\u6709\u5f62\u72b6<span translate=no>_^_0_^_</span></p>\n",
|
||||
"<p>Pass through the second convolution layer. Output of this has shape <span translate=no>_^_0_^_</span>. <em>Note that this layer has a stride length of <span translate=no>_^_1_^_</span></em>. </p>\n": "<p>\u7a7f\u8fc7\u7b2c\u4e8c\u4e2a\u5377\u79ef\u5c42\u3002\u8fd9\u4e2a\u7684\u8f93\u51fa\u6709\u5f62\u72b6<span translate=no>_^_0_^_</span>\u3002<em>\u8bf7\u6ce8\u610f\uff0c\u6b64\u56fe\u5c42\u7684\u6b65\u957f\u4e3a<span translate=no>_^_1_^_</span></em>\u3002</p>\n",
|
||||
"<p>Print losses and accuracy to screen </p>\n": "<p>\u5370\u5237\u635f\u8017\u548c\u5c4f\u5e55\u7cbe\u5ea6</p>\n",
|
||||
"<p>Reshape the reconstruction to match the image dimensions </p>\n": "<p>\u91cd\u5851\u91cd\u5efa\u4ee5\u5339\u914d\u56fe\u50cf\u5c3a\u5bf8</p>\n",
|
||||
"<p>Resize and permutate to get the capsules </p>\n": "<p>\u8c03\u6574\u5927\u5c0f\u5e76\u6392\u5217\u4ee5\u83b7\u5f97\u80f6\u56ca</p>\n",
|
||||
"<p>Routing layer gets the <span translate=no>_^_0_^_</span> primary capsules and produces <span translate=no>_^_1_^_</span> capsules. Each of the primary capsules have <span translate=no>_^_2_^_</span> features, while output capsules (Digit Capsules) have <span translate=no>_^_3_^_</span> features. The routing algorithm iterates <span translate=no>_^_4_^_</span> times. </p>\n": "<p>\u8def\u7531\u5c42\u83b7\u53d6<span translate=no>_^_0_^_</span>\u4e3b\u80f6\u56ca\u5e76\u751f\u6210<span translate=no>_^_1_^_</span>\u80f6\u56ca\u3002\u6bcf\u4e2a\u4e3b\u80f6\u56ca\u90fd\u6709<span translate=no>_^_2_^_</span>\u7279\u5f81\uff0c\u800c\u8f93\u51fa\u80f6\u56ca\uff08Digit Capsules\uff09\u90fd\u6709<span translate=no>_^_3_^_</span>\u7279\u5f81\u3002\u8def\u7531\u7b97\u6cd5\u4f1a\u8fed\u4ee3<span translate=no>_^_4_^_</span>\u6b21\u6570\u3002</p>\n",
|
||||
"<p>Run the model </p>\n": "<p>\u8fd0\u884c\u6a21\u578b</p>\n",
|
||||
"<p>Set the model </p>\n": "<p>\u8bbe\u7f6e\u6a21\u578b</p>\n",
|
||||
"<p>Set the model mode </p>\n": "<p>\u8bbe\u7f6e\u6a21\u578b\u6a21\u5f0f</p>\n",
|
||||
"<p>Squash the capsules </p>\n": "<p>\u6324\u538b\u80f6\u56ca</p>\n",
|
||||
"<p>Take them through the router to get digit capsules. This has shape <span translate=no>_^_0_^_</span>. </p>\n": "<p>\u5e26\u4ed6\u4eec\u901a\u8fc7\u8def\u7531\u5668\u83b7\u5f97\u6570\u5b57\u80f6\u56ca\u3002\u8fd9\u6709\u5f62\u72b6<span translate=no>_^_0_^_</span>\u3002</p>\n",
|
||||
"<p>The prediction by the capsule network is the capsule with longest length </p>\n": "<p>\u80f6\u56ca\u7f51\u7edc\u7684\u9884\u6d4b\u662f\u957f\u5ea6\u6700\u957f\u7684\u80f6\u56ca</p>\n",
|
||||
"<p>The second layer (Primary Capsules) s a convolutional capsule layer with <span translate=no>_^_0_^_</span> channels of convolutional <span translate=no>_^_1_^_</span> capsules (<span translate=no>_^_2_^_</span> features per capsule). That is, each primary capsule contains 8 convolutional units with a 9 \u00d7 9 kernel and a stride of 2. In order to implement this we create a convolutional layer with <span translate=no>_^_3_^_</span> channels and reshape and permutate its output to get the capsules of <span translate=no>_^_4_^_</span> features each. </p>\n": "<p>\u7b2c\u4e8c\u5c42\uff08Primary Capsules\uff09\u662f\u5377\u79ef\u80f6\u56ca\u5c42\uff0c\u5e26\u6709\u5377\u79ef<span translate=no>_^_1_^_</span>\u80f6\u56ca<span translate=no>_^_0_^_</span>\u901a\u9053\uff08\u6bcf\u4e2a\u80f6\u56ca<span translate=no>_^_2_^_</span>\u7684\u7279\u5f81\uff09\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u6bcf\u4e2a\u4e3b\u80f6\u56ca\u5305\u542b 8 \u4e2a\u5377\u79ef\u5355\u4f4d\uff0c\u5185\u6838\u4e3a 9\u00d79\uff0c\u6b65\u5e45\u4e3a 2\u3002\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u5e26\u6709<span translate=no>_^_3_^_</span>\u901a\u9053\u7684\u5377\u79ef\u5c42\uff0c\u5e76\u5bf9\u5176\u8f93\u51fa\u8fdb\u884c\u6574\u5f62\u548c\u6392\u5217\uff0c\u4ee5\u83b7\u5f97\u6bcf\u4e2a<span translate=no>_^_4_^_</span>\u7279\u5f81\u7684\u80f6\u56ca\u3002</p>\n",
|
||||
"<p>This is the decoder mentioned in the paper. It takes the outputs of the <span translate=no>_^_0_^_</span> digit capsules, each with <span translate=no>_^_1_^_</span> features to reproduce the image. It goes through linear layers of sizes <span translate=no>_^_2_^_</span> and <span translate=no>_^_3_^_</span> with <span translate=no>_^_4_^_</span> activations. </p>\n": "<p>\u8fd9\u662f\u672c\u6587\u4e2d\u63d0\u5230\u7684\u89e3\u7801\u5668\u3002\u5b83\u91c7\u7528<span translate=no>_^_0_^_</span>\u6570\u5b57\u80f6\u56ca\u7684\u8f93\u51fa\uff0c\u6bcf\u4e2a\u80f6\u56ca\u90fd\u6709\u91cd\u73b0\u56fe\u50cf\u7684<span translate=no>_^_1_^_</span>\u529f\u80fd\u3002\u5b83\u7a7f\u8fc7\u5927\u5c0f<span translate=no>_^_2_^_</span>\u548c<span translate=no>_^_4_^_</span>\u6fc0\u6d3b<span translate=no>_^_3_^_</span>\u7684\u7ebf\u6027\u5c42\u3002</p>\n",
|
||||
"<p>We need to set the metrics to calculate them for the epoch for training and validation </p>\n": "<p>\u6211\u4eec\u9700\u8981\u8bbe\u7f6e\u6307\u6807\u6765\u8ba1\u7b97\u8bad\u7ec3\u548c\u9a8c\u8bc1\u65f6\u671f\u7684\u6307\u6807</p>\n",
|
||||
"<p>Whether to log activations </p>\n": "<p>\u662f\u5426\u8bb0\u5f55\u6fc0\u6d3b\u6b21\u6570</p>\n",
|
||||
"Classify MNIST digits with Capsule Networks": "\u4f7f\u7528\u80f6\u56ca\u7f51\u7edc\u5bf9 MNIST \u6570\u5b57\u8fdb\u884c\u5206\u7c7b",
|
||||
"Code for training Capsule Networks on MNIST dataset": "\u5728 MNIST \u6570\u636e\u96c6\u4e0a\u8bad\u7ec3\u80f6\u56ca\u7f51\u7edc\u7684\u4ee3\u7801"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"<h1><a href=\"https://nn.labml.ai/capsule_networks/index.html\">Capsule Networks</a></h1>\n<p>This is a <a href=\"https://pytorch.org\">PyTorch</a> implementation/tutorial of <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n<p>Capsule network is a neural network architecture that embeds features as capsules and routes them with a voting mechanism to next layer of capsules.</p>\n<p>Unlike in other implementations of models, we've included a sample, because it is difficult to understand some concepts with just the modules. <a href=\"mnist.html\">This is the annotated code for a model that uses capsules to classify MNIST dataset</a></p>\n<p>This file holds the implementations of the core modules of Capsule Networks.</p>\n<p>I used <a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">jindongwang/Pytorch-CapsuleNet</a> to clarify some confusions I had with the paper.</p>\n<p>Here's a notebook for training a Capsule Network on MNIST dataset.</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a> </p>\n": "<h1><a href=\"https://nn.labml.ai/capsule_networks/index.html\">\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af</a></h1>\n<p><a href=\"https://arxiv.org/abs/1710.09829\">\u3053\u308c\u306f\u3001<a href=\"https://pytorch.org\">\u30ab\u30d7\u30bb\u30eb\u9593\u306e\u52d5\u7684\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306ePyTorch\u5b9f\u88c5/\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u3059</a>\u3002</a></p>\n<p>\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306f\u3001\u30d5\u30a3\u30fc\u30c1\u30e3\u3092\u30ab\u30d7\u30bb\u30eb\u3068\u3057\u3066\u57cb\u3081\u8fbc\u307f\u3001\u6295\u7968\u30e1\u30ab\u30cb\u30ba\u30e0\u3092\u4f7f\u7528\u3057\u3066\u6b21\u306e\u30ab\u30d7\u30bb\u30eb\u5c64\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3059\u308b\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3067\u3059\u3002</p>\n<p>\u4ed6\u306e\u30e2\u30c7\u30eb\u306e\u5b9f\u88c5\u3068\u306f\u7570\u306a\u308a\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u3060\u3051\u3067\u306f\u4e00\u90e8\u306e\u6982\u5ff5\u3092\u7406\u89e3\u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u305f\u3081\u3001\u30b5\u30f3\u30d7\u30eb\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002</p><a href=\"mnist.html\">\u3053\u308c\u306f\u3001\u30ab\u30d7\u30bb\u30eb\u3092\u4f7f\u7528\u3057\u3066 MNIST \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u5206\u985e\u3059\u308b\u30e2\u30c7\u30eb\u306e\u6ce8\u91c8\u4ed8\u304d\u30b3\u30fc\u30c9\u3067\u3059\u3002</a>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001Capsule Networks \u306e\u30b3\u30a2\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5b9f\u88c5\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059\u3002</p>\n<p><a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">Jindongwang/Pytorch-Capsulenet\u3092\u4f7f\u3063\u3066</a>\u3001\u8ad6\u6587\u306b\u95a2\u3059\u308b\u6df7\u4e71\u3092\u89e3\u6d88\u3057\u307e\u3057\u305f\u3002</p>\n<p>\u3053\u308c\u306f\u3001MNIST\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3059\u308b\u305f\u3081\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3067\u3059\u3002</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a></p>\n",
|
||||
"Capsule Networks": "\u30ab\u30d7\u30bb\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"<h1><a href=\"https://nn.labml.ai/capsule_networks/index.html\">Capsule Networks</a></h1>\n<p>This is a <a href=\"https://pytorch.org\">PyTorch</a> implementation/tutorial of <a href=\"https://arxiv.org/abs/1710.09829\">Dynamic Routing Between Capsules</a>.</p>\n<p>Capsule network is a neural network architecture that embeds features as capsules and routes them with a voting mechanism to next layer of capsules.</p>\n<p>Unlike in other implementations of models, we've included a sample, because it is difficult to understand some concepts with just the modules. <a href=\"mnist.html\">This is the annotated code for a model that uses capsules to classify MNIST dataset</a></p>\n<p>This file holds the implementations of the core modules of Capsule Networks.</p>\n<p>I used <a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">jindongwang/Pytorch-CapsuleNet</a> to clarify some confusions I had with the paper.</p>\n<p>Here's a notebook for training a Capsule Network on MNIST dataset.</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a> </p>\n": "<h1><a href=\"https://nn.labml.ai/capsule_networks/index.html\">\u80f6\u56ca\u7f51\u7edc</a></h1>\n<p>\u8fd9\u662f<a href=\"https://arxiv.org/abs/1710.09829\">\u80f6\u56ca\u95f4\u52a8\u6001\u8def\u7531</a>\u7684 <a href=\"https://pytorch.org\">PyTorch</a> \u5b9e\u73b0/\u6559\u7a0b\u3002</p>\n<p>Capsule \u7f51\u7edc\u662f\u4e00\u79cd\u795e\u7ecf\u7f51\u7edc\u67b6\u6784\uff0c\u5b83\u4ee5\u80f6\u56ca\u7684\u5f62\u5f0f\u5d4c\u5165\u7279\u5f81\uff0c\u5e76\u901a\u8fc7\u6295\u7968\u673a\u5236\u5c06\u5b83\u4eec\u8def\u7531\u5230\u4e0b\u4e00\u5c42\u80f6\u56ca\u3002</p>\n<p>\u4e0e\u5176\u4ed6\u6a21\u578b\u5b9e\u73b0\u4e0d\u540c\uff0c\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u4e2a\u793a\u4f8b\uff0c\u56e0\u4e3a\u4ec5\u4f7f\u7528\u6a21\u5757\u5f88\u96be\u7406\u89e3\u67d0\u4e9b\u6982\u5ff5\u3002<a href=\"mnist.html\">\u8fd9\u662f\u4f7f\u7528\u80f6\u56ca\u5bf9 MNIST \u6570\u636e\u96c6\u8fdb\u884c\u5206\u7c7b\u7684\u6a21\u578b\u7684\u5e26\u6ce8\u91ca\u7684\u4ee3\u7801</a></p>\n<p>\u8be5\u6587\u4ef6\u5305\u542b\u4e86 Capsule Networks \u6838\u5fc3\u6a21\u5757\u7684\u5b9e\u73b0\u3002</p>\n<p>\u6211\u7528 <a href=\"https://github.com/jindongwang/Pytorch-CapsuleNet\">jindongwang/pytorch-CapsuleNet</a> \u6765\u6f84\u6e05\u6211\u5bf9\u8fd9\u7bc7\u8bba\u6587\u7684\u4e00\u4e9b\u56f0\u60d1\u3002</p>\n<p>\u8fd9\u662f\u4e00\u672c\u5728 MNIST \u6570\u636e\u96c6\u4e0a\u8bad\u7ec3 Capsule \u7f51\u7edc\u7684\u7b14\u8bb0\u672c\u3002</p>\n<p><a href=\"https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/capsule_networks/mnist.ipynb\"><span translate=no>_^_0_^_</span></a></p>\n",
|
||||
"Capsule Networks": "\u80f6\u56ca\u7f51\u7edc"
|
||||
}
|
||||
Reference in New Issue
Block a user