美学评价算法总结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_21275321/article/details/77161311

综述:
实习期间复现了一个美学评价算法,应用到我们的产品中的效果就是,单击一个按钮之后,前端能将当前所有的图片按照图片的“好看”程度进行排名,这样顾客在选择所需要的图片的时候可以首先用算法将好看一点的图片选出来,再自己筛选,美学评价算法相当于完成一个预筛选的过程。
论文在AlexNet上进行微调,我对论文进行了复现,同时将网络改成了ResNet-50,得到了更好的效果,相信使用更好的分类CNN进行微调能够得到更好的效果~

参考:
我所复现的论文是Shu Kong和Adobe合作的项目
项目网址:http://www.ics.uci.edu/~skong2/aesthetics.html
论文网址:《Photo Aesthetics Ranking Network with Attributes and Content Adaptation》

数据集:
论文的作者和Adobe公司自己制作了一个数据集,他们邀请志愿者对一张图片的11个美学指标(摄影领域如色彩丰富度、内容丰富度等)做出评分,同时也给出对于这张图的总评分,评分在[-1,1]的范围之内,其中总评分和部分指标的评分范围是[0,1],数据集分为训练集(train),交叉验证集(val)和测试集(test),其中train有8458张图片,val有500张图片,test有1000张图片。
数据集给出了原图和warp到256*256的图片,所有图片的均值文件“mean_AADB_warp256.binaryproto”和“mean_AADB_regression_warp256.binaryproto”,对于每个集的每张图片又有11个属性评分和1个总评分,总共12*3个txt文件,里面图片名称和对应评分为一行,如下图所示
这里写图片描述

训练环境:
训练所需环境是Ubuntu16.04,Caffe和Python,其中Python用于准备数据和处理数据,需要配置pycaffe。

处理数据:
1)数据格式的选择:
Caffe所支持的输入数据格式有LMDB,LevelDB和HDF5,其中LMDB已经足够完成一般的分类任务,但是我们需要完成的美学评价算法简单来说是一个回归任务,它的标签值是float类型的,但是LMDB和LevelDB不支持float类型的标签而且我们还需要进行多标签分类,也就是一张图片同时有12个Label,所以最终选择HDF5格式的文件格式作为输入文件格式。
但是Caffe对HDF5格式的输入有大小限制,一个HDF5文件最大不能超过2G,所以在生成文件的时候要切分文件,经过试验,3000对图片和label所生成的HDF5为1.8G,所以选择3000张为一块。
2)数据集的生成:
该任务主要分为两个阶段,单支的回归网络和多分支的回归网络,首先先用单支回归网络训练一个回归模型Reg,它的lable是图片的总评分score,然后加上图片的11个评分构造一个多分支最终又融合成一个得分的回归网络Reg+Att,它的label是11个属性的评分和最终的score,训练时将Reg所训练好的权重迁移到Reg+Att中,最终使用Reg+Att网络来做预测。所以需要制作两种数据集:
图片:总评分
这里写图片描述
图片:11种属性的评分,总评分
这里写图片描述
对于第一种数据集,可以直接使用数据集中提供的xxx_score.txt做进一步处理,但是对于第二种,首先需要用python把官方提供的12个txt合成同一个txt,再做进一步处理,将12个txt合成同一个txt的代码如下所示:

#coding=utf-8
import pandas as pd
import numpy as np
"""
1.VividColor 2.Symmetry 3.RuleOfThirds 4.Repetition 5.Object 6.MotionBlur 
7.Light 8.DoF 9.Content 10.ColorHarmony 11.BalacingElement 12.score

"""
prase='val'
frontStr="imgListValidationRegression_"
backStr=".txt"
label=[]
label.append(frontStr+"VividColor"+backStr)
label.append(frontStr+"Symmetry"+backStr)
label.append(frontStr+"RuleOfThirds"+backStr)
label.append(frontStr+"Repetition"+backStr)
label.append(frontStr+"Object"+backStr)
label.append(frontStr+"MotionBlur"+backStr)
label.append(frontStr+"Light"+backStr)
label.append(frontStr+"DoF"+backStr)
label.append(frontStr+"Content"+backStr)
label.append(frontStr+"ColorHarmony"+backStr)
label.append(frontStr+"BalacingElements"+backStr)
label.append(frontStr+"score"+backStr)
print label
print prase
names = locals()
txtlist=[]
for i in range(12):

    txtlist.append('txt_%s' % i)
for i in range(12):
    txtlist[i]=pd.read_csv(label[i],dtype=str,delim_whitespace=True,header=None)
end  = pd.concat([txtlist[0],txtlist[1],txtlist[2],txtlist[3],txtlist[4],txtlist[5],txtlist[6],txtlist[7],txtlist[8],txtlist[9],txtlist[10],txtlist[11]],axis=1)
end.to_csv(prase+"init"+'.txt',index=False,sep=' ',header=None)
end=pd.read_csv(prase+"init"+'.txt',dtype=str,delim_whitespace=True,header=None)
end.drop([2,4,6,8,10,12,14,16,18,20,22], axis=1,inplace=True)
print end
end.to_csv(prase+"init"+'.txt',index=False,sep=' ',header=None)

生成好muti-txt后,我们就可以生成HDF5数据集了,首先用xxx_score.txt生成单支回归网络所用的数据集,然后用上述代码生成的txt生成多分支网络所用的数据集。由于Caffe不支持对HDF5格式文件的预处理(包括减去均值和resize等)所以需要我们在生成HDF5格式的时候就做预处理,图片resize的大小应该参考网络结构,例如AlexNet要求输入图片的大小是(227,227)而ResNet-50要求的大小是(224,224)。所以很不幸,我们需要针对两个不同的模型生成两个不同输入大小的HDF5,对于同一个网络又要生成针对Reg和针对Reg+Att的两个HDF5,所以如果不考虑HDF5切分的话,总共要生成4个HDF5文件(单标签AlexNet、单标签AlexNet、单标签AlexNet、多标签AlexNet、单标签ResNet-50、多标签ResNet-50)

生成单标签AlexNet所用HDF5文件代码如下:

#coding=utf-8
import sys
import numpy as np
import scipy
import h5py
from matplotlib import pyplot as plt
from scipy.misc import imread
from scipy import misc
import caffe
from caffe.proto import caffe_pb2
import decimal
import cv2
DEPLOY =  'initModel.prototxt'
MODEL_FILE ='initModel.caffemodel'
IMAGE_WIDTH = 227
IMAGE_HEIGHT = 227
IMAGE_SIZE=(227,227)
input_layer = 'imgLow'
#根据类型为np.float32的np.array格式的images_array(shape=[n_samples, channels, height, width])
# 和labels(shape=[n_samples, output_size])创建h5文件
prase='train'
filename = prase+'_score.txt'
setname, ext = filename.split('.')
IMAGE_MEAN='mean_AADB_regression_warp256.binaryproto'
mean_blob = caffe_pb2.BlobProto()
with open(IMAGE_MEAN) as img_mean:
    mean_blob.ParseFromString(img_mean.read())
mean_array = np.asarray(mean_blob.data, dtype=np.float32).reshape(
    (mean_blob.channels, mean_blob.height, mean_blob.width))
#Read model architecture and trained model's weights
net = caffe.Net(DEPLOY,
                MODEL_FILE,
                caffe.TEST)

#Define image transformers
print "Shape mean_array : ", mean_array.shape
print "Shape net : ", net.blobs[input_layer].data.shape
net.blobs[input_layer].reshape(1,        # batch size
                              3,         # channel
                              IMAGE_WIDTH, IMAGE_HEIGHT)  # image size
transformer = caffe.io.Transformer({input_layer: net.blobs[input_layer].data.shape})
transformer.set_mean(input_layer, mean_array)
transformer.set_transpose(input_layer, (2,0,1)) #227,227,3->3,227,227
with open(filename, 'r') as f:
    lines = f.readlines()
print lines
print  len(lines)
lines_list=[]
for i in range(0,len(lines),3000):
    lines_list.append(lines[i:i+3000])
print lines_list
print len(lines_list)
with open('{}_h5.txt'.format(setname), 'w') as f:
    for j in range(len(lines_list)):
        sample_size = len(lines_list[j])
        imgs = np.zeros((sample_size, 3,) + IMAGE_SIZE, dtype=np.float32)
        labels = np.zeros(sample_size, dtype=np.float32)
        h5_filename = '{}.h5'.format(setname + '_' + str(j))
        with h5py.File(h5_filename, 'w') as h:
            for i, line in enumerate(lines_list[j]):
                image_name, score = line[:-1].split()
                fullname = '../datasetImages_warp256/' + image_name
                # RGB顺序
                try:
                    img = cv2.imread(fullname, cv2.IMREAD_COLOR)
                    img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT), interpolation=cv2.INTER_CUBIC)
                    if i == 0:
                        print img.shape
                except:
                    continue
                net.blobs[input_layer].data[...] = transformer.preprocess(input_layer, img)
                img=net.blobs[input_layer].data[...]
                if i==0:
                    print img.shape #(1, 3, 227, 227)
                    print fullname
                    print img
                imgs[i] = img
                labels[i]=decimal.Decimal("%.3f" % float(score))
                # print labels[i]
                if (i + 1) % 1000 == 0:
                    print('processed {} images!'.format(i + 1))
            print imgs.shape
            h.create_dataset('data', data=imgs)
            h.create_dataset('label', data=labels)
        f.write(h5_filename + "\n")

print "done!"

生成如下几个文件:

其中train_score_h5.txt中保存生成的.h5文件的名字供Caffe调用,如下所示:
这里写图片描述

多标签AlexNet所需的HDF5文件的代码如下:

#coding=utf-8
import sys
import numpy as np
import scipy
import h5py
from matplotlib import pyplot as plt
from scipy.misc import imread
from scipy import misc
import decimal
import caffe
from caffe.proto import caffe_pb2
import cv2
"""
1.VividColor 2.Symmetry 3.RuleOfThirds 4.Repetition 5.Object 6.MotionBlur 
7.Light 8.DoF 9.Content 10.ColorHarmony 11.BalacingElement 12.score

"""
DEPLOY =  'initModel.prototxt'
MODEL_FILE ='initModel.caffemodel'
IMAGE_WIDTH = 227
IMAGE_HEIGHT = 227
IMAGE_SIZE=(227,227)
input_layer = 'imgLow'
IMAGE_MEAN='mean_AADB_regression_warp256.binaryproto'
mean_blob = caffe_pb2.BlobProto()
with open(IMAGE_MEAN) as img_mean:
    mean_blob.ParseFromString(img_mean.read())
mean_array = np.asarray(mean_blob.data, dtype=np.float32).reshape(
    (mean_blob.channels, mean_blob.height, mean_blob.width))
#Read model architecture and trained model's weights
net = caffe.Net(DEPLOY,
                MODEL_FILE,
                caffe.TEST)

#Define image transformers
print "Shape mean_array : ", mean_array.shape
print "Shape net : ", net.blobs[input_layer].data.shape
net.blobs[input_layer].reshape(1,        # batch size
                              3,         # channel
                              IMAGE_WIDTH, IMAGE_HEIGHT)  # image size
transformer = caffe.io.Transformer({input_layer: net.blobs[input_layer].data.shape})
transformer.set_mean(input_layer, mean_array)
transformer.set_transpose(input_layer, (2,0,1)) #227,227,3->3,227,227

#根据类型为np.float32的np.array格式的images_array(shape=[n_samples, channels, height, width])
# 和labels(shape=[n_samples, output_size])创建h5文件
prase='train'
filename = 'muti_'+prase+'.txt'
setname, ext = filename.split('.')

with open(filename, 'r') as f:
    lines = f.readlines()
# print lines
# print  len(lines)
lines_list=[]
for i in range(0,len(lines),3000):
    lines_list.append(lines[i:i+3000])
# print lines_list
# print len(lines_list)
with open('{}_h5.txt'.format(setname), 'w') as f:
    for j in range(len(lines_list)):
        sample_size = len(lines_list[j])
        label_size=12
        imgs = np.zeros((sample_size, 3,) + IMAGE_SIZE, dtype=np.float32)
        labels=np.zeros((label_size,sample_size), dtype=np.float32)
        h5_filename = '{}.h5'.format(setname + '_' + str(j))
        with h5py.File(h5_filename, 'w') as h:
            for i, line in enumerate(lines_list[j]):
                image_name, label1, label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12= line[:-1].split()
                fullname = '../datasetImages_warp256/' + image_name
                # RGB顺序
                try:
                    img = cv2.imread(fullname, cv2.IMREAD_COLOR)
                    img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT), interpolation=cv2.INTER_CUBIC)
                    if i == 0:
                        print img.shape
                except:
                    continue
                net.blobs[input_layer].data[...] = transformer.preprocess(input_layer, img)
                img=net.blobs[input_layer].data[...]
                if i==0:
                    print img.shape #(1, 3, 227, 227)
                    print fullname
                    print img
                imgs[i] = img
                labels[0][i]=decimal.Decimal("%.3f" % float(label1))
                labels[1][i]=decimal.Decimal("%.3f" % float(label2))
                labels[2][i]=decimal.Decimal("%.3f" % float(label3))
                labels[3][i]=decimal.Decimal("%.3f" % float(label4))
                labels[4][i]=decimal.Decimal("%.3f" % float(label5))
                labels[5][i]=decimal.Decimal("%.3f" % float(label6))
                labels[6][i]=decimal.Decimal("%.3f" % float(label7))
                labels[7][i]=decimal.Decimal("%.3f" % float(label8))
                labels[8][i]=decimal.Decimal("%.3f" % float(label9))
                labels[9][i]=decimal.Decimal("%.3f" % float(label10))
                labels[10][i]=decimal.Decimal("%.3f" % float(label11))
                labels[11][i]=decimal.Decimal("%.3f" % float(label12))
                if (i + 1) % 1000 == 0:
                    print('processed {} images!'.format(i + 1))
            print imgs.shape
            # print labels
            # print labels.shape#(12, 500)
            labels=labels.T
            # print labels
            # print labels.shape
            h.create_dataset('data', data=imgs)
            h.create_dataset('labels', data=labels)

        f.write(h5_filename + "\n")

print "done!"

单标签ResNet-50所需的HDF5文件的代码如下:

#coding=utf-8
import sys
import numpy as np
import scipy
import h5py
from matplotlib import pyplot as plt
from scipy.misc import imread
from scipy import misc
import caffe
from caffe.proto import caffe_pb2
import decimal
import cv2
DEPLOY =  'ResNet_50_seg_deploy.prototxt'
MODEL_FILE ='ResNet-50-model.caffemodel'
IMAGE_WIDTH = 224
IMAGE_HEIGHT = 224
IMAGE_SIZE=(224,224)
input_layer = 'imgLow'
#根据类型为np.float32的np.array格式的images_array(shape=[n_samples, channels, height, width])
# 和labels(shape=[n_samples, output_size])创建h5文件
prase='val'
filename = prase+'_score.txt'
setname, ext = filename.split('.')
IMAGE_MEAN='mean_AADB_regression_warp256.binaryproto'
mean_blob = caffe_pb2.BlobProto()
with open(IMAGE_MEAN) as img_mean:
    mean_blob.ParseFromString(img_mean.read())
mean_array = np.asarray(mean_blob.data, dtype=np.float32).reshape(
    (mean_blob.channels, mean_blob.height, mean_blob.width))
#Read model architecture and trained model's weights
net = caffe.Net(DEPLOY,
                MODEL_FILE,
                caffe.TEST)

#Define image transformers
print "Shape mean_array : ", mean_array.shape
print "Shape net : ", net.blobs[input_layer].data.shape
net.blobs[input_layer].reshape(1,        # batch size
                              3,         # channel
                              IMAGE_WIDTH, IMAGE_HEIGHT)  # image size
transformer = caffe.io.Transformer({input_layer: net.blobs[input_layer].data.shape})
transformer.set_mean(input_layer, mean_array)
transformer.set_transpose(input_layer, (2,0,1)) #227,227,3->3,227,227
with open(filename, 'r') as f:
    lines = f.readlines()
print lines
print  len(lines)
lines_list=[]
for i in range(0,len(lines),3000):
    lines_list.append(lines[i:i+3000])
print lines_list
print len(lines_list)
with open('{}_h5.txt'.format('res'+setname), 'w') as f:
    for j in range(len(lines_list)):
        sample_size = len(lines_list[j])
        imgs = np.zeros((sample_size, 3,) + IMAGE_SIZE, dtype=np.float32)
        labels = np.zeros(sample_size, dtype=np.float32)
        h5_filename = '{}.h5'.format('res'+setname + '_' + str(j))
        with h5py.File(h5_filename, 'w') as h:
            for i, line in enumerate(lines_list[j]):
                image_name, score = line[:-1].split()
                fullname = '../datasetImages_warp256/' + image_name
                # RGB顺序
                try:
                    img = cv2.imread(fullname, cv2.IMREAD_COLOR)
                    img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT), interpolation=cv2.INTER_CUBIC)
                    if i == 0:
                        print img.shape
                except:
                    continue
                net.blobs[input_layer].data[...] = transformer.preprocess(input_layer, img)
                img=net.blobs[input_layer].data[...]
                if i==0:
                    print img.shape #(1, 3, 227, 227)
                    print fullname
                    print img
                imgs[i] = img
                labels[i]=decimal.Decimal("%.3f" % float(score))
                # print labels[i]
                if (i + 1) % 1000 == 0:
                    print('processed {} images!'.format(i + 1))
            print imgs.shape
            h.create_dataset('data', data=imgs)
            h.create_dataset('label', data=labels)
        f.write(h5_filename + "\n")

print "done!"

多标签ResNet-50所需的HDF5文件的代码如下:

#coding=utf-8
import sys
import numpy as np
import scipy
import h5py
from matplotlib import pyplot as plt
from scipy.misc import imread
from scipy import misc
import decimal
import caffe
from caffe.proto import caffe_pb2
import cv2
"""
1.VividColor 2.Symmetry 3.RuleOfThirds 4.Repetition 5.Object 6.MotionBlur 
7.Light 8.DoF 9.Content 10.ColorHarmony 11.BalacingElement 12.score

"""
DEPLOY =  'ResNet_50_seg+att_deploy.prototxt'
MODEL_FILE ='ResNet-50-model.caffemodel'
IMAGE_WIDTH = 224
IMAGE_HEIGHT = 224
IMAGE_SIZE=(224,224)
input_layer = 'imgLow'
IMAGE_MEAN='mean_AADB_regression_warp256.binaryproto'
mean_blob = caffe_pb2.BlobProto()
with open(IMAGE_MEAN) as img_mean:
    mean_blob.ParseFromString(img_mean.read())
mean_array = np.asarray(mean_blob.data, dtype=np.float32).reshape(
    (mean_blob.channels, mean_blob.height, mean_blob.width))
#Read model architecture and trained model's weights
net = caffe.Net(DEPLOY,
                MODEL_FILE,
                caffe.TEST)

#Define image transformers
print "Shape mean_array : ", mean_array.shape
print "Shape net : ", net.blobs[input_layer].data.shape
net.blobs[input_layer].reshape(1,        # batch size
                              3,         # channel
                              IMAGE_WIDTH, IMAGE_HEIGHT)  # image size
transformer = caffe.io.Transformer({input_layer: net.blobs[input_layer].data.shape})
transformer.set_mean(input_layer, mean_array)
transformer.set_transpose(input_layer, (2,0,1)) #227,227,3->3,227,227

#根据类型为np.float32的np.array格式的images_array(shape=[n_samples, channels, height, width])
# 和labels(shape=[n_samples, output_size])创建h5文件
prase='train'
filename = 'muti_'+prase+'.txt'
setname, ext = filename.split('.')

with open(filename, 'r') as f:
    lines = f.readlines()
# print lines
# print  len(lines)
lines_list=[]
for i in range(0,len(lines),3000):
    lines_list.append(lines[i:i+3000])
# print lines_list
# print len(lines_list)
with open('{}_h5.txt'.format('res'+setname), 'w') as f:
    for j in range(len(lines_list)):
        sample_size = len(lines_list[j])
        label_size=12
        imgs = np.zeros((sample_size, 3,) + IMAGE_SIZE, dtype=np.float32)
        labels=np.zeros((label_size,sample_size), dtype=np.float32)
        h5_filename = '{}.h5'.format('res'+setname + '_' + str(j))
        with h5py.File(h5_filename, 'w') as h:
            for i, line in enumerate(lines_list[j]):
                image_name, label1, label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12= line[:-1].split()
                fullname = '../datasetImages_warp256/' + image_name
                # RGB顺序
                try:
                    img = cv2.imread(fullname, cv2.IMREAD_COLOR)
                    img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT), interpolation=cv2.INTER_CUBIC)
                    if i == 0:
                        print img.shape
                except:
                    continue
                net.blobs[input_layer].data[...] = transformer.preprocess(input_layer, img)
                img=net.blobs[input_layer].data[...]
                if i==0:
                    print img.shape #(1, 3, 227, 227)
                    print fullname
                    print img
                imgs[i] = img
                labels[0][i]=decimal.Decimal("%.3f" % float(label1))
                labels[1][i]=decimal.Decimal("%.3f" % float(label2))
                labels[2][i]=decimal.Decimal("%.3f" % float(label3))
                labels[3][i]=decimal.Decimal("%.3f" % float(label4))
                labels[4][i]=decimal.Decimal("%.3f" % float(label5))
                labels[5][i]=decimal.Decimal("%.3f" % float(label6))
                labels[6][i]=decimal.Decimal("%.3f" % float(label7))
                labels[7][i]=decimal.Decimal("%.3f" % float(label8))
                labels[8][i]=decimal.Decimal("%.3f" % float(label9))
                labels[9][i]=decimal.Decimal("%.3f" % float(label10))
                labels[10][i]=decimal.Decimal("%.3f" % float(label11))
                labels[11][i]=decimal.Decimal("%.3f" % float(label12))
                if (i + 1) % 1000 == 0:
                    print('processed {} images!'.format(i + 1))
            print imgs.shape
            # print labels
            # print labels.shape#(12, 500)
            labels=labels.T
            # print labels
            # print labels.shape
            h.create_dataset('data', data=imgs)
            h.create_dataset('labels', data=labels)

        f.write(h5_filename + "\n")

print "done!"

生成HDF5需要用的caffemodel可以直接在github上面下载在imageNet上预训练好的对应的AlexNet和ResNet-50模型,其中initModel.caffemodel和initModel.prototxt是论文作者提供的他在AlexNet上预训练的论文模型(Seg+Att模型,但是对prototxt稍作修改后该模型也可以用于Seg预测),而ResNet的prototxt是修改网络结构后的deploy.prototxt,但是它在此处的作用仅仅是读取输入层的信息,所以直接用git上面提供的ResNet-50的deploy。prototxt就可以。
预测的时候要用自己的prototxt哦~先写到这
(感觉后面也没啥好写的啦~最难的就是数据处理过程了,网络结构的话把原作者的网络放到QuickStart里看下网络结构就知道怎么改ResNet-50啦,hin简单~)

alexnet_reg_train_val.prototxt

name: "ftRankLoss"
layer {
  name: "data"  
  type: "HDF5Data"
  top: "data"
  top: "label"
  include {    
    phase: TRAIN  
  }
  hdf5_data_param {    
    source: "./train_score_h5.txt"    
    batch_size: 32    
  }
}

layer {
  name: "data"  
  type: "HDF5Data"
  top: "data"
  top: "label"
  include {    
    phase: TEST  
  }
  hdf5_data_param {    
    source: "./val_score_h5.txt"    
    batch_size: 25   
  }
}

#### branch-A: shared low-level layers #####
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    name: "conv1_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv1_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 96
    kernel_size: 11
    stride: 4
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu1"
  type: "ReLU"
  bottom: "conv1"
  top: "conv1"
}

layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}

layer {
  name: "norm1"
  type: "LRN"
  bottom: "pool1"
  top: "norm1"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}


layer {
  name: "conv2"
  type: "Convolution"
  bottom: "norm1"
  top: "conv2"
  param {
    name: "conv2_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv2_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 256
    pad: 2
    kernel_size: 5
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu2"
  type: "ReLU"
  bottom: "conv2"
  top: "conv2"
}

layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}

layer {
  name: "norm2"
  type: "LRN"
  bottom: "pool2"
  top: "norm2"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}

layer {
  name: "conv3"
  type: "Convolution"
  bottom: "norm2"
  top: "conv3"
  param {
    name: "conv3_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv3_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu3"
  type: "ReLU"
  bottom: "conv3"
  top: "conv3"
}

layer {
  name: "conv4"
  type: "Convolution"
  bottom: "conv3"
  top: "conv4"
  param {
    name: "conv4_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv4_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu4"
  type: "ReLU"
  bottom: "conv4"
  top: "conv4"
}

layer {
  name: "conv5"
  type: "Convolution"
  bottom: "conv4"
  top: "conv5"
  param {
    name: "conv5_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv5_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 256
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu5"
  type: "ReLU"
  bottom: "conv5"
  top: "conv5"
}

layer {
  name: "pool5"
  type: "Pooling"
  bottom: "conv5"
  top: "pool5"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}

layer {
  name: "fc6"
  type: "InnerProduct"
  bottom: "pool5"
  top: "fc6"
  param {
    name: "fc6_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "fc6_b"
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu6"
  type: "ReLU"
  bottom: "fc6"
  top: "fc6"
}

layer {
  name: "drop6"
  type: "Dropout"
  bottom: "fc6"
  top: "fc6"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc7"
  type: "InnerProduct"
  bottom: "fc6"
  top: "fc7"
  param {
    name: "fc7_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "fc7_b"
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu7"
  type: "ReLU"
  bottom: "fc7"
  top: "fc7"
}

layer {
  name: "drop7"
  type: "Dropout"
  bottom: "fc7"
  top: "fc7"
  dropout_param {
    dropout_ratio: 0.5
  }
}




####### functionality layers for score regression and attributes  ###########
layer {
  name: "fc8new"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8new"
  param {
    name: "fc8_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 512
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8new"
  type: "ReLU"
  bottom: "fc8new"
  top: "fc8new"
}

layer {
  name: "drop8new"
  type: "Dropout"
  bottom: "fc8new"
  top: "fc8new"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9new"
  type: "InnerProduct"
  bottom: "fc8new"
  top: "fc9new"
  param {
    name: "fc9_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "loss"
  type: "EuclideanLoss"
  bottom: "fc9new"
  bottom: "label"
  top: "loss"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest"
  type: "EuclideanLoss"
  bottom: "fc9new"
  bottom: "label"
  top: "losstest"
  include {
    phase: TEST
  }
}

alexnet_reg+att_train_val.prototxt

name: "ftRankLoss"
layer {
  name: "data"  
  type: "HDF5Data"
  top: "data"
  top: "labels"
  include {    
    phase: TRAIN  
  }
  hdf5_data_param {    
    source: "./muti_train_h5.txt"    
    batch_size: 32    
  }
}

layer {
  name: "data"  
  type: "HDF5Data"
  top: "data"
  top: "labels"
  include {    
    phase: TEST  
  }
  hdf5_data_param {    
    source: "./muti_val_h5.txt"    
    batch_size: 25   
  }
}
layer {
  name: "slice"
  type: "Slice"
  bottom: "labels"
  top: "label_1"
  top: "label_2"
  top: "label_3"
  top: "label_4"
  top: "label_5"
  top: "label_6"
  top: "label_7"
  top: "label_8"
  top: "label_9"
  top: "label_10"
  top: "label_11"
  top: "label_12"
  slice_param {
    axis: 1
    slice_point: 1
    slice_point: 2
    slice_point: 3
    slice_point: 4
    slice_point: 5
    slice_point: 6
    slice_point: 7
    slice_point: 8
    slice_point: 9
    slice_point: 10
    slice_point: 11

  }

}


#### branch-A: shared low-level layers #####
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    name: "conv1_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv1_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 96
    kernel_size: 11
    stride: 4
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu1"
  type: "ReLU"
  bottom: "conv1"
  top: "conv1"
}

layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}

layer {
  name: "norm1"
  type: "LRN"
  bottom: "pool1"
  top: "norm1"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}


layer {
  name: "conv2"
  type: "Convolution"
  bottom: "norm1"
  top: "conv2"
  param {
    name: "conv2_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv2_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 256
    pad: 2
    kernel_size: 5
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu2"
  type: "ReLU"
  bottom: "conv2"
  top: "conv2"
}

layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}

layer {
  name: "norm2"
  type: "LRN"
  bottom: "pool2"
  top: "norm2"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}

layer {
  name: "conv3"
  type: "Convolution"
  bottom: "norm2"
  top: "conv3"
  param {
    name: "conv3_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv3_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu3"
  type: "ReLU"
  bottom: "conv3"
  top: "conv3"
}

layer {
  name: "conv4"
  type: "Convolution"
  bottom: "conv3"
  top: "conv4"
  param {
    name: "conv4_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv4_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu4"
  type: "ReLU"
  bottom: "conv4"
  top: "conv4"
}

layer {
  name: "conv5"
  type: "Convolution"
  bottom: "conv4"
  top: "conv5"
  param {
    name: "conv5_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "conv5_b"
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 256
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu5"
  type: "ReLU"
  bottom: "conv5"
  top: "conv5"
}

layer {
  name: "pool5"
  type: "Pooling"
  bottom: "conv5"
  top: "pool5"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}

layer {
  name: "fc6"
  type: "InnerProduct"
  bottom: "pool5"
  top: "fc6"
  param {
    name: "fc6_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "fc6_b"
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu6"
  type: "ReLU"
  bottom: "fc6"
  top: "fc6"
}

layer {
  name: "drop6"
  type: "Dropout"
  bottom: "fc6"
  top: "fc6"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc7"
  type: "InnerProduct"
  bottom: "fc6"
  top: "fc7"
  param {
    name: "fc7_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "fc7_b"
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

layer {
  name: "relu7"
  type: "ReLU"
  bottom: "fc7"
  top: "fc7"
}

layer {
  name: "drop7"
  type: "Dropout"
  bottom: "fc7"
  top: "fc7"
  dropout_param {
    dropout_ratio: 0.5
  }
}




####### functionality layers for score regression and attributes  ###########
layer {
  name: "fc8new"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8new"
  param {
    name: "fc8_w"
    lr_mult: 1
    decay_mult: 1
  }
  param {
    name: "fc8_b"
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 512
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8new"
  type: "ReLU"
  bottom: "fc8new"
  top: "fc8new"
}

layer {
  name: "drop8new"
  type: "Dropout"
  bottom: "fc8new"
  top: "fc8new"
  dropout_param {
    dropout_ratio: 0.5
  }
}

#layer {
#  name: "fc9new"
#  type: "InnerProduct"
#  bottom: "fc8new"
#  top: "fc9new"
#  param {
#    name: "fc9_w"
#    lr_mult: 1
#    decay_mult: 1
#  }
#  param {
#    name: "fc9_b"
#    lr_mult: 2
#    decay_mult: 0
#  }
#  inner_product_param {
#    num_output: 1
#    weight_filler {
#      type: "gaussian"
#      std: 0.01
#    }
#    bias_filler {
#      type: "constant"
#      value: 0
#    }
#  }
#}



############# BalancingElement
layer {
  name: "fc8_BalancingElement"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_BalancingElement"
  param {
    name: "fc8_BalancingElement_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_BalancingElement_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_BalancingElement"
  type: "ReLU"
  bottom: "fc8_BalancingElement"
  top: "fc8_BalancingElement"
}

layer {
  name: "drop8_BalancingElement"
  type: "Dropout"
  bottom: "fc8_BalancingElement"
  top: "fc8_BalancingElement"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_BalancingElement"
  type: "InnerProduct"
  bottom: "fc8_BalancingElement"
  top: "fc9_BalancingElement"
  param {
    name: "fc9_BalancingElement_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_BalancingElement_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}


############# ColorHarmony
layer {
  name: "fc8_ColorHarmony"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_ColorHarmony"
  param {
    name: "fc8_ColorHarmony_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_ColorHarmony_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_ColorHarmony"
  type: "ReLU"
  bottom: "fc8_ColorHarmony"
  top: "fc8_ColorHarmony"
}

layer {
  name: "drop8_ColorHarmony"
  type: "Dropout"
  bottom: "fc8_ColorHarmony"
  top: "fc8_ColorHarmony"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_ColorHarmony"
  type: "InnerProduct"
  bottom: "fc8_ColorHarmony"
  top: "fc9_ColorHarmony"
  param {
    name: "fc9_ColorHarmony_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_ColorHarmony_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# Content
layer {
  name: "fc8_Content"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_Content"
  param {
    name: "fc8_Content_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_Content_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_Content"
  type: "ReLU"
  bottom: "fc8_Content"
  top: "fc8_Content"
}

layer {
  name: "drop8_Content"
  type: "Dropout"
  bottom: "fc8_Content"
  top: "fc8_Content"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_Content"
  type: "InnerProduct"
  bottom: "fc8_Content"
  top: "fc9_Content"
  param {
    name: "fc9_Content_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_Content_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# DoF
layer {
  name: "fc8_DoF"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_DoF"
  param {
    name: "fc8_DoF_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_DoF_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_DoF"
  type: "ReLU"
  bottom: "fc8_DoF"
  top: "fc8_DoF"
}

layer {
  name: "drop8_DoF"
  type: "Dropout"
  bottom: "fc8_DoF"
  top: "fc8_DoF"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_DoF"
  type: "InnerProduct"
  bottom: "fc8_DoF"
  top: "fc9_DoF"
  param {
    name: "fc9_DoF_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_DoF_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# Light
layer {
  name: "fc8_Light"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_Light"
  param {
    name: "fc8_Light_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_Light_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_Light"
  type: "ReLU"
  bottom: "fc8_Light"
  top: "fc8_Light"
}

layer {
  name: "drop8_Light"
  type: "Dropout"
  bottom: "fc8_Light"
  top: "fc8_Light"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_Light"
  type: "InnerProduct"
  bottom: "fc8_Light"
  top: "fc9_Light"
  param {
    name: "fc9_Light_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_Light_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# MotionBlur
layer {
  name: "fc8_MotionBlur"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_MotionBlur"
  param {
    name: "fc8_MotionBlur_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_MotionBlur_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_MotionBlur"
  type: "ReLU"
  bottom: "fc8_MotionBlur"
  top: "fc8_MotionBlur"
}

layer {
  name: "drop8_MotionBlur"
  type: "Dropout"
  bottom: "fc8_MotionBlur"
  top: "fc8_MotionBlur"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_MotionBlur"
  type: "InnerProduct"
  bottom: "fc8_MotionBlur"
  top: "fc9_MotionBlur"
  param {
    name: "fc9_MotionBlur_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_MotionBlur_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# Object
layer {
  name: "fc8_Object"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_Object"
  param {
    name: "fc8_Object_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_Object_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_Object"
  type: "ReLU"
  bottom: "fc8_Object"
  top: "fc8_Object"
}

layer {
  name: "drop8_Object"
  type: "Dropout"
  bottom: "fc8_Object"
  top: "fc8_Object"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_Object"
  type: "InnerProduct"
  bottom: "fc8_Object"
  top: "fc9_Object"
  param {
    name: "fc9_Object_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_Object_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# Repetition
layer {
  name: "fc8_Repetition"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_Repetition"
  param {
    name: "fc8_Repetition_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_Repetition_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_Repetition"
  type: "ReLU"
  bottom: "fc8_Repetition"
  top: "fc8_Repetition"
}

layer {
  name: "drop8_Repetition"
  type: "Dropout"
  bottom: "fc8_Repetition"
  top: "fc8_Repetition"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_Repetition"
  type: "InnerProduct"
  bottom: "fc8_Repetition"
  top: "fc9_Repetition"
  param {
    name: "fc9_Repetition_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_Repetition_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# RuleOfThirds
layer {
  name: "fc8_RuleOfThirds"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_RuleOfThirds"
  param {
    name: "fc8_RuleOfThirds_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_RuleOfThirds_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_RuleOfThirds"
  type: "ReLU"
  bottom: "fc8_RuleOfThirds"
  top: "fc8_RuleOfThirds"
}

layer {
  name: "drop8_RuleOfThirds"
  type: "Dropout"
  bottom: "fc8_RuleOfThirds"
  top: "fc8_RuleOfThirds"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_RuleOfThirds"
  type: "InnerProduct"
  bottom: "fc8_RuleOfThirds"
  top: "fc9_RuleOfThirds"
  param {
    name: "fc9_RuleOfThirds_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_RuleOfThirds_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# Symmetry
layer {
  name: "fc8_Symmetry"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_Symmetry"
  param {
    name: "fc8_Symmetry_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_Symmetry_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_Symmetry"
  type: "ReLU"
  bottom: "fc8_Symmetry"
  top: "fc8_Symmetry"
}

layer {
  name: "drop8_Symmetry"
  type: "Dropout"
  bottom: "fc8_Symmetry"
  top: "fc8_Symmetry"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_Symmetry"
  type: "InnerProduct"
  bottom: "fc8_Symmetry"
  top: "fc9_Symmetry"
  param {
    name: "fc9_Symmetry_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_Symmetry_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

############# VividColor
layer {
  name: "fc8_VividColor"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8_VividColor"
  param {
    name: "fc8_VividColor_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc8_VividColor_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu8_VividColor"
  type: "ReLU"
  bottom: "fc8_VividColor"
  top: "fc8_VividColor"
}

layer {
  name: "drop8_VividColor"
  type: "Dropout"
  bottom: "fc8_VividColor"
  top: "fc8_VividColor"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc9_VividColor"
  type: "InnerProduct"
  bottom: "fc8_VividColor"
  top: "fc9_VividColor"
  param {
    name: "fc9_VividColor_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc9_VividColor_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}



layer {
  name: "Concat9"
  bottom: "fc8new"
  bottom: "fc8_BalancingElement"
  bottom: "fc8_ColorHarmony"
  bottom: "fc8_Content"
  bottom: "fc8_DoF"
  bottom: "fc8_Light"
  bottom: "fc8_MotionBlur"
  bottom: "fc8_Object"
  bottom: "fc8_Repetition"
  bottom: "fc8_RuleOfThirds"
  bottom: "fc8_Symmetry"
  bottom: "fc8_VividColor"
  top: "Concat9"
  type: "Concat"
  concat_param {
    axis: 1
  }
}

layer {
  name: "fc10_merge"
  type: "InnerProduct"
  bottom: "Concat9"
  top: "fc10_merge"
  param {
    name: "fc10_merge_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc10_merge_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 128
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

layer {
  name: "relu10_merge"
  type: "ReLU"
  bottom: "fc10_merge"
  top: "fc10_merge"
}

layer {
  name: "drop10_merge"
  type: "Dropout"
  bottom: "fc10_merge"
  top: "fc10_merge"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "fc11_score"
  type: "InnerProduct"
  bottom: "fc10_merge"
  top: "fc11_score"
  param {
    name: "fc11_score_w"
    lr_mult: 10
    decay_mult: 1
  }
  param {
    name: "fc11_score_b"
    lr_mult: 20
    decay_mult: 0
  }
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

#____________________1_____________
layer {
  name: "loss_1"
  type: "EuclideanLoss"
  bottom: "fc9_VividColor"
  bottom: "label_1"
  top: "loss_1"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_1"
  type: "EuclideanLoss"
  bottom: "fc9_VividColor"
  bottom: "label_1"
  top: "losstest_1"
  include {
    phase: TEST
  }
}
#____________________2_____________
layer {
  name: "loss_2"
  type: "EuclideanLoss"
  bottom: "fc9_Symmetry"
  bottom: "label_2"
  top: "loss_2"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_2"
  type: "EuclideanLoss"
bottom: "fc9_Symmetry"
  bottom: "label_2"
  top: "losstest_2"
  include {
    phase: TEST
  }
}
#____________3_____________

layer {
  name: "loss_3"
  type: "EuclideanLoss"
  bottom: "fc9_RuleOfThirds"
  bottom: "label_3"
  top: "loss_3"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_3"
  type: "EuclideanLoss"
  bottom: "fc9_RuleOfThirds"
  bottom: "label_3"
  top: "losstest_3"
  include {
    phase: TEST
  }
}
#_________________4__________
layer {
  name: "loss_4"
  type: "EuclideanLoss"
  bottom: "fc9_Repetition"
  bottom: "label_4"
  top: "loss_4"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_4"
  type: "EuclideanLoss"
  bottom: "fc9_Repetition"
  bottom: "label_4"
  top: "losstest_4"
  include {
    phase: TEST
  }
}
#___________________5_____________

layer {
  name: "loss_5"
  type: "EuclideanLoss"
  bottom: "fc9_Object"
  bottom: "label_5"
  top: "loss_5"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_5"
  type: "EuclideanLoss"
  bottom: "fc9_Object"
  bottom: "label_5"
  top: "losstest_5"
  include {
    phase: TEST
  }
}
#________________6_____________

layer {
  name: "loss_6"
  type: "EuclideanLoss"
  bottom: "fc9_MotionBlur"
  bottom: "label_6"
  top: "loss_6"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_6"
  type: "EuclideanLoss"
  bottom: "fc9_MotionBlur"
  bottom: "label_6"
  top: "losstest_6"
  include {
    phase: TEST
  }
}
#_________________7_________________
layer {
  name: "loss_7"
  type: "EuclideanLoss"
  bottom: "fc9_Light"
  bottom: "label_7"
  top: "loss_7"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_7"
  type: "EuclideanLoss"
  bottom: "fc9_Light"
  bottom: "label_7"
  top: "losstest_7"
  include {
    phase: TEST
  }
}
#______________8_________

layer {
  name: "loss_8"
  type: "EuclideanLoss"
  bottom: "fc9_DoF"
  bottom: "label_8"
  top: "loss_8"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_8"
  type: "EuclideanLoss"
  bottom: "fc9_DoF"
  bottom: "label_8"
  top: "losstest_8"
  include {
    phase: TEST
  }
}
#___________________9_____________

layer {
  name: "loss_9"
  type: "EuclideanLoss"
  bottom: "fc9_Content"
  bottom: "label_9"
  top: "loss_9"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_9"
  type: "EuclideanLoss"
  bottom: "fc9_Content"
  bottom: "label_9"
  top: "losstest_9"
  include {
    phase: TEST
  }
}
#________________10________

layer {
  name: "loss_10"
  type: "EuclideanLoss"
  bottom: "fc9_ColorHarmony"
  bottom: "label_10"
  top: "loss_10"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_10"
  type: "EuclideanLoss"
  bottom: "fc9_ColorHarmony"
  bottom: "label_10"
  top: "losstest_10"
  include {
    phase: TEST
  }
}
#____________11________
layer {
  name: "loss_11"
  type: "EuclideanLoss"
  bottom: "fc9_BalancingElement"
  bottom: "label_11"
  top: "loss_11"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_11"
  type: "EuclideanLoss"
  bottom: "fc9_BalancingElement"
  bottom: "label_11"
  top: "losstest_11"
  include {
    phase: TEST
  }
}
#______________12___________
layer {
  name: "loss_12"
  type: "EuclideanLoss"
  bottom: "fc11_score"
  bottom: "label_12"
  top: "loss_12"
  include {
    phase: TRAIN
  }
}
layer {
  name: "losstest_12"
  type: "EuclideanLoss"
  bottom: "fc11_score"
  bottom: "label_12"
  top: "losstest_12"
  include {
    phase: TEST
  }
}

猜你喜欢

转载自blog.csdn.net/qq_21275321/article/details/77161311