-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeed.xml
More file actions
3647 lines (2488 loc) · 208 KB
/
feed.xml
File metadata and controls
3647 lines (2488 loc) · 208 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Libo's Blog</title>
<description>Libo Blog</description>
<link>http://next.sh/</link>
<atom:link href="http://next.sh/feed.xml" rel="self" type="application/rss+xml"/>
<pubDate>Fri, 10 Jun 2016 16:19:02 +0000</pubDate>
<lastBuildDate>Fri, 10 Jun 2016 16:19:02 +0000</lastBuildDate>
<generator>Jekyll v2.5.3</generator>
<item>
<title>需要看的论文们</title>
<description><p>一共837页</p>
<div class="highlight"><pre><code class="language-text" data-lang="text">页数 论文名
9 A Few Useful Things to Know about Machine Learning
5 ADVANCES IN OPTIMIZING RECURRENT NETWORKS
39 Adaptive Subgradient Methods for Online Learning and Stochastic Optimization
9 An Empirical Exploration of Recurrent Network Architectures
8 Backpropagation, Intuitions
11 Batch Normalization-Accelerating Deep Network Training by Reducing Internal Covariate Shift
9 Beyond Short Snippets-Deep Networks for Video Classification
8 CNN Features off-the-shelf- an Astounding Baseline for Recognition
14 Convolutional Neural Networks- Architectures, Convolution, Pooling Layers
10 DeCAF-A Deep Convolutional Activation Feature
8 Deep Inside Convolutional Networks-Visualising Image Classification Models and Saliency Maps
6 Deep Learning using Linear Support Vector Machines
12 Deep Residual Learning for Image Recognition
8 DeepFace-Closing the Gap to Human-Level Performance in Face Verification
8 Deformable Part Models are Convolutional Neural Networks
11 Delving Deep into Rectifiers
11 Delving Deeper into Convolutional Networks for Learning Video Representations
9 Distributed Representations of Words and Phrases
9 Do Convnets Learn Correspondence
9 Dropout Training as Adaptive Regularization
30 Dropout- A Simple Way to Prevent Neural Networks from Overfitting
11 EXPLAINING AND HARNESSING ADVERSARIAL EXAMPLES
44 Efficient BackProp
9 Fast R-CNN
13 Fast large-scale optimization by unifying stochastic gradient and quasi-Newton methods
14 Faster R-CNN- Towards Real-Time Object Detection with Region Proposal Networks
12 Going Deeper with Convolutions
4 Hessian matrix - Wikipedia, the free encyclopedia
14 How transferable are features in deep neural networks
10 Image Classification- Data-driven Approach, k-Nearest Neighbor, train:val:test splits
9 ImageNet Classification with Deep Convolutional
43 ImageNet Large Scale Visual Recognition Challenge
10 Intriguing properties of neural networks
18 LSTM- A Search Space Odyssey
11 Large Scale Distributed Deep Networks
8 Large-scale Video Classification with Convolutional Neural Networks
16 Learning Spatiotemporal Features with 3D Convolutional Networks
12 Linear classification- Support Vector Machine, Softmax
13 Long-term Recurrent Convolutional Networks for Visual Recognition and Description
9 Maxout Networks
8 Neural Networks Part 1- Setting up the Architecture
10 Neural Networks Part 2- Setting up the Data and the Loss
12 Neural Networks Part 3- Learning and Evaluation
12 On the difficulty of training Recurrent Neural Networks
9 Optimization- Stochastic Gradient Descent
16 OverFeat-Integrated Recognition, Localization and Detection using Convolutional Networks
33 Practical Recommendations for Gradient-Based Training of Deep Arch
25 Random Search for Hyper-Parameter Optimization
21 Rich feature hierarchies for accurate object detection and semantic segmentation
14 STRIVING FOR SIMPLICITY- THE ALL CONVOLUTIONAL NET
14 Selective Search for Object Recognition
22 Show, Attend and Tell- Neural Image Caption Generation with Visual Attention
16 Stochastic Gradient Descent Tricks
2 Transfer Learning
11 Two-Stream Convolutional Networks for Action Recognition in Videos
9 Understanding Deep Image Representations by Inverting Them
5 Understanding and Visualizing Convolutional Neural Networks
8 Understanding the difficulty of training deep feedforward neural networks
13 Unit Tests for Stochastic Optimization
14 Very Deep Convolutional Networks for Large-Scale Image Recognition
11 Visualizing and Understanding Convolutional Networks
6 What I learned from competing against a ConvNet on ImageNet
16 What makes for effective detection proposals
7 video process</code></pre></div>
</description>
<pubDate>Sun, 03 Apr 2016 23:39:51 +0000</pubDate>
<link>http://next.sh/blog/2016/04/03/those-thesis/</link>
<guid isPermaLink="true">http://next.sh/blog/2016/04/03/those-thesis/</guid>
<category>Thesis</category>
<category>Deep Learning</category>
<category>CNN</category>
<category>deep</category>
<category>learning</category>
</item>
<item>
<title>视频处理笔记</title>
<description><p>Feature-based approaches to Activity Recognition</p>
<p><strong>Dense trajectories and motion boundary descriptors for action recognition</strong></p>
<p>Wang et al., 2013</p>
<p>Action Recognition with Improved Trajectories</p>
<p>Wang and Schmid, 2013</p>
<p>用来track视频中什么有变化</p>
<p>[T. Brox and J. Malik, “Large displacement optical flow: Descriptor matching in variational motion estimation,” 2011]</p>
<p><img src="/images/2016-03-27-one-idea-of-convnet.png" alt="flow" /></p>
<p>Q: What if the input is now a small chunk of video? E.g. [227x227x3x15] ?</p>
<p>A: Extend the convolutional filters in time, perform spatio-temporal convolutions!E.g. can have 11x11xT filters, where T = 2..15.</p>
<p>filter不仅在空间上移动,还在时间上移动</p>
<h2 id="spatio-temporal-convnets">Spatio-Temporal ConvNets</h2>
<p>Before AlexNets
[3D Convolutional Neural Networks for Human Action Recognition, Ji et al., 2010]</p>
<p>[Sequential Deep Learning for Human Action Recognition, Baccouche et al., 2011]</p>
<p>After</p>
<p>[Large-scale Video Classification with Convolutional Neural Networks, Karpathy et al., 2014]</p>
<p><img src="/images/2016-03-27-spatio-temporal-video.png" alt="spatio-temporal convolutions" /></p>
<p>Single Frame -&gt;非常好的一种,比较推荐先尝试这个</p>
<p><img src="/images/2016-03-27-frame-diff-performance.png" alt="Model &amp;&amp; Gain" /></p>
<hr />
<p>C3D architechure</p>
<p>in time &amp; VGG &amp; work well</p>
<p>[Learning Spatiotemporal Features with 3D Convolutional Networks, Tran et al. 2015]</p>
<hr />
<p>2D convolution</p>
<p>Simonyan 是VGG的提出人</p>
<p>[Two-Stream Convolutional Networks for Action Recognition in Videos, Simonyan and Zisserman 2014]</p>
<p>Two-stream version works much better than either alone.</p>
<h3 id="longer-term-events">Longer Term Events</h3>
<p>使用LSTM</p>
<p>[Long-term Recurrent Convolutional Networks for Visual Recognition and Description, Donahue et al., 2015]</p>
<p>[Beyond Short Snippets: Deep Networks for Video Classification, Ng et al., 2015]</p>
<h4 id="section">奇葩!!!</h4>
<p>(This paper was way ahead of its time. Cited 65 times.)</p>
<p>Sequential Deep Learning for Human Action Recognition, Baccouche et al., 2011</p>
<h2 id="section-1">三种构架</h2>
<ul>
<li>Model temporal motion locally (3D CONV)</li>
<li>Model temporal motion globally (LSTM / RNN)</li>
<li>Fusions of both approaches at the same</li>
</ul>
<p>idea:快进快退</p>
<h2 id="long-time-spatio-temporal-convnets">Long-time Spatio-Temporal ConvNets</h2>
<p>[Delving Deeper into Convolutional Networks for Learning Video Representations, Ballas et al., 2016]</p>
<p>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
很重要,这个应该能用</p>
<p>GRU是一个LSTM的简化算法</p>
<p><img src="/images/2016-03-27-long-time-spatio-temporal.png" alt="long time spatio temporal convnets" /></p>
<p>Infinite (in theory) temporal extent</p>
<p>(neurons that are function of all video frames in the past)</p>
<h3 id="section-2">注意</h3>
<p>在做视频的时候,事先考虑Spatial Temporal Video ConvNet</p>
<p>确定需要local motion(3D Conv)还是global motion(LSTM)</p>
<p>Try out using Optical Flow in a second stream</p>
<p>Try out GRU-RCN! (imo best model)</p>
<h1 id="unsupervised">Unsupervised</h1>
<p>Clustering, dimensionality reduction, feature learning, generative models, etc</p>
<p>Autoencoders</p>
<ul>
<li>Vanilla Traditional: feature learning</li>
<li>Variational: generate samples</li>
</ul>
<p>● Generative Adversarial Networks: Generate samples</p>
<h2 id="encoder">Encoder</h2>
<p>输入Data,经过Encoder,然后去找Features</p>
<p>Feature一般比Data小,所以可以用于降维</p>
<p>然后通过Decoder,然后通过Features重建Input Data</p>
<p>Decoder和Encoder 的Weight是共享的</p>
<hr />
<ul>
<li>
<p>After training, throw away decoder!</p>
</li>
<li>
<p>Use encoder to initialize a supervised model</p>
</li>
</ul>
<hr />
<p>三层NN,不过输入输出一样,因为需要中间的Features,要用到其他地方</p>
<p>PCA可以解决一部分,更多是Reconstruction</p>
<h2 id="variational-autoencoder-encoder">Variational Autoencoder: Encoder</h2>
<p>Kingma and Welling, “Auto-Encoding Variational Bayes”, ICLR 2014</p>
<p><img src="/images/2016-03-27-var-encoder.png" alt="Encoder" /></p>
<p><img src="/images/2016-03-27-var-autoencoder.png" alt="Variational Autoencoder" /></p>
<p>完全没听懂==</p>
<p><img src="/images/2016-03-27-math.png" alt="no idea" /></p>
<p>Goodfellow et al, “Generative Adversarial Nets”, NIPS 2014</p>
<h3 id="generative-adversarial-nets-multiscale">Generative Adversarial Nets: Multiscale</h3>
<p>Generator is an upsampling network with fractionally-strided convolutions</p>
<p>Discriminator is a convolutional network</p>
<p>Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016</p>
<p>!!!!!!!!!!!!
超牛逼</p>
<p>Radford et al,ICLR 2016</p>
<h3 id="generative-adversarial-nets-vector-math">Generative Adversarial Nets: Vector Math</h3>
<p><img src="/images/2016-03-27-generate-smile.png" alt="smile" /></p>
<p><img src="/images/2016-03-27-generate-glass.png" alt="glass" /></p>
<h2 id="put-everything-together">Put everything together</h2>
<p>Dosovitskiy and Brox, “Generating Images with Perceptual Similarity Metrics based on Deep Networks”,arXiv 2016</p>
</description>
<pubDate>Sun, 27 Mar 2016 11:01:39 +0000</pubDate>
<link>http://next.sh/blog/2016/03/27/lecture-14-video-and-unsupervised-learning-stanford-cs231n/</link>
<guid isPermaLink="true">http://next.sh/blog/2016/03/27/lecture-14-video-and-unsupervised-learning-stanford-cs231n/</guid>
<category>Machine Learning</category>
<category>Deep Learning</category>
<category>CNN</category>
<category>deep</category>
<category>learning</category>
</item>
<item>
<title>分割、Attention Model与空间变化 笔记</title>
<description><p>Szegedy et al, Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning, arXiv 2016</p>
<p>GoogLeNet-v4</p>
<p>Top 5,error 3.08%</p>
<hr />
<h1 id="segmentation">Segmentation</h1>
<ul>
<li>
<p>Semantic Segmentation(不知道有几个,只是对每个像素label了)</p>
</li>
<li>
<p>Instance Segmentation(SDS,对每个个体都要区分,不同的人也要分)</p>
</li>
</ul>
<h2 id="semantic-segmentation">Semantic Segmentation</h2>
<p>Figure credit: Shotton et al, “TextonBoost for Image Understanding: Multi-Class Object Recognition and Segmentation by Jointly Modeling Texture, Layout, and Context”, IJCV 2007</p>
<h2 id="instance-segmentation">Instance Segmentation</h2>
<p>Figure credit: Dai et al, “Instance-aware Semantic Segmentation via Multi-task Network Cascades”, arXiv 2015</p>
<h1 id="semantic-segmentation-1">Semantic Segmentation</h1>
<p>输出图像因为Pooling,会比之前的小</p>
<h3 id="image-pyramid">image pyramid</h3>
<p>Resize to multiple different sizes</p>
<p>each scales -&gt; run one cnn per scale -&gt; up scale ouputs and concatenate</p>
<p>法2</p>
<p>RGB三个通道</p>
<p>Apply CNN once</p>
<p>More iterations improve results</p>
<p>Pinheiro and Collobert, “Recurrent Convolutional Neural Networks for Scene Labeling”, ICML 2014</p>
<hr />
<p>Long, Shelhamer, and Darrell, “Fully Convolutional Networks for Semantic Segmentation”, CVPR 2015</p>
<p><strong>Learnable upsampling!</strong></p>
<h4 id="skip-connections">skip connections</h4>
<p>Better results</p>
<p>从pool3或者pool4跳到最后</p>
<p><img src="/images/2016-03-27-sematic-upsampling-deconvolution.png" alt="upsampling" /></p>
<h3 id="deconvolution">Deconvolution</h3>
<p>!!!Input gives weight for filter</p>
<p>convolution的时候,stride1,deconvolution的时候stride2</p>
<p>重叠的地方,相加</p>
<p>Same as backward pass for normal convolution!</p>
<p>“inverse of convolution”</p>
<p>名字:</p>
<p>convolution transpose,backward strided convolution,1/2 strided convolution,upconvolution</p>
<p>名字的争论的论文。。。。</p>
<ul>
<li>Im et al, “Generating images with recurrent adversarial networks”, arXiv 2016</li>
<li>Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016</li>
</ul>
<h2 id="instance-segmentation-1">Instance Segmentation</h2>
<p>Input-&gt;Region Proposal (Segment Proposal) -&gt; External Segment proposal</p>
<p>然后两条路,一条Feature Extraction另一条 R-CNN</p>
<p>-&gt;Region CLassification</p>
<p>-&gt;Refinement</p>
<hr />
<p>判断foreground还是background</p>
<p>Hariharan et al, “Hypercolumns for Object Segmentation and Fine-grained Localization”, CVPR 2015</p>
<hr />
<p>Google Instance Segmentation COCO2015获胜</p>
<p>Dai et al, “Instance-aware Semantic Segmentation via Multi-task Network Cascades”, arXiv 2015</p>
<p>Region proposal network (RPN)</p>
<p>然后使用Rol warping pooling</p>
<p><img src="/images/2016-03-27-r-cnn-instance-seg-coco2015.png" alt="faster R-CNN &amp;&amp; other to captioning" /></p>
<p><img src="/images/2016-03-27-coco-2015-performance.png" alt="COCO 2015 performance" /></p>
<h1 id="attention-models">Attention Models</h1>
<p>Attention Models</p>
<p>每次处理并不是全部处理所有的Input,每次处理只处理最Attention的那部分</p>
<p>最近很火</p>
<p><strong>Xu et al, “Show, Attend and Tell: Neural Image Caption Generation with Visual Attention”, ICML 2015</strong></p>
<p>R-CNN</p>
<p><img src="/images/2016-03-27-rcnn-captioning.png" alt="R-CNN" /></p>
<p>Soft Attention</p>
<p><img src="/images/2016-03-27-soft-attention-for-captioning.png" alt="Soft Attention" /></p>
<p><strong>reinforcement learning</strong></p>
<p>但是不知道在自由图片上的效果</p>
<h2 id="soft-attention-for-translation">Soft Attention for Translation</h2>
<p>Sequence -&gt; Sequence</p>
<p>Video captioning,attention over input frames:</p>
<ul>
<li>Yao et al, “Describing Videos by Exploiting Temporal Structure”, ICCV 2015</li>
</ul>
<p>Image, question to answer,attention over image:</p>
<ul>
<li>
<p>Xu and Saenko, “Ask, Attend and Answer: Exploring Question-Guided Spatial Attention for Visual Question Answering”, arXiv 2015</p>
</li>
<li>
<p>Zhu et al, “Visual7W: Grounded Question Answering in Images”, arXiv 2015</p>
</li>
</ul>
<h3 id="rnn-handwriting">RNN handwriting</h3>
<p>Graves, “Generating Sequences with Recurrent Neural Networks”, arXiv 2013</p>
<p>Demo <a href="http://www.cs.toronto.edu/~graves/handwriting.html">http://www.cs.toronto.edu/~graves/handwriting.html</a></p>
<h2 id="spatial-transformer-networks">Spatial Transformer Networks</h2>
<p>Jaderberg et al, “Spatial Transformer Networks”, NIPS 2015</p>
<p>Soft attention:</p>
<ul>
<li>Easy to implement: produce distribution over input locations, reweight features and feed as input</li>
<li>Attend to arbitrary input locations using spatial transformer networks</li>
</ul>
<p>Hard attention:</p>
<ul>
<li>Attend to a single input location</li>
<li>Can’t use gradient descent!</li>
<li>Need reinforcement learning</li>
</ul>
<p><strong>Selectively paying attention to different parts of the image</strong></p>
</description>
<pubDate>Sat, 26 Mar 2016 16:09:21 +0000</pubDate>
<link>http://next.sh/blog/2016/03/26/lecture-13-segmentation-and-attention-stanford-cs231n/</link>
<guid isPermaLink="true">http://next.sh/blog/2016/03/26/lecture-13-segmentation-and-attention-stanford-cs231n/</guid>
<category>Machine Learning</category>
<category>Deep Learning</category>
<category>CNN</category>
<category>deep</category>
<category>learning</category>
</item>
<item>
<title>Caffe Torch TensorFlow</title>
<description><p>Written in C++</p>
<p>Has Python and MATLAB bindings</p>
<p>Good for training or finetuning feedforward model</p>
<h2 id="caffe">Caffe</h2>
<p>不需要写代码有时候==,例如ResNet</p>
<p>Document可能outdated</p>
<p>Four Major Classes:</p>
<ul>
<li>Blob : Stores data and derivatives(weights,data,labels) [data diffs],[gpu cpu]</li>
<li>Layer : input(bottom) blob -&gt; output(top) blob.</li>
<li>Net : Many Layers. computes gradients via forward/backward</li>
<li>Solver : Uses gradients to update weights</li>
</ul>
<h1 id="protocol-buffers">Protocol Buffers</h1>
<ul>
<li>Typed Json from google</li>
<li>Define “message types” in .proto files</li>
<li>Serialize instances to text files .prototxt</li>
<li>Compile classes for different languages</li>
</ul>
<h2 id="caffe-training--finetuning">Caffe: Training / Finetuning</h2>
<p>No need to write code!</p>
<ol>
<li>Convert data (run a script)</li>
<li>Define net (edit prototxt)</li>
<li>Define solver (edit prototxt)</li>
<li>Train (with pretrained weights) (run a script)</li>
</ol>
<h3 id="convert-data">Convert Data</h3>
<p>LMDB:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="o">[</span>path/to/image.jpeg<span class="o">]</span> <span class="o">[</span>label<span class="o">]</span></code></pre></div>
<p>DataLayer 直接从LMDB读是最方便的</p>
<p>用<a href="https://github.com/BVLC/caffe/blob/master/tools/convert_imageset.cpp">https://github.com/BVLC/caffe/blob/master/tools/convert_imageset.cpp</a>来创建LMDB</p>
<p>使用h5py去创建HDF5</p>
<ul>
<li>ImageDataLayer: Read from image files</li>
<li>WindowDataLayer: For detection</li>
<li>HDF5Layer: Read from HDF5 file</li>
<li>From memory, using Python interface</li>
<li>All of these are harder to use (except Python)</li>
</ul>
<h3 id="define-net">Define Net</h3>
<p><strong>.prototxt can get ugly for big models</strong></p>
<p>ResNet-152 prototxt is 6775 lines long!</p>
<p>一般可以来写Python来生成</p>
<hr />
<h4 id="prototxt">直接修改 prototxt</h4>
<p>Same name: weights copied</p>
<p>Different name: weights reinitialized</p>
<h3 id="define-solver">Define Solver</h3>
<p>If finetuning, copy existing solver. prototxt file</p>
<ul>
<li>Change net to be your net</li>
<li>Change snapshot_prefix to your output</li>
<li>Reduce base learning rate (divide by 100)</li>
<li>Maybe change max_iter and snapshot</li>
</ul>
<p>例如learning rate,可以改成几个值,然后去用</p>
<h3 id="train">Train</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">./build/tools/caffe train <span class="se">\</span>
-gpu <span class="m">0</span> <span class="se">\</span>
-model path/to/trainval.prototxt <span class="se">\</span>
-solver path/to/solver.prototxt <span class="se">\</span>
-weights path/to/pretrained_weights.caffemodel</code></pre></div>
<p>-gpu -1 是CPU mode</p>
<p>-gpu all 是多GPU 并行</p>
<h2 id="model-zoo">Model Zoo</h2>
<p>AlexNet, VGG, GoogLeNet, ResNet, plus others</p>
<h2 id="caffe-python-interface">Caffe: Python Interface</h2>
<p>Not much documentation…</p>
<p>Read the code! Two most important files:</p>
<p>● caffe/python/caffe/_caffe.cpp:</p>
<p>○ Exports Blob, Layer, Net, and Solver classes</p>
<p>● caffe/python/caffe/pycaffe.py</p>
<p>○ Adds extra methods to Net class</p>
<p>Good for:</p>
<ul>
<li>Interfacing with numpy</li>
<li>Extract features: Run net forward</li>
<li>Compute gradients: Run net backward (DeepDream, etc)</li>
<li><strong>Define layers</strong> in Python with numpy (CPU only)</li>
</ul>
<p>如果定义layer的话,只能是CPU的</p>
<p><strong>注意下⬆️这里</strong></p>
<h2 id="caffe-pros--cons">Caffe Pros / Cons</h2>
<ul>
<li>(+) Good for feedforward networks</li>
<li>(+) Good for finetuning existing networks</li>
<li>(+) Train models without writing any code!</li>
<li>
<p>(+) Python interface is pretty useful!</p>
</li>
<li>(-) Need to write C++ / CUDA for new GPU layers(在Caffe上写新的Layer很麻烦)</li>
<li>(-) Not good for recurrent networks
= (-) Cumbersome for big networks (GoogLeNet, ResNet)</li>
</ul>
<h1 id="torch">Torch</h1>
<ul>
<li>From NYU + IDIAP</li>
<li>Written in C and Lua</li>
<li>Used a lot a Facebook, DeepMind</li>
</ul>
<p>在GPU上运行超简单</p>
<h3 id="lua">必须用Lua来写</h3>
<p><a href="http://tylerneylon.com/a/learn-lua/">15分钟学会Lua</a></p>
<h3 id="tensors-like-numpy-arrays">Tensors like numpy arrays</h3>
<div class="highlight"><pre><code class="language-lua" data-lang="lua"><span class="nb">require</span> <span class="s1">&#39;</span><span class="s">cutorch&#39;</span>
<span class="nb">require</span> <span class="s1">&#39;</span><span class="s">cunn&#39;</span>
<span class="kd">local</span> <span class="n">dtype</span> <span class="o">=</span> <span class="s1">&#39;</span><span class="s">torch.CudaTensor&#39;</span>
<span class="p">:</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span></code></pre></div>
<p><a href="https://github.com/torch/torch7/blob/master/doc/tensor.md">https://github.com/torch/torch7/blob/master/doc/tensor.md Document</a></p>
<h2 id="torch--nn">Torch :: nn</h2>
<p>nn module lets you easily build and train neural nets</p>
<p>Build a two-layer ReLU net</p>
<h2 id="torch--cunn">Torch : cunn</h2>
<p>Import a few new packages</p>
<div class="highlight"><pre><code class="language-lua" data-lang="lua"><span class="nb">require</span> <span class="s1">&#39;</span><span class="s">torch&#39;</span>
<span class="nb">require</span> <span class="s1">&#39;</span><span class="s">cutorch&#39;</span>
<span class="nb">require</span> <span class="s1">&#39;</span><span class="s">nn&#39;</span>
<span class="nb">require</span> <span class="s1">&#39;</span><span class="s">cunn&#39;</span></code></pre></div>
<p>Cast network and criterion</p>
<div class="highlight"><pre><code class="language-lua" data-lang="lua"><span class="n">net</span><span class="p">:</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span>
<span class="n">crit</span><span class="p">:</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span></code></pre></div>
<p>Cast data and labels</p>
<div class="highlight"><pre><code class="language-lua" data-lang="lua"><span class="kd">local</span> <span class="n">x</span> <span class="o">=</span> <span class="n">torch</span><span class="p">.</span><span class="n">randn</span><span class="p">(</span><span class="n">N</span><span class="p">,</span><span class="n">D</span><span class="p">):</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span>
<span class="kd">local</span> <span class="n">y</span> <span class="o">=</span> <span class="n">torch</span><span class="p">.</span><span class="n">randn</span><span class="p">(</span><span class="n">N</span><span class="p">).</span><span class="n">random</span><span class="p">(</span><span class="n">C</span><span class="p">):</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span></code></pre></div>
<h2 id="torch-optim">Torch: optim</h2>
<p>update rules: momentum, Adam, etc</p>
<p>Import optim package</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">requre <span class="s1">&#39;optim&#39;</span></code></pre></div>
<p>Write a callback function that returns loss and gradients</p>
<p>state variable holds hyperparameters, cached values, etc; pass it to adams</p>
<div class="highlight"><pre><code class="language-lua" data-lang="lua"><span class="n">optim</span><span class="p">.</span><span class="n">adm</span><span class="p">(</span><span class="n">f</span><span class="p">,</span><span class="n">weights</span><span class="p">,</span><span class="n">state</span><span class="p">)</span></code></pre></div>
<h2 id="torch-modules">Torch: Modules</h2>
<p>Caffe has Nets and Layers;</p>
<p>Torch just has Modules</p>
<ul>
<li>Forward / backward written in Lua using Tensor methods</li>
<li>Modules are classes written in Lua; easy to read and write</li>
</ul>
<p>Same code runs on CPU / GPU</p>
<h2 id="container">Container</h2>
<ul>
<li>Sequential</li>
<li>ConcatTable</li>
<li>ParallelTable</li>
</ul>
<p><img src="/images/2016-03-26-torch-container.png" alt="Container" /></p>
<h2 id="torch-nngraph">Torch: nngraph</h2>
<p>Use nngraph to build modules that combine their inputs in complex ways</p>
<h2 id="torch-package-management">Torch: Package Management</h2>
<p>loadcaffe: Load pretrained Caffe models: AlexNet, VGG, some others</p>
<p><a href="https://github.com/szagoruyko/loadcaffe">https://github.com/szagoruyko/loadcaffe</a></p>
<p>GoogLeNet v1: <a href="https://github.com/soumith/inception.torch">https://github.com/soumith/inception.torch</a></p>
<p>GoogLeNet v3: <a href="https://github.com/Moodstocks/inception-v3.torch">https://github.com/Moodstocks/inception-v3.torch</a></p>
<p>ResNet: <a href="https://github.com/facebook/fb.resnet.torch">https://github.com/facebook/fb.resnet.torch</a></p>
<h2 id="torch-package-management-1">Torch: Package Management</h2>
<p>like pip : luarocks</p>
<h2 id="torch-other-useful-packages">Torch: Other useful packages</h2>
<p>● torch.cudnn: Bindings for NVIDIA cuDNN kernels</p>
<p>● torch-hdf5: Read and write HDF5 files from Torch</p>
<p>● lua-cjson: Read and write JSON files from Lua,<a href="https://luarocks.org/modules/luarocks/lua-cjson">https://luarocks.org/modules/luarocks/lua-cjson</a></p>
<p>● cltorch, clnn: OpenCL backend for Torch, and port of nn</p>
<p>● torch-autograd: Automatic differentiation; sort of like more powerful nngraph, similar to Theano or TensorFlow</p>
<p>https://github.com/twitter/torch-autograd</p>
<p>● fbcunn: Facebook: FFT conv, multi-GPU (DataParallel, ModelParallel)<a href="https://github.com/facebook/fbcunn">https://github.com/facebook/fbcunn</a></p>
<h3 id="torch-typical-workflow">Torch: Typical Workflow</h3>
<p>Step 1: Preprocess data; usually use a Python script to dump data to HDF5</p>
<p>Step 2: Train a model in Lua / Torch; read from HDF5 datafile, save trained model to disk</p>
<p>Step 3: Use trained model for something, often with an evaluation script</p>
<p>https://github.com/jcjohnson/torch-rnn</p>
<p>Step 1: Preprocess data; usually use a Python script to dump data to HDF5 (https://github.com/jcjohnson/torch-rnn/blob/master/scripts/preprocess.py)</p>
<p>Step 2: Train a model in Lua / Torch; read from HDF5 datafile, save trained model to disk (https://github.com/jcjohnson/torch-rnn/blob/master/train.lua)</p>
<p>Step 3: Use trained model for something, often with an evaluation script (https://github.com/jcjohnson/torch-rnn/blob/master/sample.lua)</p>
<h1 id="torch-pros--cons">Torch: Pros / Cons</h1>
<ul>
<li>(+) Lots of modular pieces that are easy to combine</li>
<li>(+) Easy to write your own layer types and run on GPU</li>
<li>(+) Most of the library code is in Lua, easy to read</li>
<li>
<p>(+) Lots of pretrained models!</p>
</li>
<li>(-) Not great for RNNs</li>
<li>(-) Less plug-and-play than Caffe. You usually write your own training code</li>
</ul>
<h2 id="theano">Theano</h2>
<p>Python</p>
<p>http://deeplearning.net/software/theano/</p>
<p>Embracing computation graphs, symbolic computation</p>
<p>High-level wrappers: Keras, Lasagne</p>
<h3 id="compile-a-function">Compile a function</h3>
<p>在运行的时候,编译新的算法</p>
<p>produces c from x, y, z (generates code)</p>
<h3 id="symbolically">symbolically!!!!!!!!</h3>
<p>Theano computes gradients for us symbolically!</p>
<h2 id="theano-computing-gradients">Theano: Computing Gradients</h2>
<p>Problem: Shipping weights and gradients to CPU on every iteration to update…</p>
<p>解决方案:Theano: Shared Variables</p>
<p>Define weights as shared variables that persist in the graph between calls; initialize with numpy arrays</p>
<div class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">w1</span> <span class="o">=</span> <span class="n">theano</span><span class="o">.</span><span class="n">shared</span><span class="p">(</span><span class="mf">1e-3</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="n">D</span><span class="p">,</span><span class="n">H</span><span class="p">),</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;w1&#39;</span><span class="p">)</span></code></pre></div>
<p>Function includes an update that updates weights on every call</p>
<p>To train the net, just call function repeatedly!!!!!!!!!!!!!!</p>
<p><img src="/images/2016-03-26-Theano-Train.png" alt="repeat function" /></p>
<h2 id="theano-1">还有很多Theano的特性</h2>
<h3 id="lasagne-high-level-wrapper">Lasagne: High Level Wrapper</h3>
<p>writes the update rule for you</p>
<h3 id="keras-high-level-wrapper">Keras: High level wrapper</h3>
<p>makes common things easy to do</p>
<p>(Also supports TensorFlow backend)</p>
<h2 id="theano-pros--cons">Theano: Pros / Cons</h2>
<ul>
<li>(+) Python + numpy</li>
<li>(+) Computational graph is nice abstraction</li>
<li>
<p>(+) RNNs fit nicely in computational graph</p>
</li>
<li>
<p>(+) High level wrappers (Keras, Lasagne) ease the pain</p>
</li>
<li>(-) Raw Theano is somewhat low-level</li>
<li>(-) Error messages can be unhelpful</li>
<li>(-) Large models can have long compile times</li>
<li>(-) Much “fatter” than Torch; more magic</li>
<li>(-) Patchy support for pretrained models</li>
</ul>
<p>编译超级慢</p>
<p>超级复杂</p>
<p>错误超级乱</p>
<h2 id="tensorflow">TensorFlow</h2>
<p>Very similar to Theano - all about computation graphs</p>
<p>Easy visualizations (TensorBoard)</p>
<p>Multi-GPU and multi-node training</p>
<h3 id="tensorflow-tensorboard">TensorFlow: Tensorboard</h3>
<p>可视化</p>
<p>卧槽!!!</p>
<p>可以做直接画图</p>
<p>而且可以直接画出整个流程图</p>
<p><img src="/images/2016-03-26-tensorflow-graph1.png" alt="TensorFlow board graph1" /></p>
<p><img src="/images/2016-03-26-tensorflow-graph2.png" alt="TensorFlow board graph2" /></p>
<h1 id="tensorflow-pros--cons">TensorFlow: Pros / Cons</h1>
<ul>
<li>
<p>(+) Python + numpy</p>
</li>
<li>
<p>(+) Computational graph abstraction, like Theano; great for RNNs</p>
</li>
<li>(+) Much faster compile times than Theano</li>
<li>
<p>(+) Slightly more convenient than raw Theano?</p>
</li>
<li>
<p>(+) TensorBoard for visualization</p>
</li>
<li>(+) Data AND model parallelism; best of all frameworks</li>
<li>
<p>(+/-) Distributed models, but not open-source yet</p>
</li>
<li>(-) Slower than other frameworks right now</li>
<li>(-) Much “fatter” than Torch; more magic</li>
<li>(-) Not many pretrained models</li>
</ul>
<h1 id="caffe-vs-torch-vs-theano-vs-tensorflow">Caffe vs Torch vs Theano vs TensorFlow</h1>
<p><img src="/images/2016-03-26-caffe-vs-torch-vs-theano-vs-tensorflow.png" alt="caffe vs torch vs theano vs tensorflow" /></p>
<hr />
<h4 id="segmentation-classify-every-pixel">Segmentation? (Classify every pixel)</h4>
<ul>
<li>Need pretrained model (Caffe, Torch, Lasagna)</li>
<li>Need funny loss function</li>
<li>If loss function exists in Caffe: Use Caffe</li>
<li>If you want to write your own loss: Use Torch</li>
</ul>
<h4 id="object-detection">Object Detection?</h4>
<p>-&gt; Use Caffe + Python or Torch</p>
<h4 id="language-modeling-with-new-rnn-structure">Language modeling with new RNN structure?</h4>
<p>-&gt; Use Theano or TensorFlow</p>
<h4 id="implement-batchnorm">Implement BatchNorm?</h4>
<p>-&gt; Implement efficient backward pass? Use Torch</p>
<h1 id="recommendation">Recommendation</h1>
<ul>
<li>
<p>Feature extraction / finetuning existing models: Use Caffe</p>
</li>
<li>
<p>Complex uses of pretrained models: Use Lasagne or Torch</p>
</li>
<li>
<p>Write your own layers: Use Torch</p>
</li>
<li>
<p>Crazy RNNs: Use Theano or Tensorflow</p>
</li>
<li>
<p>Huge model, need model parallelism: Use TensorFlow</p>
</li>
</ul>
<p>neon™</p>
<p>The Fastest Deep Learning Framework</p>
<p>neon™ is open source and can be deployed on CPUs, GPUs or custom Nervana hardware. It supports all the commonly used models including convnets, MLPs, RNNs, LSTMs and autoencoder</p>
</description>
<pubDate>Sat, 26 Mar 2016 12:17:16 +0000</pubDate>
<link>http://next.sh/blog/2016/03/26/lecture-12-cnn-caffe-torch-tensorflow-stanford-cs231n/</link>
<guid isPermaLink="true">http://next.sh/blog/2016/03/26/lecture-12-cnn-caffe-torch-tensorflow-stanford-cs231n/</guid>
<category>Machine Learning</category>
<category>Deep Learning</category>
<category>CNN</category>
<category>Caffe</category>
<category>deep</category>
<category>learning</category>
</item>
<item>
<title>CNN使用的一些细节</title>