# write by Mrlv
# coding:utf-8
import tensorflow as tf
import tensorboard
import os

from tensorflow.keras import applications, layers

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'


# readData
def main():

    resnet = applications.ResNet50(weights='imagenet', include_top=False)
    resnet.build((4, 224, 224, 3))
    # resnet.summary()
    x = tf.random.normal((4, 224, 224, 3))
    out = resnet(x)

    print(out.shape)
    # 全局平均池化
    global_average_layer = layers.GlobalAveragePooling2D()
    # 利用上一层的输出作为本层的输入，测试其输出
    x = tf.random.normal([4, 7, 7, 2048])
    out = global_average_layer(x)  # 池化层降维
    print(out.shape)


if __name__ == '__main__':
    main()

21553c74ba5ac10572623cc09609e037ce4e3ce0
<mask token>

<mask token>


def main():
    resnet = applications.ResNet50(weights='imagenet', include_top=False)
    resnet.build((4, 224, 224, 3))
    x = tf.random.normal((4, 224, 224, 3))
    out = resnet(x)
    print(out.shape)
    global_average_layer = layers.GlobalAveragePooling2D()
    x = tf.random.normal([4, 7, 7, 2048])
    out = global_average_layer(x)
    print(out.shape)


if __name__ == '__main__':
    main()

<mask token>
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'


def main():
    resnet = applications.ResNet50(weights='imagenet', include_top=False)
    resnet.build((4, 224, 224, 3))
    x = tf.random.normal((4, 224, 224, 3))
    out = resnet(x)
    print(out.shape)
    global_average_layer = layers.GlobalAveragePooling2D()
    x = tf.random.normal([4, 7, 7, 2048])
    out = global_average_layer(x)
    print(out.shape)


if __name__ == '__main__':
    main()

import tensorflow as tf
import tensorboard
import os
from tensorflow.keras import applications, layers
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'


def main():
    resnet = applications.ResNet50(weights='imagenet', include_top=False)
    resnet.build((4, 224, 224, 3))
    x = tf.random.normal((4, 224, 224, 3))
    out = resnet(x)
    print(out.shape)
    global_average_layer = layers.GlobalAveragePooling2D()
    x = tf.random.normal([4, 7, 7, 2048])
    out = global_average_layer(x)
    print(out.shape)


if __name__ == '__main__':
    main()

# write by Mrlv
# coding:utf-8
import tensorflow as tf
import tensorboard
import os

from tensorflow.keras import applications, layers

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'


# readData
def main():

    resnet = applications.ResNet50(weights='imagenet', include_top=False)
    resnet.build((4, 224, 224, 3))
    # resnet.summary()
    x = tf.random.normal((4, 224, 224, 3))
    out = resnet(x)

    print(out.shape)
    # 全局平均池化
    global_average_layer = layers.GlobalAveragePooling2D()
    # 利用上一层的输出作为本层的输入，测试其输出
    x = tf.random.normal([4, 7, 7, 2048])
    out = global_average_layer(x)  # 池化层降维
    print(out.shape)


if __name__ == '__main__':
    main()
