質問編集履歴

1

追記&補足

2019/02/10 15:01

投稿

Reach
Reach

score731

test CHANGED
File without changes
test CHANGED
@@ -455,3 +455,95 @@
455
455
 
456
456
 
457
457
  どなたか わかる方 ご教示 よろしく お願い致します
458
+
459
+
460
+
461
+ **追記:**
462
+
463
+
464
+
465
+ 画像は 256 x 256 のカラー画像です (538枚)
466
+
467
+
468
+
469
+ 他 ^C が表示されたコード
470
+
471
+ ```Python
472
+
473
+ class RandomWeightedAverage(_Merge):
474
+
475
+ """Provides a (random) weighted average between real and generated image samples"""
476
+
477
+ def _merge_function(self, inputs):
478
+
479
+ alpha = K.random_uniform((256, 1, 1, 1))
480
+
481
+ return (alpha * inputs[0]) + ((1 - alpha) * inputs[1])
482
+
483
+ ```
484
+
485
+
486
+
487
+ ```Python
488
+
489
+ def build_critic(self):
490
+
491
+
492
+
493
+ model = Sequential()
494
+
495
+
496
+
497
+ model.add(Conv2D(256, kernel_size=3, strides=2, input_shape=self.img_shape, padding="same"))
498
+
499
+ model.add(LeakyReLU(alpha=0.2))
500
+
501
+ model.add(Dropout(0.25))
502
+
503
+ model.add(Conv2D(512, kernel_size=3, strides=2, padding="same"))
504
+
505
+ model.add(ZeroPadding2D(padding=((0,1),(0,1))))
506
+
507
+ model.add(BatchNormalization(momentum=0.8))
508
+
509
+ model.add(LeakyReLU(alpha=0.2))
510
+
511
+ model.add(Dropout(0.25))
512
+
513
+ model.add(Conv2D(1024, kernel_size=3, strides=2, padding="same"))
514
+
515
+ model.add(BatchNormalization(momentum=0.8))
516
+
517
+ model.add(LeakyReLU(alpha=0.2))
518
+
519
+ model.add(Dropout(0.25))
520
+
521
+ model.add(Conv2D(2048, kernel_size=3, strides=1, padding="same"))
522
+
523
+ model.add(BatchNormalization(momentum=0.8))
524
+
525
+ model.add(LeakyReLU(alpha=0.2))
526
+
527
+ model.add(Dropout(0.25))
528
+
529
+ model.add(Flatten())
530
+
531
+ model.add(Dense(1))
532
+
533
+
534
+
535
+ model.summary()
536
+
537
+
538
+
539
+ img = Input(shape=self.img_shape)
540
+
541
+ validity = model(img)
542
+
543
+
544
+
545
+ return Model(img, validity)
546
+
547
+
548
+
549
+ ```