-
Notifications
You must be signed in to change notification settings - Fork 3
/
filler.hpp
1236 lines (1184 loc) · 41.8 KB
/
filler.hpp
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
// Fillers are random number generators that fills a blob using the specified
// algorithm. The expectation is that they are only going to be used during
// initialization time and will not involve any GPUs.
#ifndef CAFFE_FILLER_HPP
#define CAFFE_FILLER_HPP
#include <string>
#include "caffe/blob.hpp"
#include "caffe/proto/caffe.pb.h"
#include "caffe/syncedmem.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
/// @brief Fills a Blob with constant or randomly-generated data.
template <typename Dtype>
class Filler {
public:
explicit Filler(const FillerParameter& param) : filler_param_(param) {}
virtual ~Filler() {}
virtual void Fill(Blob<Dtype>* blob) = 0;
protected:
FillerParameter filler_param_;
}; // class Filler
/// @brief Fills a Blob with constant values @f$ x = 0 @f$.
template <typename Dtype>
class ConstantFiller : public Filler<Dtype> {
public:
explicit ConstantFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
Dtype* data = blob->mutable_cpu_data();
const int count = blob->count();
const Dtype value = this->filler_param_.value();
CHECK(count);
for (int i = 0; i < count; ++i) {
data[i] = value;
}
CHECK_EQ(this->filler_param_.sparse(), -1)
<< "Sparsity not supported by this Filler.";
}
};
/// @brief Fills a Blob with uniformly distributed values @f$ x\sim U(a, b) @f$.
template <typename Dtype>
class UniformFiller : public Filler<Dtype> {
public:
explicit UniformFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
CHECK(blob->count());
caffe_rng_uniform<Dtype>(blob->count(), Dtype(this->filler_param_.min()),
Dtype(this->filler_param_.max()), blob->mutable_cpu_data());
CHECK_EQ(this->filler_param_.sparse(), -1)
<< "Sparsity not supported by this Filler.";
}
};
/// @brief Fills a Blob with Gaussian-distributed values @f$ x = a @f$.
template <typename Dtype>
class GaussianFiller : public Filler<Dtype> {
public:
explicit GaussianFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
Dtype* data = blob->mutable_cpu_data();
CHECK(blob->count());
caffe_rng_gaussian<Dtype>(blob->count(), Dtype(this->filler_param_.mean()),
Dtype(this->filler_param_.std()), blob->mutable_cpu_data());
int sparse = this->filler_param_.sparse();
CHECK_GE(sparse, -1);
if (sparse >= 0) {
// Sparse initialization is implemented for "weight" blobs; i.e. matrices.
// These have num == channels == 1; width is number of inputs; height is
// number of outputs. The 'sparse' variable specifies the mean number
// of non-zero input weights for a given output.
CHECK_GE(blob->num_axes(), 1);
const int num_outputs = blob->shape(0);
Dtype non_zero_probability = Dtype(sparse) / Dtype(num_outputs);
rand_vec_.reset(new SyncedMemory(blob->count() * sizeof(int)));
int* mask = reinterpret_cast<int*>(rand_vec_->mutable_cpu_data());
caffe_rng_bernoulli(blob->count(), non_zero_probability, mask);
for (int i = 0; i < blob->count(); ++i) {
data[i] *= mask[i];
}
}
}
protected:
shared_ptr<SyncedMemory> rand_vec_;
};
/** @brief Fills a Blob with values @f$ x \in [0, 1] @f$
* such that @f$ \forall i \sum_j x_{ij} = 1 @f$.
*/
template <typename Dtype>
class PositiveUnitballFiller : public Filler<Dtype> {
public:
explicit PositiveUnitballFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
Dtype* data = blob->mutable_cpu_data();
DCHECK(blob->count());
caffe_rng_uniform<Dtype>(blob->count(), 0, 1, blob->mutable_cpu_data());
// We expect the filler to not be called very frequently, so we will
// just use a simple implementation
int dim = blob->count() / blob->num();
CHECK(dim);
for (int i = 0; i < blob->num(); ++i) {
Dtype sum = 0;
for (int j = 0; j < dim; ++j) {
sum += data[i * dim + j];
}
for (int j = 0; j < dim; ++j) {
data[i * dim + j] /= sum;
}
}
CHECK_EQ(this->filler_param_.sparse(), -1)
<< "Sparsity not supported by this Filler.";
}
};
/**
* @brief Fills a Blob with values @f$ x \sim U(-a, +a) @f$ where @f$ a @f$ is
* set inversely proportional to number of incoming nodes, outgoing
* nodes, or their average.
*
* A Filler based on the paper [Bengio and Glorot 2010]: Understanding
* the difficulty of training deep feedforward neuralnetworks.
*
* It fills the incoming matrix by randomly sampling uniform data from [-scale,
* scale] where scale = sqrt(3 / n) where n is the fan_in, fan_out, or their
* average, depending on the variance_norm option. You should make sure the
* input blob has shape (num, a, b, c) where a * b * c = fan_in and num * b * c
* = fan_out. Note that this is currently not the case for inner product layers.
*
* TODO(dox): make notation in above comment consistent with rest & use LaTeX.
*/
template <typename Dtype>
class XavierFiller : public Filler<Dtype> {
public:
explicit XavierFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
CHECK(blob->count());
int fan_in = blob->count() / blob->num();
int fan_out = blob->count() / blob->channels();
Dtype n = fan_in; // default to fan_in
if (this->filler_param_.variance_norm() ==
FillerParameter_VarianceNorm_AVERAGE) {
n = (fan_in + fan_out) / Dtype(2);
} else if (this->filler_param_.variance_norm() ==
FillerParameter_VarianceNorm_FAN_OUT) {
n = fan_out;
}
Dtype scale = sqrt(Dtype(3) / n);
caffe_rng_uniform<Dtype>(blob->count(), -scale, scale,
blob->mutable_cpu_data());
CHECK_EQ(this->filler_param_.sparse(), -1)
<< "Sparsity not supported by this Filler.";
}
};
/**
* @brief Fills a Blob with values @f$ x \sim N(0, \sigma^2) @f$ where
* @f$ \sigma^2 @f$ is set inversely proportional to number of incoming
* nodes, outgoing nodes, or their average.
*
* A Filler based on the paper [He, Zhang, Ren and Sun 2015]: Specifically
* accounts for ReLU nonlinearities.
*
* Aside: for another perspective on the scaling factor, see the derivation of
* [Saxe, McClelland, and Ganguli 2013 (v3)].
*
* It fills the incoming matrix by randomly sampling Gaussian data with std =
* sqrt(2 / n) where n is the fan_in, fan_out, or their average, depending on
* the variance_norm option. You should make sure the input blob has shape (num,
* a, b, c) where a * b * c = fan_in and num * b * c = fan_out. Note that this
* is currently not the case for inner product layers.
*/
template <typename Dtype>
class MSRAFiller : public Filler<Dtype> {
public:
explicit MSRAFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
CHECK(blob->count());
int fan_in = blob->count() / blob->num();
int fan_out = blob->count() / blob->channels();
Dtype n = fan_in; // default to fan_in
if (this->filler_param_.variance_norm() ==
FillerParameter_VarianceNorm_AVERAGE) {
n = (fan_in + fan_out) / Dtype(2);
} else if (this->filler_param_.variance_norm() ==
FillerParameter_VarianceNorm_FAN_OUT) {
n = fan_out;
}
Dtype std = sqrt(Dtype(2) / n);
caffe_rng_gaussian<Dtype>(blob->count(), Dtype(0), std,
blob->mutable_cpu_data());
CHECK_EQ(this->filler_param_.sparse(), -1)
<< "Sparsity not supported by this Filler.";
}
};
/*!
@brief Fills a Blob with coefficients for bilinear interpolation.
A common use case is with the DeconvolutionLayer acting as upsampling.
You can upsample a feature map with shape of (B, C, H, W) by any integer factor
using the following proto.
\code
layer {
name: "upsample", type: "Deconvolution"
bottom: "{{bottom_name}}" top: "{{top_name}}"
convolution_param {
kernel_size: {{2 * factor - factor % 2}} stride: {{factor}}
num_output: {{C}} group: {{C}}
pad: {{ceil((factor - 1) / 2.)}}
weight_filler: { type: "bilinear" } bias_term: false
}
param { lr_mult: 0 decay_mult: 0 }
}
\endcode
Please use this by replacing `{{}}` with your values. By specifying
`num_output: {{C}} group: {{C}}`, it behaves as
channel-wise convolution. The filter shape of this deconvolution layer will be
(C, 1, K, K) where K is `kernel_size`, and this filler will set a (K, K)
interpolation kernel for every channel of the filter identically. The resulting
shape of the top feature map will be (B, C, factor * H, factor * W).
Note that the learning rate and the
weight decay are set to 0 in order to keep coefficient values of bilinear
interpolation unchanged during training. If you apply this to an image, this
operation is equivalent to the following call in Python with Scikit.Image.
\code{.py}
out = skimage.transform.rescale(img, factor, mode='constant', cval=0)
\endcode
*/
template <typename Dtype>
class BilinearFiller : public Filler<Dtype> {
public:
explicit BilinearFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
CHECK_EQ(blob->num_axes(), 4) << "Blob must be 4 dim.";
CHECK_EQ(blob->width(), blob->height()) << "Filter must be square";
Dtype* data = blob->mutable_cpu_data();
int f = ceil(blob->width() / 2.);
float c = (2 * f - 1 - f % 2) / (2. * f);
for (int i = 0; i < blob->count(); ++i) {
float x = i % blob->width();
float y = (i / blob->width()) % blob->height();
data[i] = (1 - fabs(x / f - c)) * (1 - fabs(y / f - c));
}
CHECK_EQ(this->filler_param_.sparse(), -1)
<< "Sparsity not supported by this Filler.";
}
};
template <typename Dtype>
class KbFiller : public Filler<Dtype> {
public:
explicit KbFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
Dtype* weights = blob->mutable_cpu_data();
weights[0] = -1.0/4.0;
weights[1] = 2.0/4.0;
weights[2] = -1.0/4.0;
weights[3] = 2.0/4.0;
weights[4] = -4.0/4.0;
weights[5] = 2.0/4.0;
weights[6] = -1.0/4.0;
weights[7] = 2.0/4.0;
weights[8] = -1.0/4.0;
}
};
template <typename Dtype>
class QianFiller : public Filler<Dtype> {
public:
explicit QianFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
Dtype* weights = blob->mutable_cpu_data();
weights[0] = -1.0/12.0;
weights[1] = 2.0/12.0;
weights[2] = -2.0/12.0;
weights[3] = 2.0/12.0;
weights[4] = -1.0/12.0;
weights[5] = 2.0/12.0;
weights[6] = -6.0/12.0;
weights[7] = 8.0/12.0;
weights[8] = -6.0/12.0;
weights[9] = 2.0/12.0;
weights[10] = -2.0/12.0;
weights[11] = 8.0/12.0;
weights[12] = -12.0/12.0;
weights[13] = 8.0/12.0;
weights[14] = -2.0/12.0;
weights[15] = 2.0/12.0;
weights[16] = -6.0/12.0;
weights[17] = 8.0/12.0;
weights[18] = -6.0/12.0;
weights[19] = 2.0/12.0;
weights[20] = -1.0/12.0;
weights[21] = 2.0/12.0;
weights[22] = -2.0/12.0;
weights[23] = 2.0/12.0;
weights[24] = -1.0/12.0;
}
};
/*DctrFiller filler is copy from DCTR,and used to generate 9 DCT bases*/
template <typename Dtype>
class DctrFiller : public Filler<Dtype> {
public:
explicit DctrFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
float PI = 3.141592654f;
Dtype* weights = blob->mutable_cpu_data();
int mode_r;
int mode_c;
int m;
int n;
for (int i=0;i<blob->num();i++){
mode_r=i/3;
mode_c=i%3;
for(int j=0;j<9;j++){
m=j/3;
n=j%3;
float wr = sqrt(2.0f); if (mode_r==0) wr=1;
float wc = sqrt(2.0f); if (mode_c==0) wc=1;
float val = ((wr*wc)/3) * cos(PI*mode_r*(2*m+1) / 6) * cos(PI*mode_c*(2*n+1) / 6);
weights[i*9+j] = val;
}
}
}
};
/*SrmFiller filler is copy from SRM,and used to generate 30 srm kernels, each kernels size is 5x5*/
template <typename Dtype>
class SrmFiller : public Filler<Dtype> {
public:
explicit SrmFiller(const FillerParameter& param)
: Filler<Dtype>(param) {}
virtual void Fill(Blob<Dtype>* blob) {
Dtype* weights = blob->mutable_cpu_data();
//kernel 1 start!
weights[0] = 0.00000000;
weights[1] = 0.00000000;
weights[2] = 0.00000000;
weights[3] = 0.00000000;
weights[4] = 0.00000000;
weights[5] = 0.00000000;
weights[6] = 0.00000000;
weights[7] = 0.00000000;
weights[8] = 0.00000000;
weights[9] = 0.00000000;
weights[10] = 0.00000000;
weights[11] = 0.00000000;
weights[12] = -1.00000000;
weights[13] = 1.00000000;
weights[14] = 0.00000000;
weights[15] = 0.00000000;
weights[16] = 0.00000000;
weights[17] = 0.00000000;
weights[18] = 0.00000000;
weights[19] = 0.00000000;
weights[20] = 0.00000000;
weights[21] = 0.00000000;
weights[22] = 0.00000000;
weights[23] = 0.00000000;
weights[24] = 0.00000000;
//kernel 1 end!
//kernel 2 start!
weights[25] = 0.00000000;
weights[26] = 0.00000000;
weights[27] = 0.00000000;
weights[28] = 0.00000000;
weights[29] = 0.00000000;
weights[30] = 0.00000000;
weights[31] = 0.00000000;
weights[32] = 0.00000000;
weights[33] = 0.00000000;
weights[34] = 0.00000000;
weights[35] = 0.00000000;
weights[36] = 1.00000000;
weights[37] = -1.00000000;
weights[38] = 0.00000000;
weights[39] = 0.00000000;
weights[40] = 0.00000000;
weights[41] = 0.00000000;
weights[42] = 0.00000000;
weights[43] = 0.00000000;
weights[44] = 0.00000000;
weights[45] = 0.00000000;
weights[46] = 0.00000000;
weights[47] = 0.00000000;
weights[48] = 0.00000000;
weights[49] = 0.00000000;
//kernel 2 end!
//kernel 3 start!
weights[50] = 0.00000000;
weights[51] = 0.00000000;
weights[52] = 0.00000000;
weights[53] = 0.00000000;
weights[54] = 0.00000000;
weights[55] = 0.00000000;
weights[56] = 0.00000000;
weights[57] = 1.00000000;
weights[58] = 0.00000000;
weights[59] = 0.00000000;
weights[60] = 0.00000000;
weights[61] = 0.00000000;
weights[62] = -1.00000000;
weights[63] = 0.00000000;
weights[64] = 0.00000000;
weights[65] = 0.00000000;
weights[66] = 0.00000000;
weights[67] = 0.00000000;
weights[68] = 0.00000000;
weights[69] = 0.00000000;
weights[70] = 0.00000000;
weights[71] = 0.00000000;
weights[72] = 0.00000000;
weights[73] = 0.00000000;
weights[74] = 0.00000000;
//kernel 3 end!
//kernel 4 start!
weights[75] = 0.00000000;
weights[76] = 0.00000000;
weights[77] = 0.00000000;
weights[78] = 0.00000000;
weights[79] = 0.00000000;
weights[80] = 0.00000000;
weights[81] = 0.00000000;
weights[82] = 0.00000000;
weights[83] = 0.00000000;
weights[84] = 0.00000000;
weights[85] = 0.00000000;
weights[86] = 0.00000000;
weights[87] = -1.00000000;
weights[88] = 0.00000000;
weights[89] = 0.00000000;
weights[90] = 0.00000000;
weights[91] = 0.00000000;
weights[92] = 1.00000000;
weights[93] = 0.00000000;
weights[94] = 0.00000000;
weights[95] = 0.00000000;
weights[96] = 0.00000000;
weights[97] = 0.00000000;
weights[98] = 0.00000000;
weights[99] = 0.00000000;
//kernel 4 end!
//kernel 5 start!
weights[100] = 0.00000000;
weights[101] = 0.00000000;
weights[102] = 0.00000000;
weights[103] = 0.00000000;
weights[104] = 0.00000000;
weights[105] = 0.00000000;
weights[106] = 0.00000000;
weights[107] = 0.00000000;
weights[108] = 1.00000000;
weights[109] = 0.00000000;
weights[110] = 0.00000000;
weights[111] = 0.00000000;
weights[112] = -1.00000000;
weights[113] = 0.00000000;
weights[114] = 0.00000000;
weights[115] = 0.00000000;
weights[116] = 0.00000000;
weights[117] = 0.00000000;
weights[118] = 0.00000000;
weights[119] = 0.00000000;
weights[120] = 0.00000000;
weights[121] = 0.00000000;
weights[122] = 0.00000000;
weights[123] = 0.00000000;
weights[124] = 0.00000000;
//kernel 5 end!
//kernel 6 start!
weights[125] = 0.00000000;
weights[126] = 0.00000000;
weights[127] = 0.00000000;
weights[128] = 0.00000000;
weights[129] = 0.00000000;
weights[130] = 0.00000000;
weights[131] = 0.00000000;
weights[132] = 0.00000000;
weights[133] = 0.00000000;
weights[134] = 0.00000000;
weights[135] = 0.00000000;
weights[136] = 0.00000000;
weights[137] = -1.00000000;
weights[138] = 0.00000000;
weights[139] = 0.00000000;
weights[140] = 0.00000000;
weights[141] = 0.00000000;
weights[142] = 0.00000000;
weights[143] = 1.00000000;
weights[144] = 0.00000000;
weights[145] = 0.00000000;
weights[146] = 0.00000000;
weights[147] = 0.00000000;
weights[148] = 0.00000000;
weights[149] = 0.00000000;
//kernel 6 end!
//kernel 7 start!
weights[150] = 0.00000000;
weights[151] = 0.00000000;
weights[152] = 0.00000000;
weights[153] = 0.00000000;
weights[154] = 0.00000000;
weights[155] = 0.00000000;
weights[156] = 1.00000000;
weights[157] = 0.00000000;
weights[158] = 0.00000000;
weights[159] = 0.00000000;
weights[160] = 0.00000000;
weights[161] = 0.00000000;
weights[162] = -1.00000000;
weights[163] = 0.00000000;
weights[164] = 0.00000000;
weights[165] = 0.00000000;
weights[166] = 0.00000000;
weights[167] = 0.00000000;
weights[168] = 0.00000000;
weights[169] = 0.00000000;
weights[170] = 0.00000000;
weights[171] = 0.00000000;
weights[172] = 0.00000000;
weights[173] = 0.00000000;
weights[174] = 0.00000000;
//kernel 7 end!
//kernel 8 start!
weights[175] = 0.00000000;
weights[176] = 0.00000000;
weights[177] = 0.00000000;
weights[178] = 0.00000000;
weights[179] = 0.00000000;
weights[180] = 0.00000000;
weights[181] = 0.00000000;
weights[182] = 0.00000000;
weights[183] = 0.00000000;
weights[184] = 0.00000000;
weights[185] = 0.00000000;
weights[186] = 0.00000000;
weights[187] = -1.00000000;
weights[188] = 0.00000000;
weights[189] = 0.00000000;
weights[190] = 0.00000000;
weights[191] = 1.00000000;
weights[192] = 0.00000000;
weights[193] = 0.00000000;
weights[194] = 0.00000000;
weights[195] = 0.00000000;
weights[196] = 0.00000000;
weights[197] = 0.00000000;
weights[198] = 0.00000000;
weights[199] = 0.00000000;
//kernel 8 end!
//kernel 9 start!
weights[200] = 0.00000000;
weights[201] = 0.00000000;
weights[202] = 0.00000000;
weights[203] = 0.00000000;
weights[204] = 0.00000000;
weights[205] = 0.00000000;
weights[206] = 0.00000000;
weights[207] = 0.00000000;
weights[208] = 0.00000000;
weights[209] = 0.00000000;
weights[210] = 0.00000000;
weights[211] = 0.50000000;
weights[212] = -1.00000000;
weights[213] = 0.50000000;
weights[214] = 0.00000000;
weights[215] = 0.00000000;
weights[216] = 0.00000000;
weights[217] = 0.00000000;
weights[218] = 0.00000000;
weights[219] = 0.00000000;
weights[220] = 0.00000000;
weights[221] = 0.00000000;
weights[222] = 0.00000000;
weights[223] = 0.00000000;
weights[224] = 0.00000000;
//kernel 9 end!
//kernel 10 start!
weights[225] = 0.00000000;
weights[226] = 0.00000000;
weights[227] = 0.00000000;
weights[228] = 0.00000000;
weights[229] = 0.00000000;
weights[230] = 0.00000000;
weights[231] = 0.00000000;
weights[232] = 0.50000000;
weights[233] = 0.00000000;
weights[234] = 0.00000000;
weights[235] = 0.00000000;
weights[236] = 0.00000000;
weights[237] = -1.00000000;
weights[238] = 0.00000000;
weights[239] = 0.00000000;
weights[240] = 0.00000000;
weights[241] = 0.00000000;
weights[242] = 0.50000000;
weights[243] = 0.00000000;
weights[244] = 0.00000000;
weights[245] = 0.00000000;
weights[246] = 0.00000000;
weights[247] = 0.00000000;
weights[248] = 0.00000000;
weights[249] = 0.00000000;
//kernel 10 end!
//kernel 11 start!
weights[250] = 0.00000000;
weights[251] = 0.00000000;
weights[252] = 0.00000000;
weights[253] = 0.00000000;
weights[254] = 0.00000000;
weights[255] = 0.00000000;
weights[256] = 0.50000000;
weights[257] = 0.00000000;
weights[258] = 0.00000000;
weights[259] = 0.00000000;
weights[260] = 0.00000000;
weights[261] = 0.00000000;
weights[262] = -1.00000000;
weights[263] = 0.00000000;
weights[264] = 0.00000000;
weights[265] = 0.00000000;
weights[266] = 0.00000000;
weights[267] = 0.00000000;
weights[268] = 0.50000000;
weights[269] = 0.00000000;
weights[270] = 0.00000000;
weights[271] = 0.00000000;
weights[272] = 0.00000000;
weights[273] = 0.00000000;
weights[274] = 0.00000000;
//kernel 11 end!
//kernel 12 start!
weights[275] = 0.00000000;
weights[276] = 0.00000000;
weights[277] = 0.00000000;
weights[278] = 0.00000000;
weights[279] = 0.00000000;
weights[280] = 0.00000000;
weights[281] = 0.00000000;
weights[282] = 0.00000000;
weights[283] = 0.50000000;
weights[284] = 0.00000000;
weights[285] = 0.00000000;
weights[286] = 0.00000000;
weights[287] = -1.00000000;
weights[288] = 0.00000000;
weights[289] = 0.00000000;
weights[290] = 0.00000000;
weights[291] = 0.50000000;
weights[292] = 0.00000000;
weights[293] = 0.00000000;
weights[294] = 0.00000000;
weights[295] = 0.00000000;
weights[296] = 0.00000000;
weights[297] = 0.00000000;
weights[298] = 0.00000000;
weights[299] = 0.00000000;
//kernel 12 end!
//kernel 13 start!
weights[300] = 0.00000000;
weights[301] = 0.00000000;
weights[302] = 0.00000000;
weights[303] = 0.00000000;
weights[304] = 0.00000000;
weights[305] = 0.00000000;
weights[306] = 0.00000000;
weights[307] = 0.00000000;
weights[308] = 0.00000000;
weights[309] = 0.00000000;
weights[310] = 0.00000000;
weights[311] = 0.33333333;
weights[312] = -1.00000000;
weights[313] = 1.00000000;
weights[314] = -0.33333333;
weights[315] = 0.00000000;
weights[316] = 0.00000000;
weights[317] = 0.00000000;
weights[318] = 0.00000000;
weights[319] = 0.00000000;
weights[320] = 0.00000000;
weights[321] = 0.00000000;
weights[322] = 0.00000000;
weights[323] = 0.00000000;
weights[324] = 0.00000000;
//kernel 13 end!
//kernel 14 start!
weights[325] = 0.00000000;
weights[326] = 0.00000000;
weights[327] = 0.00000000;
weights[328] = 0.00000000;
weights[329] = 0.00000000;
weights[330] = 0.00000000;
weights[331] = 0.00000000;
weights[332] = 0.00000000;
weights[333] = 0.00000000;
weights[334] = 0.00000000;
weights[335] = -0.33333333;
weights[336] = 1.00000000;
weights[337] = -1.00000000;
weights[338] = 0.33333333;
weights[339] = 0.00000000;
weights[340] = 0.00000000;
weights[341] = 0.00000000;
weights[342] = 0.00000000;
weights[343] = 0.00000000;
weights[344] = 0.00000000;
weights[345] = 0.00000000;
weights[346] = 0.00000000;
weights[347] = 0.00000000;
weights[348] = 0.00000000;
weights[349] = 0.00000000;
//kernel 14 end!
//kernel 15 start!
weights[350] = 0.00000000;
weights[351] = 0.00000000;
weights[352] = -0.33333333;
weights[353] = 0.00000000;
weights[354] = 0.00000000;
weights[355] = 0.00000000;
weights[356] = 0.00000000;
weights[357] = 1.00000000;
weights[358] = 0.00000000;
weights[359] = 0.00000000;
weights[360] = 0.00000000;
weights[361] = 0.00000000;
weights[362] = -1.00000000;
weights[363] = 0.00000000;
weights[364] = 0.00000000;
weights[365] = 0.00000000;
weights[366] = 0.00000000;
weights[367] = 0.33333333;
weights[368] = 0.00000000;
weights[369] = 0.00000000;
weights[370] = 0.00000000;
weights[371] = 0.00000000;
weights[372] = 0.00000000;
weights[373] = 0.00000000;
weights[374] = 0.00000000;
//kernel 15 end!
//kernel 16 start!
weights[375] = 0.00000000;
weights[376] = 0.00000000;
weights[377] = 0.00000000;
weights[378] = 0.00000000;
weights[379] = 0.00000000;
weights[380] = 0.00000000;
weights[381] = 0.00000000;
weights[382] = 0.33333333;
weights[383] = 0.00000000;
weights[384] = 0.00000000;
weights[385] = 0.00000000;
weights[386] = 0.00000000;
weights[387] = -1.00000000;
weights[388] = 0.00000000;
weights[389] = 0.00000000;
weights[390] = 0.00000000;
weights[391] = 0.00000000;
weights[392] = 1.00000000;
weights[393] = 0.00000000;
weights[394] = 0.00000000;
weights[395] = 0.00000000;
weights[396] = 0.00000000;
weights[397] = -0.33333333;
weights[398] = 0.00000000;
weights[399] = 0.00000000;
//kernel 16 end!
//kernel 17 start!
weights[400] = 0.00000000;
weights[401] = 0.00000000;
weights[402] = 0.00000000;
weights[403] = 0.00000000;
weights[404] = -0.33333333;
weights[405] = 0.00000000;
weights[406] = 0.00000000;
weights[407] = 0.00000000;
weights[408] = 1.00000000;
weights[409] = 0.00000000;
weights[410] = 0.00000000;
weights[411] = 0.00000000;
weights[412] = -1.00000000;
weights[413] = 0.00000000;
weights[414] = 0.00000000;
weights[415] = 0.00000000;
weights[416] = 0.33333333;
weights[417] = 0.00000000;
weights[418] = 0.00000000;
weights[419] = 0.00000000;
weights[420] = 0.00000000;
weights[421] = 0.00000000;
weights[422] = 0.00000000;
weights[423] = 0.00000000;
weights[424] = 0.00000000;
//kernel 17 end!
//kernel 18 start!
weights[425] = 0.00000000;
weights[426] = 0.00000000;
weights[427] = 0.00000000;
weights[428] = 0.00000000;
weights[429] = 0.00000000;
weights[430] = 0.00000000;
weights[431] = 0.33333333;
weights[432] = 0.00000000;
weights[433] = 0.00000000;
weights[434] = 0.00000000;
weights[435] = 0.00000000;
weights[436] = 0.00000000;
weights[437] = -1.00000000;
weights[438] = 0.00000000;
weights[439] = 0.00000000;
weights[440] = 0.00000000;
weights[441] = 0.00000000;
weights[442] = 0.00000000;
weights[443] = 1.00000000;
weights[444] = 0.00000000;
weights[445] = 0.00000000;
weights[446] = 0.00000000;
weights[447] = 0.00000000;
weights[448] = 0.00000000;
weights[449] = -0.33333333;
//kernel 18 end!
//kernel 19 start!
weights[450] = -0.33333333;
weights[451] = 0.00000000;
weights[452] = 0.00000000;
weights[453] = 0.00000000;
weights[454] = 0.00000000;
weights[455] = 0.00000000;
weights[456] = 1.00000000;
weights[457] = 0.00000000;
weights[458] = 0.00000000;
weights[459] = 0.00000000;
weights[460] = 0.00000000;
weights[461] = 0.00000000;
weights[462] = -1.00000000;
weights[463] = 0.00000000;
weights[464] = 0.00000000;
weights[465] = 0.00000000;
weights[466] = 0.00000000;
weights[467] = 0.00000000;
weights[468] = 0.33333333;
weights[469] = 0.00000000;
weights[470] = 0.00000000;
weights[471] = 0.00000000;
weights[472] = 0.00000000;
weights[473] = 0.00000000;
weights[474] = 0.00000000;
//kernel 19 end!
//kernel 20 start!
weights[475] = 0.00000000;
weights[476] = 0.00000000;
weights[477] = 0.00000000;
weights[478] = 0.00000000;
weights[479] = 0.00000000;
weights[480] = 0.00000000;
weights[481] = 0.00000000;
weights[482] = 0.00000000;
weights[483] = 0.33333333;
weights[484] = 0.00000000;
weights[485] = 0.00000000;
weights[486] = 0.00000000;
weights[487] = -1.00000000;
weights[488] = 0.00000000;
weights[489] = 0.00000000;
weights[490] = 0.00000000;
weights[491] = 1.00000000;
weights[492] = 0.00000000;
weights[493] = 0.00000000;
weights[494] = 0.00000000;
weights[495] = -0.33333333;
weights[496] = 0.00000000;
weights[497] = 0.00000000;
weights[498] = 0.00000000;
weights[499] = 0.00000000;
//kernel 20 end!
//kernel 21 start!
weights[500] = 0.00000000;
weights[501] = 0.00000000;
weights[502] = 0.00000000;
weights[503] = 0.00000000;
weights[504] = 0.00000000;
weights[505] = 0.00000000;
weights[506] = 0.00000000;
weights[507] = 0.50000000;
weights[508] = -0.25000000;
weights[509] = 0.00000000;
weights[510] = 0.00000000;
weights[511] = 0.00000000;
weights[512] = -1.00000000;
weights[513] = 0.50000000;
weights[514] = 0.00000000;
weights[515] = 0.00000000;
weights[516] = 0.00000000;
weights[517] = 0.50000000;
weights[518] = -0.25000000;
weights[519] = 0.00000000;
weights[520] = 0.00000000;
weights[521] = 0.00000000;
weights[522] = 0.00000000;
weights[523] = 0.00000000;
weights[524] = 0.00000000;
//kernel 21 end!
//kernel 22 start!
weights[525] = 0.00000000;
weights[526] = 0.00000000;
weights[527] = 0.00000000;
weights[528] = 0.00000000;
weights[529] = 0.00000000;
weights[530] = 0.00000000;
weights[531] = -0.25000000;
weights[532] = 0.50000000;
weights[533] = 0.00000000;
weights[534] = 0.00000000;
weights[535] = 0.00000000;
weights[536] = 0.50000000;
weights[537] = -1.00000000;
weights[538] = 0.00000000;
weights[539] = 0.00000000;
weights[540] = 0.00000000;
weights[541] = -0.25000000;
weights[542] = 0.50000000;
weights[543] = 0.00000000;
weights[544] = 0.00000000;
weights[545] = 0.00000000;
weights[546] = 0.00000000;
weights[547] = 0.00000000;
weights[548] = 0.00000000;
weights[549] = 0.00000000;
//kernel 22 end!
//kernel 23 start!
weights[550] = 0.00000000;
weights[551] = 0.00000000;
weights[552] = 0.00000000;
weights[553] = 0.00000000;
weights[554] = 0.00000000;
weights[555] = 0.00000000;
weights[556] = -0.25000000;
weights[557] = 0.50000000;
weights[558] = -0.25000000;
weights[559] = 0.00000000;
weights[560] = 0.00000000;
weights[561] = 0.50000000;
weights[562] = -1.00000000;
weights[563] = 0.50000000;
weights[564] = 0.00000000;
weights[565] = 0.00000000;
weights[566] = 0.00000000;
weights[567] = 0.00000000;
weights[568] = 0.00000000;
weights[569] = 0.00000000;
weights[570] = 0.00000000;
weights[571] = 0.00000000;
weights[572] = 0.00000000;
weights[573] = 0.00000000;
weights[574] = 0.00000000;
//kernel 23 end!
//kernel 24 start!
weights[575] = 0.00000000;