<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by totokk on Medium]]></title>
        <description><![CDATA[Stories by totokk on Medium]]></description>
        <link>https://medium.com/@totokk?source=rss-447c9c0e5ab7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Kny31OxMTzWobhuR3CDxTg.jpeg</url>
            <title>Stories by totokk on Medium</title>
            <link>https://medium.com/@totokk?source=rss-447c9c0e5ab7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 23:51:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@totokk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to train YOLO v2 on KITTI dataset.]]></title>
            <link>https://medium.com/@totokk/how-to-train-yolo-v2-on-kitti-dataset-f064476c1f84?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f064476c1f84</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 06:10:30 GMT</pubDate>
            <atom:updated>2018-11-05T06:12:42.265Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Download KITTI dataset</li><li>KITTI format to VOC format</li><li>Training</li></ol><p><a href="https://imgur.com/ES4HI8S">https://imgur.com/ES4HI8S</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f064476c1f84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to porting PyTorch Model to Tensorflow (easy case)-part1]]></title>
            <link>https://medium.com/@totokk/how-to-porting-pytorch-model-to-tensorflow-b3192e98179d?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3192e98179d</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Thu, 25 Jan 2018 10:10:40 GMT</pubDate>
            <atom:updated>2018-07-09T09:16:29.439Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Overview</strong></h4><p>Assume you have a PyTorch model, build two python scripts first. One is PyTorch .py, another is Tensorflow .py.</p><ol><li>Pytorch model: yourmodel.pth (architecture and parameters)</li><li>Tensorflow model: yourmodel.ckpt (architecture and parameters)</li></ol><h4>Parameter name</h4><p>This porting task is about two things: parameter and its names mapping.</p><p>Begin with parameter names, you have to know the 1–1 mapping rule between Pytorch and tensorflow op name.</p><p>For example, pytorch code:</p><pre>pretrained_model = pytorch_model.pytorch_model<br>pretrained_model= torch.nn.parallel.DataParallel(pretrained_model, device_ids = [0, 1])</pre><pre>save_path = &#39;&#39;  # your path here!<br>pretrained_dict = torch.load(save_path)<br>################### build torch_model_name.npy<br>temp = []<br>for k, v in pretrained_dict.items():<br>      print(k)<br>      temp.append(k)<br>temp_arr = np.asarray(temp)<br>np.save(file=&#39;torch_model_name&#39;, arr=temp_arr)</pre><p>Tensorflow code:</p><pre>--- of course, you need to build your model first. ---</pre><pre>####################<br> temp = []<br> # # Which variables to load.<br> model_restore_var = [v for v in tf.global_variables()]<br> for v in model_restore_var:<br>   print(v.name)<br>   temp.append(v.name)<br> temp_arr = np.asarray(temp)<br> np.save(file=’tf_model_name’, arr=temp_arr)<br> #####################</pre><p><strong>Now, I have two .npy files for the future use and can copy output to excel sheet to observe the the 1–1 mapping rule between Pytorch and tensorflow op name.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RxB8Gzz06EU5-twsiW78jw.png" /><figcaption><strong>Parameter names of pytorch (left) and tensorflow (right) in excel sheet</strong></figcaption></figure><p>The task here is to find the mapping rule, for example,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lCnrFNT_AcHT-EAcfCD37A.png" /><figcaption><strong>Parameter names of pytorch (left) and tensorflow (right) in excel sheet</strong></figcaption></figure><p>Given one specific pytorch parameter name “module.3.0.0.1.1.1.running_mean”, how do you mapping it to get the correct tensorflow parameter name?</p><p>Until now, it is a hand-crafted job. Maybe it can be automatic in future.<br>In my case, it is not hard to find out the mapping rule and write a function based on it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac4b43343b359d87c28b4cce8888c0b4/href">https://medium.com/media/ac4b43343b359d87c28b4cce8888c0b4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*33HUi9zCCdAaCqK16le2mw.png" /><figcaption>Partial code of name mapping function</figcaption></figure><p>The use of two .npy (torch_model_name.npy and tf_model_name.npy)is to check the above function for overall parameter names.</p><pre>## chk name mapping correctness<br>    torch_str = np.load(&#39;torch_model_name.npy&#39;, encoding=&#39;latin1&#39;)<br>    tf_str = np.load(&#39;tf_model_name.npy&#39;, encoding=&#39;latin1&#39;)<br>    i=0<br>    for torch_n in torch_str:<br>       if &#39;module.0&#39; not in torch_n:<br>           if &#39;module.4&#39; not in torch_n:<br>               if &#39;module.1&#39; not in torch_n:<br>                     ko = mapping_op(torch_n)<br>                            for tf_n in tf_str:<br>                               tf_n=tf_n.replace(&#39;:0&#39;, &#39;&#39;)<br>                               if ko==tf_n:<br>                                  print(&#39;ko ok&#39;, i)<br>                                  i=i+1</pre><p>Next, you have to know what kind of ops in your model and compare their output and usage.</p><p>For example, there are two major ops used in model to be porting.<br>1. conv<br>2. batch normalization</p><p>Reduce your model to <strong>only one op</strong> and rename this model as model_partial for both two framework (Here, there are Pytorch and tensorflow).</p><p>[1] <a href="https://github.com/mortezamg63/Accessing-and-modifying-different-layers-of-a-pretrained-model-in-pytorch">https://github.com/mortezamg63/Accessing-and-modifying-different-layers-of-a-pretrained-model-in-pytorch</a></p><p>Pytorch code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pIy4yO1D55N71gRmBnjwIw.png" /><figcaption>Pytorch model I wanna porting to tensorflow, full version!</figcaption></figure><pre><br>pretrained_model = pytorch_model.pytorch_model<br>pretrained_model= torch.nn.parallel.DataParallel(pretrained_model, device_ids = [0, 1])</pre><pre><em># BUILD new model for conv2d only<br>testMoudle = list(pretrained_model.modules())[2:3]<br>print(testMoudle)<br>######################################<br>new_model = nn.Sequential(*list(pretrained_model.modules())[2:3])<br>new_model = torch.nn.parallel.DataParallel(new_model, device_ids=[0 , 1])<br>######################################</em></pre><p>Again, do the same reduction to tensorflow model architecture:</p><p>Tensorflow code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8dzTsK_qPBaU7XjbKa_f2A.png" /><figcaption>Tensorflow model I wanna porting from Pytorch, partial version!</figcaption></figure><p>Then, build two python script, one is for pytorch inference (Here I call it pytorch_inference.py), another is for tensorflow inference(I call it tensorflow_inference.py) .</p><p>Note that the model here is for the computer vision task and basically accept one image as input. This image input have pre-processing and post-processing. We can use the same pre-processing and post-processing code form the original Github inference code or the original inference code you use in Pytorch.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3192e98179d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unsupervised Monocular Depth Estimation with Left-Right Consistency]]></title>
            <link>https://medium.com/@totokk/unsupervised-monocular-depth-estimation-with-left-right-consistency-e4a3c06b7df6?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4a3c06b7df6</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Wed, 26 Jul 2017 09:13:58 GMT</pubDate>
            <atom:updated>2017-10-01T17:55:22.995Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://hackmd.io/s/HkRA-rN8b#">Unsupervised Monocular Depth Estimation with Left-Right Consistency - HackMD</a></p><p>這是最近在看的論文，會再更新。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4a3c06b7df6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Faster-RCNN] Step-3 (End)]]></title>
            <link>https://medium.com/@totokk/faster-rcnn-step-3-end-f1b79c72e2a0?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1b79c72e2a0</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Tue, 04 Jul 2017 06:32:53 GMT</pubDate>
            <atom:updated>2017-07-05T01:43:56.918Z</atom:updated>
            <content:encoded><![CDATA[<p>目前該準備完的訓練資料都弄好了，接下來是<strong><em>放到適合的位置以及設定</em></strong>。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*6dbN599Culx0rglkioR1vw.png" /><figcaption>接下來的步驟</figcaption></figure><p>把每個 .xml 和 每一張圖 .bmp 個別丟到 data/VOCdevkit2007/VOC2007/Annotations(放.xml) 和 data/VOCdevkit2007/VOC2007/JPEGImage (放.bmp)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*U4DKofLy3SUE7PsxDYKA4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*6_Ph7MjpoiJZj3H-Ryt3BA.png" /></figure><p>remove py-faster- rcnn/data/VOCdevkit2007/annotations_cache/annots.pkl<br>remove py-faster-rcnn/data/cache/voc_2007_trainval_gt_roidb.pkl</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*JlwNW7W91zO8T7F1t5giOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*ocu-32hue6Fs8-lNl4bj_A.png" /></figure><p>到此，資料已經放到適當的位置。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*qCymcCc8rf7eudTfJuAGNg.png" /><figcaption>接下來的步驟</figcaption></figure><p>使用eric-caffe-tool/kaggle_fish_txt_written.py 產生 xml 的檔案，在 train.txt 中，打開 train.txt 並複製。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJcr8jtKlDxWj1jXVHTk0Q.png" /></figure><p>貼到下面四個檔案，注意舊內容要清空。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*NujEigyiSg6j43PA4R_Xwg.png" /></figure><p>這樣設定就完成了!</p><p>準備開始訓練:</p><p>以root 身分，在 /home/eric/Desktop/py-faster-rcnn 底下輸入:<br>./experiments/scripts/faster_rcnn_alt_opt.sh 0 ZF pascal_voc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*RBlRWMdpZmLw85OFd01BTA.png" /></figure><p>開始訓練!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*BdAtMGXg08ISzXvMXkyNCA.png" /><figcaption>Work !!!</figcaption></figure><p>注意: 要在 root 下執行，否則會 fail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*Rgg7l6RXWO3PRYl_2QPurg.png" /><figcaption>注意: 要在 root 下執行，否則會 fail.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1b79c72e2a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Faster-RCNN] Step-2]]></title>
            <link>https://medium.com/@totokk/faster-rcnn-step-2-a8922a2e51d3?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8922a2e51d3</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Mon, 03 Jul 2017 08:20:53 GMT</pubDate>
            <atom:updated>2017-07-03T08:20:53.843Z</atom:updated>
            <content:encoded><![CDATA[<p>目的: 先作 data augmentation (為了避免 overfitting)，label並產生 .xml 檔 (訓練需要)。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*NgYeDiEilmnDIH24Xav1tQ.png" /></figure><h3>Data augmentation</h3><p>使用程式 GT_cut 中的 Flip_folder_image 按鈕，不需要更改路徑，要處理的資料夾由使用者決定。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*-jyYTTpEXze2GBgZROUu4w.png" /><figcaption>使用程式 GT_cut 中的 Flip_folder_image 及Blur_folder_img 按鈕，不需要更改路徑</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*mWwpLQZiU4y3iIWxnOSjfw.png" /><figcaption>程式執行前，Output 資料夾。</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUFvmiv8T0SALbBJp9IX0A.png" /><figcaption>程式執行後，Output 資料夾，多出來的檔案就是Data augmentation的結果</figcaption></figure><h3>Labeling</h3><p>使用 labelImg。</p><p><a href="https://github.com/tzutalin/labelImg">GitHub - tzutalin/labelImg: 🖍️ LabelImg is a graphical image annotation tool and label object bounding boxes in images</a></p><p>打開 Output 中的 fake background 影像，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORRPVLPsdum2DDNClI85Mg.png" /></figure><p>使用左下按鈕，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/58/1*sW5cucoWdAf7sVnlF8BObg.png" /></figure><p>在任意區域拉框，完成後輸入 fake_background (一字不漏。如下。)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32CR0iGsDyvKRd_Vq7abLg.png" /><figcaption>輸入 fake_background (一字不漏。如下。)</figcaption></figure><p>存檔之後，要修改一個地方: 要以&lt;annotation&gt;開頭，以&lt;/annotation&gt;結尾。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/1*kS5jiC7a0Fju9PqBYak2fw.png" /></figure><p>修改前，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*wGCYGjmynXwXmUebjQ_ZXA.png" /></figure><p>修改後，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*gapUaoiEFxFiuPtfZ2n7DQ.png" /></figure><p>要注意:<br>- .xml檔的名字要和 .jpg(or .bmp)的名字一樣, e.g. 123.xml和 123.bmp, 111.xml和111.bmp。<br>- 產生的第一行 xml version = 1.0 要整行去掉。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8922a2e51d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Faster-RCNN] Step-1]]></title>
            <link>https://medium.com/@totokk/faster-rcnn-step-1-9e1fc8e0c936?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e1fc8e0c936</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Mon, 03 Jul 2017 03:34:09 GMT</pubDate>
            <atom:updated>2017-07-03T03:34:09.816Z</atom:updated>
            <content:encoded><![CDATA[<p>目的: <br>假設已經有一個訓練過的 model, 是用pre-trained model 加上自己準備的資料集訓練出來的。這個 model 於新影像預測出來的狀況，一定會有錯誤的地方(否則準確率就是100%了!)，現在要作的事情就是把 model 預測錯誤的地方，添加到資料集中的步驟。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*QUQRzMktoTRxc87H58dMHw.png" /><figcaption>把 model 預測錯誤的地方，添加到資料集中的步驟</figcaption></figure><p>現有資料及程式:<br>Ref 以及 WD_txt 都是現有資料，GT_cut 及 MergePoint 則是現有程式。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/94/1*q5J4UTd2gPIwqxVWP8ZcGg.png" /></figure><h3>要用到的資料</h3><p>在 Ref 檔案夾中，有全體區域的大圖 WD_all.jpg，也有局部區域圖 WD_A1.tif。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/1*OezgYnLXLCJsuivTrvZHNw.png" /></figure><p>在 WD_txt 檔案夾中，裡面是舊 model 預測出來的目標座標，裡面有預測正確的點座標，也有預測不正確的點。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*DNyE_S_j6GyxFoTp54zrOg.png" /><figcaption>WD_txt 檔案夾中，裡面是舊 model 預測出來的目標座標，裡面有預測正確的點座標，也有預測不正確的點。</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*WBh05G3gQboghveDofqmyQ.png" /><figcaption>A1, A2 等等，是大圖中的不同分區。</figcaption></figure><p>以上是要用到的資料。</p><h3>操作</h3><ol><li>因為要檢查舊model預測不正確的點座標，所以要把舊model所有預測的點座標畫在原圖，並與原圖人工比對。</li><li>如果點座標在我們想辨識的物體上，該點座標就是舊model正確的預測，如果點座標在我們不想辨識的區域上，該點座標就是舊model錯誤的預測，必須將該點座標的區域剪下，作為fake background。</li></ol><p>操作1: 為了將舊model所有預測的點座標畫在原圖，先將WD_txt 檔案夾中的各小分區的點座標(每一小分區就是一個 .txt 檔)，合成為一個 .txt 檔。</p><p>使用 \MergePoint 檔案夾中的MergePoint.sln，適當更改路徑及檔名後執行Merge 按鈕，就可以在 Output 檔案夾中產生 After_merge.txt，這是整張大圖的點座標 txt 檔。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*rv7feiM4j0HJ_DcGZ4Xjdw.png" /><figcaption>於Merge 按鈕的程式碼，適當更改完路徑及檔名</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*ZgXRHvFRrQ0Hga_YkatK0Q.png" /><figcaption>於Merge 按鈕的程式碼，適當更改完路徑及檔名之後執行Merge 按鈕，可以在 Output 檔案夾中產生 After_merge.txt</figcaption></figure><p>接下來，於 Draw 按鈕的程式碼，適當更改完路徑及檔名之後執行 Draw 按鈕，可以在 Output 檔案夾中產生 All_result.jpg。</p><p>若用 IrfanView 觀察 All_result.jpg，可看到 紅色點座標的位置，有點模糊的原因是縮小倍數以及 .jpg 壓縮的關係。</p><p>操作2: 用 IrfanView 觀察局部區域圖 WD_A1.tif (等等要複製其中某個區域)，同時用Win 相片檢視器觀察All_result.jpg，找出舊model錯誤的預測區域，並將該點座標的區域剪下貼到小畫家並存成 .bmp 檔，來作為 fake background。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pmRO5HI0xYORsV9oWe7dQ.png" /><figcaption>黑色圈出的區域即為舊model錯誤的預測區域</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*apqz-72XYgrJTD3eYEnM0g.png" /><figcaption>找出舊model錯誤的預測區域，並將該點座標的區域剪下貼到小畫家並存成 .bmp 檔，來作為 fake background。</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e1fc8e0c936" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Faster-RCNN] 植物辨識]]></title>
            <link>https://medium.com/@totokk/cnn-faster-rcnn-964300c58de8?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/964300c58de8</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Mon, 26 Jun 2017 07:52:44 GMT</pubDate>
            <atom:updated>2017-07-04T06:38:58.300Z</atom:updated>
            <content:encoded><![CDATA[<p>這是用 Caffe 的 Faster RCNN ,加上自己做的資料集，來辨識特定樹種的結果。最近比較忙，之後再慢慢來寫技術細節，如果有人很急可以留言催稿一下。</p><p>另外，辨識的數量很容易就以萬來當單位，所以如果有人懷疑是不是用小畫家來點樹的，我會把這種懷疑當作最高級的恭維。</p><p>不過我相信這東西應該很多公司都有在作了吧？ 至少 google 都開放API了。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AWVc86_1chc7M-F1CIOrBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BVkG1_uJ7zGQscQE_Yeung.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XjK-eKPGNtaFC_txMnHnBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5hSAMqQd_1gmqnpr561GQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=964300c58de8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Caffe2 ]BNN]]></title>
            <link>https://medium.com/@totokk/170615-89ee6399d3c6?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/89ee6399d3c6</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Mon, 19 Jun 2017 08:33:01 GMT</pubDate>
            <atom:updated>2017-07-04T02:30:43.398Z</atom:updated>
            <content:encoded><![CDATA[<p>[Caffe2 ]BNN</p><p>移植Theano版本BNN到Caffe2版本，部份的簡單筆記:</p><pre>fc3 = brew.fc(model, pool2, &#39;fc3&#39;, 50 * 4 * 4, 500)<br>fc3 = brew.relu(model, fc3, fc3)</pre><p>brew.fc(model, blob_in, blob_out,dim_in, dim_out,)<br>blob_out 以 &#39;fc3&#39;命名</p><p>———</p><p><a href="https://github.com/MatthieuCourbariaux/BinaryNet/blob/master/Train-time/binary_net.py">MatthieuCourbariaux/BinaryNet</a></p><p>目標： 理解下面Round3類別(四捨五入類別)的含意及使用方式。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*rZzjat_asKOCxxF3b4PbuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*YeGga42cMLFVB_EgqHrPkA.png" /></figure><p>Theano的疑問筆記：<br>功能為何?<br>這種功能如何移植到 Caffe2?<br>1.</p><p>from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams</p><p>這是為了產生及使用隨機數</p><p>2.<br><strong>from theano.scalar.basic import UnaryScalarOp, same_out_nocomplex<br>from theano.tensor.elemwise import Elemwise</strong><br>因為round3需要上述功能</p><p>UnaryScalarOp([d, name, _proxy]) ：Theano wrapper for functions of a single variable that can compute their own derivative via a flag d.<br>應該是計算自己的微分，經由flag d.</p><p>same_out_nocomplex：應該是輸出不要是複數的意思</p><p>Elemwise:對每個元素都做相同操作<br> (if you want to apply this to arrays)</p><p>class Round3(UnaryScalarOp): …<br>Round3 子類別<br>UnaryScalarOp 父類別 <br>Round3繼承UnaryScalarOp</p><p>3.</p><p><a href="http://deeplearning.net/software/theano/extending/op.html#grad">Making arithmetic Ops on double - Theano 0.9.0 documentation</a></p><p>— — — — — — —</p><p>c_code(<em>node</em>, <em>name</em>, <em>input_names</em>, <em>output_names</em>, <em>sub</em>)</p><p>node: 現在的Op的應用，有一連串的輸入及輸出<br>name: <br>input_names: op儲存了幾個輸入，input_names就儲存了幾個字串。比如說，C變數的名字，input_names[0]代表第一個op的輸入，你應該要使用這個名字在你的C code,來與該變數交流。<br>sub: 是儲存給C code方法使用的參數的字典。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89ee6399d3c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Python] Comment shortcut]]></title>
            <link>https://medium.com/@totokk/python-comment-shortcut-b20ec14d932b?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b20ec14d932b</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Fri, 02 Jun 2017 07:54:35 GMT</pubDate>
            <atom:updated>2017-06-02T07:54:35.460Z</atom:updated>
            <content:encoded><![CDATA[<p>Reading “Branching and Iteration” from</p><p><a href="https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/lecture-slides-code/">https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/lecture-slides-code/</a></p><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Spyder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*d_fnhoY_-vRrHL0xzf9O0Q.png" /></figure><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Difference between Python 2.7 and Python 3</p><pre>text = input(“Type anything… “)</pre><pre>‘right’</pre><p>If you wanna input a string into variable text, you should add<strong> ‘ ’ </strong>.</p><p>Assume you just key in <strong>right, </strong>you will get error message.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b20ec14d932b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[NV] How to check CUDA and cuDNN version]]></title>
            <link>https://medium.com/@totokk/nv-how-to-check-cuda-and-cudnn-version-e05aa21daf6c?source=rss-447c9c0e5ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e05aa21daf6c</guid>
            <dc:creator><![CDATA[totokk]]></dc:creator>
            <pubDate>Fri, 02 Jun 2017 03:23:40 GMT</pubDate>
            <atom:updated>2019-01-31T03:22:27.691Z</atom:updated>
            <content:encoded><![CDATA[<pre>cat /usr/local/cuda/version.txt<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*EKruuRs_Dz9PGrxX0MAh5Q.png" /></figure><p>If the script above doesn’t work, try this:</p><pre>nvcc  --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*6I0hthO4SHao_0yrUe1wxA.png" /></figure><pre><br>cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2</pre><pre>or</pre><pre>cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*FS_Nsd1qcuKpCh_W8XsWHQ.png" /></figure><p>To check GPU Card info, deep learner might use this all the time.</p><pre>nvidia-smi</pre><p>The following result tell us that: you have three GTX-1080ti, which are gpu0, gpu1, gpu2.</p><p>Gpu1 is running by other people.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OlVd0rhHrn0LXdFFEBZ-yQ.png" /></figure><p>Python (Show what version of tensorflow in your PC.)</p><pre>python -c &#39;import tensorflow as tf; print(tf.__version__)&#39;  <br># for Python 2<br>python3 -c &#39;import tensorflow as tf; print(tf.__version__)&#39;  <br># for Python 3</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e05aa21daf6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>