zoukankan      html  css  js  c++  java
  • 学习进度笔记14

    观看Tensorflow案例实战视频课程14 加载训练好的VGG网络模型

    def net(data_path,input_image):
        layers=(
            'conv1_1','relu1_1','conv1_2','relu1_2','pool1',
            'conv2_1','relu2_1','conv2_2','relu2_2','pool2',
            'conv3_1','relu3_1','conv3_2','relu3_2','conv3_3',
            'relu3_3','conv3_4','relu3_4','pool3',
            'conv4_1','relu4_1','conv4_2','relu4_2','conv4_3',
            'relu4_3','conv4_4','relu4_4','pool4',
            'conv5_1','relu5_1','conv5_2','relu5_2','conv5_3',
            'relu5_3','conv5_4','relu5_4','pool5',
        )
        data=scipy.io.loadmat(data_path)
        mean=data['normalization'][0][0][0]
        mean_pixel=np.mean(mean,axis=(0,1))
        weights=data['layers'][0]
        net={}
    
    cwd=os.getcwd()
    VGG_PATH=cwd+"/data/imagenet-vgg-verydeep-19.mat"
    data=scipy.io.loadmat(VGG_PATH)
    #print(data.keys())
    mean=data['normalization'][0][0][0]
    mean_pixel=np.mean(mean,axis=(0,1))
    print(mean_pixel)
    weights=data['layers'][0]
    #print(weights)
    #print(weights[0][0][0][0][0].shape)
    #conv_1 w
    print(weights[0][0][0][0][0][0].shape)
    #conv_1 b
    print(weights[0][0][0][0][0][1].shape)
    
  • 相关阅读:
    zoj1137 poj1466
    poj3041
    zoj1455
    hdu1160 FatMouse's Speed
    zoj2770
    hdu1469
    hdu3169
    Mapped exception to response: 500 (Internal Server Error)
    Mapped exception to response: 500 (Internal Server Error)
    object is not a function
  • 原文地址:https://www.cnblogs.com/zql-42/p/14624769.html
Copyright © 2011-2022 走看看