J7 - 对于ResNeXt-50算法的思考

  • 🍨 本文为🔗365天深度学习训练营 中的学习记录博客
  • 🍖 原作者:K同学啊 | 接辅导、项目定制

J6周有一段代码如下
Question

思考过程

  1. 首先看到这个问题的描述,想到的是可能使用了向量操作的广播机制
  2. 然后就想想办法验证一下,想到直接把J6的tensorflow代码跑一遍
  3. 通过model.summary打印了模型的所有层的信息,并把信息处理成方便查看(去掉分组卷积的一大堆层)
  4. 发现通道数一致,并不是使用了广播机制
  5. 仔细分析模型的过程,得出解释

验证过程

summary直接打印的内容,(太大只能贴出部分)

Model: "model"
__________________________________________________________________________________________________Layer (type)                Output Shape                 Param #   Connected to                  
==================================================================================================input_4 (InputLayer)        [(None, 224, 224, 3)]        0         []                            zero_padding2d_6 (ZeroPadd  (None, 230, 230, 3)          0         ['input_4[0][0]']             ing2D)                                                                                           conv2d_555 (Conv2D)         (None, 112, 112, 64)         9472      ['zero_padding2d_6[0][0]']    batch_normalization_59 (Ba  (None, 112, 112, 64)         256       ['conv2d_555[0][0]']          tchNormalization)                                                                                re_lu_53 (ReLU)             (None, 112, 112, 64)         0         ['batch_normalization_59[0][0]']                            zero_padding2d_7 (ZeroPadd  (None, 114, 114, 64)         0         ['re_lu_53[0][0]']            ing2D)                                                                                           max_pooling2d_3 (MaxPoolin  (None, 56, 56, 64)           0         ['zero_padding2d_7[0][0]']    g2D)                                                                                             conv2d_557 (Conv2D)         (None, 56, 56, 128)          8192      ['max_pooling2d_3[0][0]']     batch_normalization_61 (Ba  (None, 56, 56, 128)          512       ['conv2d_557[0][0]']          tchNormalization)                                                                                re_lu_54 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_61[0][0]']                            lambda_514 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_515 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_516 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_517 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_518 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_519 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_520 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_521 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_522 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_523 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_524 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_525 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_526 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_527 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_528 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_529 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_530 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_531 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_532 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_533 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_534 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_535 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_536 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_537 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_538 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_539 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_540 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_541 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_542 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_543 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_544 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            lambda_545 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_54[0][0]']            conv2d_558 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_514[0][0]']          conv2d_559 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_515[0][0]']          conv2d_560 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_516[0][0]']          conv2d_561 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_517[0][0]']          conv2d_562 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_518[0][0]']          conv2d_563 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_519[0][0]']          conv2d_564 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_520[0][0]']          conv2d_565 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_521[0][0]']          conv2d_566 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_522[0][0]']          conv2d_567 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_523[0][0]']          conv2d_568 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_524[0][0]']          conv2d_569 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_525[0][0]']          conv2d_570 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_526[0][0]']          conv2d_571 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_527[0][0]']          conv2d_572 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_528[0][0]']          conv2d_573 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_529[0][0]']          conv2d_574 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_530[0][0]']          conv2d_575 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_531[0][0]']          conv2d_576 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_532[0][0]']          conv2d_577 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_533[0][0]']          conv2d_578 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_534[0][0]']          conv2d_579 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_535[0][0]']          conv2d_580 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_536[0][0]']          conv2d_581 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_537[0][0]']          conv2d_582 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_538[0][0]']          conv2d_583 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_539[0][0]']          conv2d_584 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_540[0][0]']          conv2d_585 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_541[0][0]']          conv2d_586 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_542[0][0]']          conv2d_587 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_543[0][0]']          conv2d_588 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_544[0][0]']          conv2d_589 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_545[0][0]']          concatenate_16 (Concatenat  (None, 56, 56, 128)          0         ['conv2d_558[0][0]',          e)                                                                  'conv2d_559[0][0]',          'conv2d_560[0][0]',          'conv2d_561[0][0]',          'conv2d_562[0][0]',          'conv2d_563[0][0]',          'conv2d_564[0][0]',          'conv2d_565[0][0]',          'conv2d_566[0][0]',          'conv2d_567[0][0]',          'conv2d_568[0][0]',          'conv2d_569[0][0]',          'conv2d_570[0][0]',          'conv2d_571[0][0]',          'conv2d_572[0][0]',          'conv2d_573[0][0]',          'conv2d_574[0][0]',          'conv2d_575[0][0]',          'conv2d_576[0][0]',          'conv2d_577[0][0]',          'conv2d_578[0][0]',          'conv2d_579[0][0]',          'conv2d_580[0][0]',          'conv2d_581[0][0]',          'conv2d_582[0][0]',          'conv2d_583[0][0]',          'conv2d_584[0][0]',          'conv2d_585[0][0]',          'conv2d_586[0][0]',          'conv2d_587[0][0]',          'conv2d_588[0][0]',          'conv2d_589[0][0]']          batch_normalization_62 (Ba  (None, 56, 56, 128)          512       ['concatenate_16[0][0]']      tchNormalization)                                                                                re_lu_55 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_62[0][0]']                            conv2d_590 (Conv2D)         (None, 56, 56, 256)          32768     ['re_lu_55[0][0]']            conv2d_556 (Conv2D)         (None, 56, 56, 256)          16384     ['max_pooling2d_3[0][0]']     batch_normalization_63 (Ba  (None, 56, 56, 256)          1024      ['conv2d_590[0][0]']          tchNormalization)                                                                                batch_normalization_60 (Ba  (None, 56, 56, 256)          1024      ['conv2d_556[0][0]']          tchNormalization)                                                                                add_16 (Add)                (None, 56, 56, 256)          0         ['batch_normalization_63[0][0]',                            'batch_normalization_60[0][0]']                            re_lu_56 (ReLU)             (None, 56, 56, 256)          0         ['add_16[0][0]']              conv2d_591 (Conv2D)         (None, 56, 56, 128)          32768     ['re_lu_56[0][0]']            batch_normalization_64 (Ba  (None, 56, 56, 128)          512       ['conv2d_591[0][0]']          tchNormalization)                                                                                re_lu_57 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_64[0][0]']                            lambda_546 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_547 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_548 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_549 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_550 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_551 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_552 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_553 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_554 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_555 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_556 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_557 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_558 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_559 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_560 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_561 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_562 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_563 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_564 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_565 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_566 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_567 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_568 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_569 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_570 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_571 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_572 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_573 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_574 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_575 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_576 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            lambda_577 (Lambda)         (None, 56, 56, 4)            0         ['re_lu_57[0][0]']            conv2d_592 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_546[0][0]']          conv2d_593 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_547[0][0]']          conv2d_594 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_548[0][0]']          conv2d_595 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_549[0][0]']          conv2d_596 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_550[0][0]']          conv2d_597 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_551[0][0]']          conv2d_598 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_552[0][0]']          conv2d_599 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_553[0][0]']          conv2d_600 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_554[0][0]']          conv2d_601 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_555[0][0]']          conv2d_602 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_556[0][0]']          conv2d_603 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_557[0][0]']          conv2d_604 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_558[0][0]']          conv2d_605 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_559[0][0]']          conv2d_606 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_560[0][0]']          conv2d_607 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_561[0][0]']          conv2d_608 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_562[0][0]']          conv2d_609 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_563[0][0]']          conv2d_610 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_564[0][0]']          conv2d_611 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_565[0][0]']          conv2d_612 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_566[0][0]']          conv2d_613 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_567[0][0]']          conv2d_614 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_568[0][0]']          conv2d_615 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_569[0][0]']          conv2d_616 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_570[0][0]']          conv2d_617 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_571[0][0]']          conv2d_618 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_572[0][0]']          conv2d_619 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_573[0][0]']          conv2d_620 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_574[0][0]']          conv2d_621 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_575[0][0]']          conv2d_622 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_576[0][0]']          conv2d_623 (Conv2D)         (None, 56, 56, 4)            144       ['lambda_577[0][0]']          concatenate_17 (Concatenat  (None, 56, 56, 128)          0         ['conv2d_592[0][0]',          e)                                                                  'conv2d_593[0][0]',          'conv2d_594[0][0]',          'conv2d_595[0][0]',          'conv2d_596[0][0]',          'conv2d_597[0][0]',          'conv2d_598[0][0]',          'conv2d_599[0][0]',          'conv2d_600[0][0]',          'conv2d_601[0][0]',          'conv2d_602[0][0]',          'conv2d_603[0][0]',          'conv2d_604[0][0]',          'conv2d_605[0][0]',          'conv2d_606[0][0]',          'conv2d_607[0][0]',          'conv2d_608[0][0]',          'conv2d_609[0][0]',          'conv2d_610[0][0]',          'conv2d_611[0][0]',          'conv2d_612[0][0]',          'conv2d_613[0][0]',          'conv2d_614[0][0]',          'conv2d_615[0][0]',          'conv2d_616[0][0]',          'conv2d_617[0][0]',          'conv2d_618[0][0]',          'conv2d_619[0][0]',          'conv2d_620[0][0]',          'conv2d_621[0][0]',          'conv2d_622[0][0]',          'conv2d_623[0][0]']          batch_normalization_65 (Ba  (None, 56, 56, 128)          512       ['concatenate_17[0][0]']      tchNormalization)                                                                                re_lu_58 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_65[0][0]']                            

打印的层中,有大量的lambda,对照源代码,lambda操作在分组卷积内,我们可以把这一堆lambda一直到下面的concatenate全部看作在做分组卷积,分组卷积并不改变通道数,只是简化参数量。

# 把summary输出到文件中,使用python脚本处理掉这堆lambda
# 打开文件
f = open('summary')
# 读取内容
content = f.read()
# 按换行切分
lines = content.split('\n')clean_lines = []
# 过滤处理
for line in lines:if len(line.strip()) == 0:continueif len(line) - len(line.strip()) == 78 or len(line) - len(line.strip()) == 79:# 去掉concatenate那一堆connect tocontinue if 'lambda' in line:continueclean_lines.append(line)
for line in clean_lines:print(line)

处理后的模型结构如下

Model: "model"
__________________________________________________________________________________________________Layer (type)                Output Shape                 Param #   Connected to
==================================================================================================input_4 (InputLayer)        [(None, 224, 224, 3)]        0         []zero_padding2d_6 (ZeroPadd  (None, 230, 230, 3)          0         ['input_4[0][0]']ing2D)conv2d_555 (Conv2D)         (None, 112, 112, 64)         9472      ['zero_padding2d_6[0][0]']batch_normalization_59 (Ba  (None, 112, 112, 64)         256       ['conv2d_555[0][0]']tchNormalization)re_lu_53 (ReLU)             (None, 112, 112, 64)         0         ['batch_normalization_59[0][0]']zero_padding2d_7 (ZeroPadd  (None, 114, 114, 64)         0         ['re_lu_53[0][0]']ing2D)max_pooling2d_3 (MaxPoolin  (None, 56, 56, 64)           0         ['zero_padding2d_7[0][0]']g2D)conv2d_557 (Conv2D)         (None, 56, 56, 128)          8192      ['max_pooling2d_3[0][0]']batch_normalization_61 (Ba  (None, 56, 56, 128)          512       ['conv2d_557[0][0]']tchNormalization)re_lu_54 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_61[0][0]']concatenate_16 (Concatenat  (None, 56, 56, 128)          0         ['conv2d_558[0][0]',e)                                                                  'conv2d_559[0][0]',batch_normalization_62 (Ba  (None, 56, 56, 128)          512       ['concatenate_16[0][0]']tchNormalization)re_lu_55 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_62[0][0]']conv2d_590 (Conv2D)         (None, 56, 56, 256)          32768     ['re_lu_55[0][0]']conv2d_556 (Conv2D)         (None, 56, 56, 256)          16384     ['max_pooling2d_3[0][0]']batch_normalization_63 (Ba  (None, 56, 56, 256)          1024      ['conv2d_590[0][0]']tchNormalization)batch_normalization_60 (Ba  (None, 56, 56, 256)          1024      ['conv2d_556[0][0]']tchNormalization)add_16 (Add)                (None, 56, 56, 256)          0         ['batch_normalization_63[0][0]','batch_normalization_60[0][0]']re_lu_56 (ReLU)             (None, 56, 56, 256)          0         ['add_16[0][0]']conv2d_591 (Conv2D)         (None, 56, 56, 128)          32768     ['re_lu_56[0][0]']batch_normalization_64 (Ba  (None, 56, 56, 128)          512       ['conv2d_591[0][0]']tchNormalization)re_lu_57 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_64[0][0]']concatenate_17 (Concatenat  (None, 56, 56, 128)          0         ['conv2d_592[0][0]',e)                                                                  'conv2d_593[0][0]',batch_normalization_65 (Ba  (None, 56, 56, 128)          512       ['concatenate_17[0][0]']tchNormalization)re_lu_58 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_65[0][0]']conv2d_624 (Conv2D)         (None, 56, 56, 256)          32768     ['re_lu_58[0][0]']batch_normalization_66 (Ba  (None, 56, 56, 256)          1024      ['conv2d_624[0][0]']tchNormalization)add_17 (Add)                (None, 56, 56, 256)          0         ['batch_normalization_66[0][0]','re_lu_56[0][0]']re_lu_59 (ReLU)             (None, 56, 56, 256)          0         ['add_17[0][0]']conv2d_625 (Conv2D)         (None, 56, 56, 128)          32768     ['re_lu_59[0][0]']batch_normalization_67 (Ba  (None, 56, 56, 128)          512       ['conv2d_625[0][0]']tchNormalization)re_lu_60 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_67[0][0]']concatenate_18 (Concatenat  (None, 56, 56, 128)          0         ['conv2d_626[0][0]',e)                                                                  'conv2d_627[0][0]',batch_normalization_68 (Ba  (None, 56, 56, 128)          512       ['concatenate_18[0][0]']tchNormalization)re_lu_61 (ReLU)             (None, 56, 56, 128)          0         ['batch_normalization_68[0][0]']conv2d_658 (Conv2D)         (None, 56, 56, 256)          32768     ['re_lu_61[0][0]']batch_normalization_69 (Ba  (None, 56, 56, 256)          1024      ['conv2d_658[0][0]']tchNormalization)add_18 (Add)                (None, 56, 56, 256)          0         ['batch_normalization_69[0][0]','re_lu_59[0][0]']re_lu_62 (ReLU)             (None, 56, 56, 256)          0         ['add_18[0][0]']conv2d_660 (Conv2D)         (None, 56, 56, 256)          65536     ['re_lu_62[0][0]']batch_normalization_71 (Ba  (None, 56, 56, 256)          1024      ['conv2d_660[0][0]']tchNormalization)re_lu_63 (ReLU)             (None, 56, 56, 256)          0         ['batch_normalization_71[0][0]']concatenate_19 (Concatenat  (None, 28, 28, 256)          0         ['conv2d_661[0][0]',e)                                                                  'conv2d_662[0][0]',batch_normalization_72 (Ba  (None, 28, 28, 256)          1024      ['concatenate_19[0][0]']tchNormalization)re_lu_64 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_72[0][0]']conv2d_693 (Conv2D)         (None, 28, 28, 512)          131072    ['re_lu_64[0][0]']conv2d_659 (Conv2D)         (None, 28, 28, 512)          131072    ['re_lu_62[0][0]']batch_normalization_73 (Ba  (None, 28, 28, 512)          2048      ['conv2d_693[0][0]']tchNormalization)batch_normalization_70 (Ba  (None, 28, 28, 512)          2048      ['conv2d_659[0][0]']tchNormalization)add_19 (Add)                (None, 28, 28, 512)          0         ['batch_normalization_73[0][0]','batch_normalization_70[0][0]']re_lu_65 (ReLU)             (None, 28, 28, 512)          0         ['add_19[0][0]']conv2d_694 (Conv2D)         (None, 28, 28, 256)          131072    ['re_lu_65[0][0]']batch_normalization_74 (Ba  (None, 28, 28, 256)          1024      ['conv2d_694[0][0]']tchNormalization)re_lu_66 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_74[0][0]']concatenate_20 (Concatenat  (None, 28, 28, 256)          0         ['conv2d_695[0][0]',e)                                                                  'conv2d_696[0][0]',batch_normalization_75 (Ba  (None, 28, 28, 256)          1024      ['concatenate_20[0][0]']tchNormalization)re_lu_67 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_75[0][0]']conv2d_727 (Conv2D)         (None, 28, 28, 512)          131072    ['re_lu_67[0][0]']batch_normalization_76 (Ba  (None, 28, 28, 512)          2048      ['conv2d_727[0][0]']tchNormalization)add_20 (Add)                (None, 28, 28, 512)          0         ['batch_normalization_76[0][0]','re_lu_65[0][0]']re_lu_68 (ReLU)             (None, 28, 28, 512)          0         ['add_20[0][0]']conv2d_728 (Conv2D)         (None, 28, 28, 256)          131072    ['re_lu_68[0][0]']batch_normalization_77 (Ba  (None, 28, 28, 256)          1024      ['conv2d_728[0][0]']tchNormalization)re_lu_69 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_77[0][0]']concatenate_21 (Concatenat  (None, 28, 28, 256)          0         ['conv2d_729[0][0]',e)                                                                  'conv2d_730[0][0]',batch_normalization_78 (Ba  (None, 28, 28, 256)          1024      ['concatenate_21[0][0]']tchNormalization)re_lu_70 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_78[0][0]']conv2d_761 (Conv2D)         (None, 28, 28, 512)          131072    ['re_lu_70[0][0]']batch_normalization_79 (Ba  (None, 28, 28, 512)          2048      ['conv2d_761[0][0]']tchNormalization)add_21 (Add)                (None, 28, 28, 512)          0         ['batch_normalization_79[0][0]','re_lu_68[0][0]']re_lu_71 (ReLU)             (None, 28, 28, 512)          0         ['add_21[0][0]']conv2d_762 (Conv2D)         (None, 28, 28, 256)          131072    ['re_lu_71[0][0]']batch_normalization_80 (Ba  (None, 28, 28, 256)          1024      ['conv2d_762[0][0]']tchNormalization)re_lu_72 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_80[0][0]']concatenate_22 (Concatenat  (None, 28, 28, 256)          0         ['conv2d_763[0][0]',e)                                                                  'conv2d_764[0][0]',batch_normalization_81 (Ba  (None, 28, 28, 256)          1024      ['concatenate_22[0][0]']tchNormalization)re_lu_73 (ReLU)             (None, 28, 28, 256)          0         ['batch_normalization_81[0][0]']conv2d_795 (Conv2D)         (None, 28, 28, 512)          131072    ['re_lu_73[0][0]']batch_normalization_82 (Ba  (None, 28, 28, 512)          2048      ['conv2d_795[0][0]']tchNormalization)add_22 (Add)                (None, 28, 28, 512)          0         ['batch_normalization_82[0][0]','re_lu_71[0][0]']re_lu_74 (ReLU)             (None, 28, 28, 512)          0         ['add_22[0][0]']conv2d_797 (Conv2D)         (None, 28, 28, 512)          262144    ['re_lu_74[0][0]']batch_normalization_84 (Ba  (None, 28, 28, 512)          2048      ['conv2d_797[0][0]']tchNormalization)re_lu_75 (ReLU)             (None, 28, 28, 512)          0         ['batch_normalization_84[0][0]']concatenate_23 (Concatenat  (None, 14, 14, 512)          0         ['conv2d_798[0][0]',e)                                                                  'conv2d_799[0][0]',batch_normalization_85 (Ba  (None, 14, 14, 512)          2048      ['concatenate_23[0][0]']tchNormalization)re_lu_76 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_85[0][0]']conv2d_830 (Conv2D)         (None, 14, 14, 1024)         524288    ['re_lu_76[0][0]']conv2d_796 (Conv2D)         (None, 14, 14, 1024)         524288    ['re_lu_74[0][0]']batch_normalization_86 (Ba  (None, 14, 14, 1024)         4096      ['conv2d_830[0][0]']tchNormalization)batch_normalization_83 (Ba  (None, 14, 14, 1024)         4096      ['conv2d_796[0][0]']tchNormalization)add_23 (Add)                (None, 14, 14, 1024)         0         ['batch_normalization_86[0][0]','batch_normalization_83[0][0]']re_lu_77 (ReLU)             (None, 14, 14, 1024)         0         ['add_23[0][0]']conv2d_831 (Conv2D)         (None, 14, 14, 512)          524288    ['re_lu_77[0][0]']batch_normalization_87 (Ba  (None, 14, 14, 512)          2048      ['conv2d_831[0][0]']tchNormalization)re_lu_78 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_87[0][0]']concatenate_24 (Concatenat  (None, 14, 14, 512)          0         ['conv2d_832[0][0]',e)                                                                  'conv2d_833[0][0]',batch_normalization_88 (Ba  (None, 14, 14, 512)          2048      ['concatenate_24[0][0]']tchNormalization)re_lu_79 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_88[0][0]']conv2d_864 (Conv2D)         (None, 14, 14, 1024)         524288    ['re_lu_79[0][0]']batch_normalization_89 (Ba  (None, 14, 14, 1024)         4096      ['conv2d_864[0][0]']tchNormalization)add_24 (Add)                (None, 14, 14, 1024)         0         ['batch_normalization_89[0][0]','re_lu_77[0][0]']re_lu_80 (ReLU)             (None, 14, 14, 1024)         0         ['add_24[0][0]']conv2d_865 (Conv2D)         (None, 14, 14, 512)          524288    ['re_lu_80[0][0]']batch_normalization_90 (Ba  (None, 14, 14, 512)          2048      ['conv2d_865[0][0]']tchNormalization)re_lu_81 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_90[0][0]']concatenate_25 (Concatenat  (None, 14, 14, 512)          0         ['conv2d_866[0][0]',e)                                                                  'conv2d_867[0][0]',batch_normalization_91 (Ba  (None, 14, 14, 512)          2048      ['concatenate_25[0][0]']tchNormalization)re_lu_82 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_91[0][0]']conv2d_898 (Conv2D)         (None, 14, 14, 1024)         524288    ['re_lu_82[0][0]']batch_normalization_92 (Ba  (None, 14, 14, 1024)         4096      ['conv2d_898[0][0]']tchNormalization)add_25 (Add)                (None, 14, 14, 1024)         0         ['batch_normalization_92[0][0]','re_lu_80[0][0]']re_lu_83 (ReLU)             (None, 14, 14, 1024)         0         ['add_25[0][0]']conv2d_899 (Conv2D)         (None, 14, 14, 512)          524288    ['re_lu_83[0][0]']batch_normalization_93 (Ba  (None, 14, 14, 512)          2048      ['conv2d_899[0][0]']tchNormalization)re_lu_84 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_93[0][0]']concatenate_26 (Concatenat  (None, 14, 14, 512)          0         ['conv2d_900[0][0]',e)                                                                  'conv2d_901[0][0]',batch_normalization_94 (Ba  (None, 14, 14, 512)          2048      ['concatenate_26[0][0]']tchNormalization)re_lu_85 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_94[0][0]']conv2d_932 (Conv2D)         (None, 14, 14, 1024)         524288    ['re_lu_85[0][0]']batch_normalization_95 (Ba  (None, 14, 14, 1024)         4096      ['conv2d_932[0][0]']tchNormalization)add_26 (Add)                (None, 14, 14, 1024)         0         ['batch_normalization_95[0][0]','re_lu_83[0][0]']re_lu_86 (ReLU)             (None, 14, 14, 1024)         0         ['add_26[0][0]']conv2d_933 (Conv2D)         (None, 14, 14, 512)          524288    ['re_lu_86[0][0]']batch_normalization_96 (Ba  (None, 14, 14, 512)          2048      ['conv2d_933[0][0]']tchNormalization)re_lu_87 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_96[0][0]']concatenate_27 (Concatenat  (None, 14, 14, 512)          0         ['conv2d_934[0][0]',e)                                                                  'conv2d_935[0][0]',batch_normalization_97 (Ba  (None, 14, 14, 512)          2048      ['concatenate_27[0][0]']tchNormalization)re_lu_88 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_97[0][0]']conv2d_966 (Conv2D)         (None, 14, 14, 1024)         524288    ['re_lu_88[0][0]']batch_normalization_98 (Ba  (None, 14, 14, 1024)         4096      ['conv2d_966[0][0]']tchNormalization)add_27 (Add)                (None, 14, 14, 1024)         0         ['batch_normalization_98[0][0]','re_lu_86[0][0]']re_lu_89 (ReLU)             (None, 14, 14, 1024)         0         ['add_27[0][0]']conv2d_967 (Conv2D)         (None, 14, 14, 512)          524288    ['re_lu_89[0][0]']batch_normalization_99 (Ba  (None, 14, 14, 512)          2048      ['conv2d_967[0][0]']tchNormalization)re_lu_90 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_99[0][0]']concatenate_28 (Concatenat  (None, 14, 14, 512)          0         ['conv2d_968[0][0]',e)                                                                  'conv2d_969[0][0]',batch_normalization_100 (B  (None, 14, 14, 512)          2048      ['concatenate_28[0][0]']atchNormalization)re_lu_91 (ReLU)             (None, 14, 14, 512)          0         ['batch_normalization_100[0][0]']conv2d_1000 (Conv2D)        (None, 14, 14, 1024)         524288    ['re_lu_91[0][0]']batch_normalization_101 (B  (None, 14, 14, 1024)         4096      ['conv2d_1000[0][0]']atchNormalization)add_28 (Add)                (None, 14, 14, 1024)         0         ['batch_normalization_101[0][0]','re_lu_89[0][0]']re_lu_92 (ReLU)             (None, 14, 14, 1024)         0         ['add_28[0][0]']conv2d_1002 (Conv2D)        (None, 14, 14, 1024)         1048576   ['re_lu_92[0][0]']batch_normalization_103 (B  (None, 14, 14, 1024)         4096      ['conv2d_1002[0][0]']atchNormalization)re_lu_93 (ReLU)             (None, 14, 14, 1024)         0         ['batch_normalization_103[0][0]']concatenate_29 (Concatenat  (None, 7, 7, 1024)           0         ['conv2d_1003[0][0]',e)                                                                  'conv2d_1004[0][0]',batch_normalization_104 (B  (None, 7, 7, 1024)           4096      ['concatenate_29[0][0]']atchNormalization)re_lu_94 (ReLU)             (None, 7, 7, 1024)           0         ['batch_normalization_104[0][0]']conv2d_1035 (Conv2D)        (None, 7, 7, 2048)           2097152   ['re_lu_94[0][0]']conv2d_1001 (Conv2D)        (None, 7, 7, 2048)           2097152   ['re_lu_92[0][0]']batch_normalization_105 (B  (None, 7, 7, 2048)           8192      ['conv2d_1035[0][0]']atchNormalization)batch_normalization_102 (B  (None, 7, 7, 2048)           8192      ['conv2d_1001[0][0]']atchNormalization)add_29 (Add)                (None, 7, 7, 2048)           0         ['batch_normalization_105[0][0]','batch_normalization_102[0][0]']re_lu_95 (ReLU)             (None, 7, 7, 2048)           0         ['add_29[0][0]']conv2d_1036 (Conv2D)        (None, 7, 7, 1024)           2097152   ['re_lu_95[0][0]']batch_normalization_106 (B  (None, 7, 7, 1024)           4096      ['conv2d_1036[0][0]']atchNormalization)re_lu_96 (ReLU)             (None, 7, 7, 1024)           0         ['batch_normalization_106[0][0]']concatenate_30 (Concatenat  (None, 7, 7, 1024)           0         ['conv2d_1037[0][0]',e)                                                                  'conv2d_1038[0][0]',batch_normalization_107 (B  (None, 7, 7, 1024)           4096      ['concatenate_30[0][0]']atchNormalization)re_lu_97 (ReLU)             (None, 7, 7, 1024)           0         ['batch_normalization_107[0][0]']conv2d_1069 (Conv2D)        (None, 7, 7, 2048)           2097152   ['re_lu_97[0][0]']batch_normalization_108 (B  (None, 7, 7, 2048)           8192      ['conv2d_1069[0][0]']atchNormalization)add_30 (Add)                (None, 7, 7, 2048)           0         ['batch_normalization_108[0][0]','re_lu_95[0][0]']re_lu_98 (ReLU)             (None, 7, 7, 2048)           0         ['add_30[0][0]']conv2d_1070 (Conv2D)        (None, 7, 7, 1024)           2097152   ['re_lu_98[0][0]']batch_normalization_109 (B  (None, 7, 7, 1024)           4096      ['conv2d_1070[0][0]']atchNormalization)re_lu_99 (ReLU)             (None, 7, 7, 1024)           0         ['batch_normalization_109[0][0]']concatenate_31 (Concatenat  (None, 7, 7, 1024)           0         ['conv2d_1071[0][0]',e)                                                                  'conv2d_1072[0][0]',batch_normalization_110 (B  (None, 7, 7, 1024)           4096      ['concatenate_31[0][0]']atchNormalization)re_lu_100 (ReLU)            (None, 7, 7, 1024)           0         ['batch_normalization_110[0][0]']conv2d_1103 (Conv2D)        (None, 7, 7, 2048)           2097152   ['re_lu_100[0][0]']batch_normalization_111 (B  (None, 7, 7, 2048)           8192      ['conv2d_1103[0][0]']atchNormalization)add_31 (Add)                (None, 7, 7, 2048)           0         ['batch_normalization_111[0][0]','re_lu_98[0][0]']re_lu_101 (ReLU)            (None, 7, 7, 2048)           0         ['add_31[0][0]']global_average_pooling2d_1  (None, 2048)                 0         ['re_lu_101[0][0]'](GlobalAveragePooling2D)dense_1 (Dense)             (None, 1000)                 2049000   ['global_average_pooling2d_1[0][0]']

观察Add的connected to,发现全都是一样的,并没有出现不一致的情况,竟然和我想的不一样,并没有使用什么广播机制。仔细观察模型的过程才发现,stack的block中,x和filters通道不一致,此时如果直接相加会报错,所以第一个block做了一个通道数*2的卷积。由于后续的filters没有变,输出的通道都是filters*2,所以也可以直接相加。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/700167.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Vue 图片轮播第三方库 介绍

Vue图片轮播是一种在网页上以自动或手动方式展示图片的组件,常用于产品展示、网站banner等场景。有许多第三方库可以帮助Vue开发者轻松实现图片轮播功能。以下是一些流行的Vue图片轮播第三方库的介绍: 1. Vue-awesome-swiper - **简介**:V…

数字化转型导师坚鹏:县域数字化转型案例研究

县域数字化转型案例研究 课程背景: 很多县级政府存在以下问题: 不清楚县域数字化转型的发展模式 不清楚县域数字化转型的成功案例 课程特色: 针对性强 实用性强 创新性强 学员收获: 学习县域数字化转型的发展模式。 学习县…

C/C++的内存管理(2)——new与delete的内核与本质

内存管理 operator new 与 operator delete函数回看new与delete的实现内置类型自定义类型 常见面试题 我们已经知道了new与delete的用法及其好处,发现它似乎与C语言中的动态内存开辟的函数(malloc/calloc/realloc)不同 在这里我们特别指出&am…

Word第一课

文章目录 1. 文件格式1.1 如何显示文件扩展名1.2 Word文档格式的演变1.3 常见的Word文档格式 3. 文档属性理解文档属性查看文档属性 4. 显示比例方式一: 手动调整方式二: 自动调整 5. 视图、窗口视图 1. 文件格式 1.1 如何显示文件扩展名 文档格式指的…

Java零基础 - 算术运算符

哈喽,各位小伙伴们,你们好呀,我是喵手。 今天我要给大家分享一些自己日常学习到的一些知识点,并以文字的形式跟大家一起交流,互相学习,一个人虽可以走的更快,但一群人可以走的更远。 我是一名后…

Nginx缓存相关配置解析

文章目录 前言配置示例proxy_cacheproxy_cache_pathproxy_cache_keyproxy_cache_validproxy_cache_lockproxy_cache_methodsproxy_cache_bypassproxy_no_cacheproxy_cache_min_usesadd_header 可选项 使用示例通过响应头判断是否走缓存 缓存手动删除原博客 前言 客户端需要访问…

C#与VisionPro联合开发——TCP/IP通信

TCP/IP(传输控制协议/互联网协议)是一组用于在网络上进行通信的通信协议。它是互联网和许多局域网的基础,为计算机之间的数据传输提供了可靠性、有序性和错误检测。在软件开发中,TCP/IP 通信通常用于实现网络应用程序之间的数据交…

利用Socket.io实现实时通讯功能

在当今快节奏的社交和工作环境中,实时通讯已经变得至关重要。无论是在线游戏的即时交流,还是团队协作中的实时消息传递,都需要强大的实时通讯功能来支持。而在前端开发中,利用Socket.io这一强大的工具库,实现实时通讯功…

自定义Chrome的浏览器开发者工具DevTools界面的字体和样式

Chrome浏览器开发者工具默认的字体太小,想要修改但没有相关设置。 外观——字体可以自定义字体,但大小不可以调整。 github上有人给出了方法 整理为中文教程: 1.打开浏览器开发者工具,点开设置——实验,勾上红框设…

五、使用脚手架

五、使用脚手架 5.1 简单的实现 创建一个 School 组件 <template> <div><h2>学校名称&#xff1a;{{name}}</h2><h2>学校地址&#xff1a;{{address}}</h2> </div> </template><script> export default {name: "S…

猜字谜|构建生成式 AI 应用实践(一)

在 2023 亚马逊云科技 re:Invent 之后&#xff0c;细心的开发者们也许已经发现有一个很有趣的动手实验&#xff1a;开发一款可部署的基于大语言模型的字谜游戏&#xff1a; 该款游戏使用了文生图模型为玩家提供一个未知的提示词&#xff0c;玩家需要根据模型生成的图像来猜测该…

众安保险基于Apache SeaTunnel的生产应用实践

*> 文&#xff5c;曾力 众安保险大数据开发高级专家 编辑整理&#xff5c; 曾辉* 前言 众安保险从2023年4月就开始了数据集成服务的预研工作&#xff0c;意在通过该服务解决当前数据同步场景下的两大痛点&#xff0c;服务化能力薄弱和无分布式同步能力。我们对多种开源数据…

matplotlib绘图初步

文章目录 绘制曲线图完整流程图像属性 绘制曲线图 matplotlib是python中最常用的可视化库&#xff0c;提供了不同坐标系下的二十余种常用图像&#xff0c;并且提供了动态图像绘制的方法&#xff0c;可以满足科学计算中的绝大多数可视化需求。而在matplotlib中&#xff0c;绝大…

HTML5和CSS3提高

一、HTML5的新特性 增加了一些新的标签&#xff0c;新的表单&#xff0c;新的表单属性&#xff0c;IE9以上版本的浏览器才支持 注意&#xff1a; 这些语义化标准主要针对搜索引擎的 新标签可以使用多次 在IE9中需要把这些元素转化为块级元素 新增的多媒体标签 主要包含两个…

PPT复制粘贴后背景变没了怎么处理

目录 1.问题描述&#xff1a;2.解决方法&#xff1a;小结&#xff1a; 1.问题描述&#xff1a; 把一个ppt中的一张ppt粘贴到另一个ppt中&#xff0c;背景变没了&#xff0c;如下所示&#xff1a; 复制&#xff1a; 粘贴&#xff1a; 2.解决方法&#xff1a; 粘贴完后点击 保…

vscode 如何连接 WSL (不能通过 IP 地址连接)

来源&#xff1a;https://www.cnblogs.com/wxdblog/p/17234342.html vscode (remote-ssh) 连接 WSL 不能使用 IP地址 连接&#xff0c;需要安装 WSL 扩展才行

yolov9目标检测报错AttributeError: ‘list‘ object has no attribute ‘device‘

最近微智启软件工作室在运行yolov9目标检测的detect.py测试代码时&#xff0c;报错&#xff1a; File “G:\down\yolov9-main\yolov9-main\detect.py”, line 102, in run pred non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_detmax_det) Fil…

猫头虎分享已解决Bug || ValueError: Data cardinality is ambiguous ‍

博主猫头虎的技术世界 &#x1f31f; 欢迎来到猫头虎的博客 — 探索技术的无限可能&#xff01; 专栏链接&#xff1a; &#x1f517; 精选专栏&#xff1a; 《面试题大全》 — 面试准备的宝典&#xff01;《IDEA开发秘籍》 — 提升你的IDEA技能&#xff01;《100天精通鸿蒙》 …

使用Python制作进度条有多少种方法?看这一篇文章就够了!

前言 偶然间刷到一个视频&#xff0c;说到&#xff1a;当程序正在运算时&#xff0c;会有一个较长时间的空白期&#xff0c;谁也不知道程序运行的进度如何&#xff0c;不如给他加个进度条。 于是我今个就搜寻一下&#xff0c;Python版的进度条都可以怎么写&#xff01; 送书…

多线程和并发

线程 进程&#xff1a;在操作系统中运行的程序&#xff0c;一个进程可以包含多个线程 程序就是指令和数据的有序集合&#xff0c;静态概念 进程就是执行程序的一次执行过程&#xff0c;动态概念系统资源分配的单元 一个进程中包含多个线程&#xff0c;一个进程至少包含一个线…