├── imagenet_mean_227.binaryproto ├── Caffe ├── test_100_mean.binaryproto ├── train_500_mean.binaryproto ├── solver.prototxt ├── caffeTraining.py ├── CaffeInference.py ├── Createlmdb.py └── ms_emotion.py ├── pre_trained network ├── resnet50 │ ├── ResNet_mean.binaryproto │ ├── resnet50_solver.prototxt │ ├── ResNet-50-deploy.prototxt │ └── resnet50_train_val.prototxt ├── vgg19 │ ├── train_command.sh │ ├── vgg19_solver.prototxt │ ├── VGG_ILSVRC_19_layers_deploy.prototxt │ └── VGG_ILSVRC_19_layers_train_val.prototxt └── alexnet │ ├── alexnet_solver.prototxt │ ├── deploy.prototxt │ ├── alexnet_deploy.prototxt │ └── alexnet_train_val.prototxt ├── generate_fake_dataset.py ├── featurefool └── README.md ├── rename_image_file.py ├── README.md ├── test_optimize.py ├── readTrafficSigns.py ├── MCV_query.py ├── utils.py ├── tmp.prototxt └── optimize.py /imagenet_mean_227.binaryproto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yunyuntsai/DNN-Model-Stealing/HEAD/imagenet_mean_227.binaryproto -------------------------------------------------------------------------------- /Caffe/test_100_mean.binaryproto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yunyuntsai/DNN-Model-Stealing/HEAD/Caffe/test_100_mean.binaryproto -------------------------------------------------------------------------------- /Caffe/train_500_mean.binaryproto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yunyuntsai/DNN-Model-Stealing/HEAD/Caffe/train_500_mean.binaryproto -------------------------------------------------------------------------------- /pre_trained network/resnet50/ResNet_mean.binaryproto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yunyuntsai/DNN-Model-Stealing/HEAD/pre_trained network/resnet50/ResNet_mean.binaryproto -------------------------------------------------------------------------------- /generate_fake_dataset.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import scipy.misc 3 | import readTrafficSigns 4 | 5 | import rename_image_file 6 | 7 | rootpath = '/home/exx/' 8 | readTrafficSigns.readTrafficSigns(rootpath) 9 | 10 | 11 | -------------------------------------------------------------------------------- /Caffe/solver.prototxt: -------------------------------------------------------------------------------- 1 | 2 | net: "/home/yunyuntsai/Documents/Caffe/vgg19_train_val_deepid_mcv_traffic.prototxt" 3 | test_iter: 100 4 | test_interval: 1000 5 | base_lr: 0.0001 6 | momentum: 0.9 7 | gamma : 0.1 8 | weight_decay: 0.0005 9 | lr_policy: "step" 10 | stepsize : 1000 11 | display: 100 12 | max_iter: 10000 13 | snapshot: 2000 14 | #snapshot_format: HDF5 15 | snapshot_prefix: "model/emotion-model" 16 | solver_mode: GPU 17 | 18 | -------------------------------------------------------------------------------- /pre_trained network/vgg19/train_command.sh: -------------------------------------------------------------------------------- 1 | /home/exx/Documents/caffe/build/tools/caffe train --solver=/home/exx/Documents/pretrain_networks/VGG19/vgg19_solver.prototxt --gpu=0,1,2,3 --weights /home/exx/Documents/pretrain_networks/VGG19/featurefool_retrained_caffe_model1290_transferalxnet/vgg19_solver_iter_3000.caffemodel 2>&1 | tee /home/exx/Documents/pretrain_networks/VGG19/featurefool_retrained_caffe_model2150_transferalxnet/model_train.log 2 | -------------------------------------------------------------------------------- /pre_trained network/alexnet/alexnet_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "/home/exx/Documents/pretrain_networks/AlexNet/alexnet_train_val.prototxt" 2 | test_iter: 1000 3 | test_interval: 1000 4 | base_lr: 0.01 5 | lr_policy: "step" 6 | gamma: 0.1 7 | stepsize: 1000 8 | display: 20 9 | max_iter: 3000 10 | momentum: 0.9 11 | weight_decay: 0.0005 12 | snapshot: 1000 13 | snapshot_prefix: "/home/exx/Documents/pretrain_networks/AlexNet/featurefool_retrained_caffe_model2150_transferalxnet" 14 | solver_mode: GPU -------------------------------------------------------------------------------- /pre_trained network/resnet50/resnet50_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "/home/exx/Documents/pretrain_networks/ResNet50/resnet50_train_val.prototxt" 2 | #test_iter: 6000 3 | #test_interval: 50000 4 | #test_initialization: true 5 | display: 1000 6 | average_loss: 1000 7 | base_lr: 0.1 8 | lr_policy: "step" 9 | stepsize: 1000 10 | gamma: 0.1 11 | max_iter: 3000 12 | momentum: 0.9 13 | weight_decay: 0.0001 14 | snapshot: 1000 15 | snapshot_prefix: "/home/exx/Documents/pretrain_networks/ResNet50/featurefool_retrained_caffe_model2150_transferalxnet" 16 | solver_mode: GPU 17 | 18 | 19 | -------------------------------------------------------------------------------- /pre_trained network/vgg19/vgg19_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "/home/exx/Documents/pretrain_networks/VGG19/VGG_ILSVRC_19_layers_train_val.prototxt" 2 | test_iter: 915 3 | test_interval: 1000 4 | # lr for fine-tuning should be lower than when starting from scratch 5 | base_lr: 0.001 6 | lr_policy: "step" 7 | gamma: 0.1 8 | # decrease lr each 20000 iterations 9 | stepsize: 1000 10 | display: 100 11 | max_iter: 3000 12 | momentum: 0.9 13 | weight_decay: 0.0005 14 | snapshot: 1000 15 | snapshot_prefix: "/home/exx/Documents/pretrain_networks/VGG19/featurefool_retrained_caffe_model2150_transferalxnet/" 16 | solver_mode: GPU -------------------------------------------------------------------------------- /Caffe/caffeTraining.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.insert(1, "/usr/lib/python3/dist-packages") 3 | import caffe 4 | train_file = '/home/yunyuntsai/Documents/Caffe/vgg19_train_val_deepid_mcv_traffic.prototxt' 5 | caffe_model = '/home/yunyuntsai/Documents/Caffe/VGG_ILSVRC_19_layers.caffemodel' 6 | 7 | net = caffe.Net(train_file,caffe_model,caffe.TRAIN) 8 | 9 | solver_file = 'solver.prototxt' #sovler文件保存位置 10 | caffe.set_device(0) #选择GPU-0 11 | caffe.set_mode_gpu() 12 | solver = caffe.SGDSolver(solver_file) 13 | solver.net.copy_from(caffe_model) 14 | solver.solve() 15 | -------------------------------------------------------------------------------- /featurefool/README.md: -------------------------------------------------------------------------------- 1 | # Under Convnet 2 | 3 | Implementation of the paper ["Adversarial Manipulation of Deep 4 | Representations"](http://arxiv.org/abs/1511.05122). The code can manipulate 5 | the representation of an image in a deep neural network (DNN) to mimic those of 6 | other natural images, with only minor, imperceptible perturbations to the 7 | original image. 8 | 9 | ## Dependencies 10 | 11 | This code is written in python. To use it you will need: 12 | 13 | * [Caffe](http://caffe.berkeleyvision.org) 14 | 15 | In `utils.py` set `caffe_root` to your installation path. 16 | 17 | ## Reference 18 | 19 | If you found this code useful, please cite the following paper: 20 | 21 | @article{sabour2015adversarial, 22 | title={Adversarial Manipulation of Deep Representations}, 23 | author={Sabour, Sara and Cao, Yanshuai and Faghri, Fartash and Fleet, 24 | David J}, 25 | journal={arXiv preprint arXiv:1511.05122}, 26 | year={2015} 27 | } 28 | 29 | ## License 30 | 31 | [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) 32 | -------------------------------------------------------------------------------- /rename_image_file.py: -------------------------------------------------------------------------------- 1 | import os 2 | import csv 3 | 4 | def rename(file_path,csv_path): 5 | #path='/home/exx/Documents/MCV_Fake_Dataset/Ad_Images_Traffic/' 6 | path=file_path 7 | n=0 8 | f=os.listdir(path) 9 | query_file_name = csv_path 10 | #gtFile = open('MCV_Traffic_Query.csv') # annotations file 11 | gtFile = open(query_file_name) 12 | gtReader = csv.reader(gtFile, delimiter=',') # csv parser for annotations file 13 | #gtReader.next() # skip header 14 | # loop over all images in current annotations file 15 | num = 0 16 | for row in gtReader: 17 | labels = [] 18 | ad_images_name = row[0] + '.png'# the 1th column is the filename 19 | #images.append(plt.imread(prefix + row[0])) # the 1th column is the filename 20 | labels.append(row[1]) # the 2th column is the label 21 | 22 | # Generate Adversarial Examples 23 | i=[] 24 | for i in f: 25 | #print i 26 | if i==ad_images_name: 27 | oldname=path+i 28 | newname=path+'class%d_'%int(labels[0]) + '%d'%int(num) + '_' + row[0] + '.png' 29 | os.rename(oldname,newname) 30 | print(oldname,'======>',newname) 31 | num = num + 1 32 | else: 33 | x=0 34 | gtFile.close() 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DNN Models Extraction 2 | This is the repo for [CloudLeak: Large-Scale Deep Learning Models Stealing Through Adversarial Examples](https://www.ndss-symposium.org/wp-content/uploads/2020/02/24178.pdf), Honggang Yu, Kaichen Yang, Teng Zhang, Yun-Yun Tsai, Tsung-Yi Ho, Yier Jin, in Proceeding of [Network and Distributed System Security Symposium (NDSS)](https://www.ndss-symposium.org/ndss2020/), 2020. Our code is implemented in Python 3.6 and Caffe. 3 | 4 | The following figure illustrates the transfer framework for our proposed model extraction method:
5 | ![Alt text](https://user-images.githubusercontent.com/20013955/99144591-07a8ea00-26a2-11eb-899b-96a6b97016d8.PNG)
6 |
7 | (a) generate unlabeled adversarial examples as synthetic dataset.
8 | (b) query victim model using the generated synthetic dataset.
9 | (c) label adversarial examples according to the output of the victim model.
10 | (d) train the local substitute model using the synthetic dataset.
11 | (e) use the local substitute model for predictions. The local substitute model is expected to match the performance of the victim model.
12 | 13 | For more detail, please refer to our [slides](https://www.ndss-symposium.org/wp-content/uploads/24178-slides.pdf), and [video](https://www.youtube.com/watch?v=tSUQl85Hprs&list=PLfUWWM-POgQuRxr8iZwL_6Dw-isT5CHUt&index=3&t=0s). 14 | -------------------------------------------------------------------------------- /test_optimize.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import utils 3 | import optimize 4 | import PIL 5 | from PIL import Image 6 | 7 | model_name = 'caffenet' 8 | layer = 'fc7' 9 | net = utils.init_model(model_name) 10 | 11 | src_fname = 'val_13.JPEG' 12 | guide_fname = 'val_23.JPEG' 13 | src = utils.read_image_rgb(src_fname, net) 14 | guide = utils.read_image_rgb(guide_fname, net) 15 | 16 | utils.showarray_noproc(src) 17 | 18 | utils.showarray_noproc(guide) 19 | 20 | iter_n=10 21 | max_thres=10. 22 | ad, bc, cd = optimize.optimize_single(src_fname, guide_fname, model_name, layer, iter_n, max_thres, net) 23 | 24 | diff = ad - src 25 | print np.max(np.abs(diff)) 26 | 27 | #utils.showarray_noproc(ad) 28 | #utils.showarray_noproc(diff) 29 | #utils.showarray_noproc(src) 30 | 31 | img = PIL.Image.fromarray(np.uint8(ad)) 32 | #img = Image.fromarray(np.uint8(ad)) 33 | #img.save("/home/honggang/Documents/ad5.png") 34 | #img.save("/home/honggang/Documents/"+ '%d' %100 + '_%d' %100 + '.png') 35 | 36 | img.save('ad.png') 37 | 38 | 39 | proc_src = utils.preprocess(net, src) 40 | proc_guide = utils.preprocess(net, guide) 41 | 42 | f_src = utils.extract_feat(net, proc_src, layer) 43 | f_guide = utils.extract_feat(net, proc_guide, layer) 44 | print f_src.shape 45 | 46 | diff=(f_src - f_guide).flatten() 47 | print "Initial euclidean distance: %.4f" % (np.dot(diff, diff)**.5) 48 | 49 | proc_ad = utils.preprocess(net, ad) 50 | f_ad = utils.extract_feat(net, proc_ad, layer) 51 | diff=(f_ad - f_guide).flatten() 52 | print "Final euclidean distance: %.4f" % (np.dot(diff, diff)**.5) -------------------------------------------------------------------------------- /Caffe/CaffeInference.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.insert(1, "/usr/lib/python3/dist-packages") 3 | import caffe 4 | import csv 5 | import matplotlib.pyplot as plt 6 | 7 | import numpy as np 8 | 9 | deploy_file ='vgg19_deepid_mcv_traffic_deploy.prototxt' 10 | caffe_model = 'model/emotion-model_iter_10000.caffemodel' 11 | net = caffe.Net(deploy_file,caffe_model,caffe.TEST) 12 | #net = caffe.Classifier(deploy_file, caffe_model) 13 | #test_image = 'ferdata/FER2013Valid/fer0028657.png' 14 | 15 | #图片预处理设置 16 | transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape}) #设定图片的shape格式(1,3,28,28) 17 | transformer.set_transpose('data', (2,0,1)) #改变维度的顺序,由原始图片(28,28,3)变为(3,28,28) 18 | #transformer.set_mean('data', np.load(mean_file).mean(1).mean(1)) #减去均值,前面训练模型时没有减均值,这儿就不用 19 | #transformer.set_raw_scale('data', 255) # 缩放到【0,255】之间 20 | #transformer.set_channel_swap('data', (2,1,0)) #交换通道,将图片由RGB变为BGR 21 | 22 | dir_path = sys.argv[1] 23 | with open(dir_path, "r") as f: 24 | true_count = 0 25 | count = 0 26 | reader = csv.reader(f) 27 | for row in reader: 28 | test_image = row[0] 29 | true_label = row[1] 30 | print(test_image) 31 | im=caffe.io.load_image(test_image) #加载图片 32 | print(im.shape) 33 | input = [im] 34 | # Classify image 35 | #prediction = net.predict(input) # predict takes any number of images, and formats them for the Caffe net automatically 36 | #print('predicted classes: ',prediction) 37 | #plt.imshow(im) 38 | #plt.show() 39 | net.blobs['data'].data[...] = transformer.preprocess('data',im) #执行上面设置的图片预处理操作,并将图片载入到blob中 40 | # print(net) 41 | # #执行测试 42 | out = net.forward() 43 | # 44 | # # labels = np.loadtxt(labels_filename, str, delimiter='\t') #读取类别名称文件 45 | prob= net.blobs['prob'].data[0].flatten() #取出最后一层(Softmax)属于某个类别的概率值,并打印 46 | # #print("prob: ",prob) 47 | order=prob.argsort()[-1] #将概率值排序,取出最大值所在的序号 48 | print ('predict class: %i true label: %i' %(int(order), int(true_label))) #将该序号转换成对应的类别名称,并打印 49 | if int(order) == int(true_label): 50 | true_count = true_count+1 51 | count = count+1 52 | print("Total : %i True: %i Acc: %.2f" % (count, true_count, float(true_count/count))) 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /readTrafficSigns.py: -------------------------------------------------------------------------------- 1 | # The German Traffic Sign Recognition Benchmark 2 | # 3 | # sample code for reading the traffic sign images and the 4 | # corresponding labels 5 | # 6 | # example: 7 | # 8 | # trainImages, trainLabels = readTrafficSigns('GTSRB/Training') 9 | # print len(trainLabels), len(trainImages) 10 | # plt.imshow(trainImages[42]) 11 | # plt.show() 12 | # 13 | # have fun, Christian 14 | 15 | import matplotlib.pyplot as plt 16 | import csv 17 | import PIL 18 | from PIL import Image 19 | import optimize 20 | import utils 21 | import numpy as np 22 | import os 23 | # function for reading the images 24 | # arguments: path to the traffic sign data, for example './GTSRB/Training' 25 | # returns: list of images, list of corresponding labels 26 | def readTrafficSigns(rootpath): #/home/honggang/Documents/Steal_DL_Models/MCV_Fake_Dataset/ 27 | '''Reads traffic sign data for German Traffic Sign Recognition Benchmark. 28 | 29 | Arguments: path to the traffic sign data, for example './GTSRB/Training' 30 | Returns: list of images, list of corresponding labels''' 31 | images = [] # images 32 | labels = [] # corresponding labels 33 | model_name = 'caffenet' #???????????????????????????????????????????????? 34 | layer = 'fc7' 35 | net = utils.init_model(model_name) 36 | # loop over all 42 classes 37 | num = 0 38 | #for c in range(0,43): 39 | #prefix = rootpath + 'Source_Images_Traffic'+'/' # subdirectory for class 40 | prefix = '/home/exx/Documents/dataset_all/gtsrb_2150/' #???????????????????????????????????????????????? 41 | ad_image_save_path = '/home/exx/Documents/dataset_all/' + 'featureadversary_dataset2150' + '/' #???????????????????????????????????????????????? 42 | gtFile = open('/home/exx/Documents/dataset_all/' + 'MCV_Traffic_Query2150.csv') # annotations file #???????????????????????????????????????????????? 43 | gtReader = csv.reader(gtFile, delimiter=',') # csv parser for annotations file 44 | #gtReader.next() # skip header 45 | # loop over all images in current annotations file 46 | for row in gtReader: 47 | labels = [] 48 | source_images_path = prefix + row[0] + '.jpg'# the 1th column is the filename 49 | #images.append(plt.imread(prefix + row[0])) # the 1th column is the filename 50 | #labels.append(row[1]) # the 2th column is the label 51 | labels=row[2] # the 3th column is the label 52 | #labels.append(row[3]) # the 4th column is the label 53 | #labels.append(row[4]) # the 5th column is the label 54 | #labels.append(row[5]) # the 6th column is the label 55 | print source_images_path 56 | print labels 57 | #print labels[1] 58 | #print labels[2] 59 | #print labels[3] 60 | #print labels[4] 61 | 62 | os.system("pause"); 63 | # Generate Adversarial Examples 64 | src_fname = source_images_path 65 | src = utils.read_image_rgb(src_fname, net) 66 | #for i in range(0,5): 67 | guide_images_path = '/home/exx/Documents/dataset_all/' + 'Guide_Images_Traffic' + '/' + labels + '/' + 'guide.jpg' 68 | guide_fname = guide_images_path 69 | guide = utils.read_image_rgb(guide_fname, net) 70 | iter_n=10 71 | max_thres=5 72 | ad, bc, cd = optimize.optimize_single(src_fname, guide_fname, model_name, layer, iter_n, max_thres, net) 73 | img = PIL.Image.fromarray(np.uint8(ad)) 74 | img.save(ad_image_save_path + '%d'%int(num) + '_' + '%d'%int(labels) + '.jpg') #c-source label labels[i]-guide label 75 | num = num + 1 76 | 77 | gtFile.close() 78 | #return images, labels 79 | -------------------------------------------------------------------------------- /MCV_query.py: -------------------------------------------------------------------------------- 1 | from azure.cognitiveservices.vision.customvision.prediction import prediction_endpoint 2 | from azure.cognitiveservices.vision.customvision.training import training_api 3 | from azure.cognitiveservices.vision.customvision.prediction.prediction_endpoint import models 4 | import sklearn.metrics 5 | import pandas as pd 6 | import numpy as np 7 | import itertools 8 | import os 9 | import csv 10 | from os.path import join 11 | import glob 12 | from matplotlib.pyplot import tight_layout, ylabel, figure, imshow, yticks, colorbar, xticks, show, xlabel, cm, text, \ 13 | suptitle 14 | 15 | 16 | def plot_confusion_matrix(cm, classes, 17 | normalize=False, 18 | title='Confusion matrix', 19 | cmap=cm.Blues): 20 | """ 21 | This function prints and plots the confusion matrix. 22 | Normalization can be applied by setting `normalize=True`. 23 | """ 24 | imshow(cm, interpolation='nearest', cmap=cmap) 25 | suptitle(title, fontsize=14, horizontalalignment="right") 26 | colorbar() 27 | tick_marks = np.arange(len(classes)) 28 | xticks(tick_marks, classes, rotation=45, horizontalalignment="right") 29 | yticks(tick_marks, classes) 30 | 31 | if normalize: 32 | cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] 33 | print("Normalized confusion matrix") 34 | else: 35 | print('Confusion matrix, without normalization') 36 | 37 | print(cm) 38 | 39 | thresh = cm.max() / 2. 40 | for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])): 41 | text(j, i, "{:0.2f}".format(cm[i, j]), 42 | horizontalalignment="center", 43 | size=8, 44 | color="white" if cm[i, j] > thresh else "black") 45 | 46 | tight_layout() 47 | ylabel('True label') 48 | 49 | 50 | ###CHANGE testdata path####################### 51 | dir_src = "TestImages/traffic_testImages" 52 | 53 | ###CHANGE ProjectID###### 54 | project_Id = "" 55 | 56 | ###CHANGE output path### 57 | outputPath = "MCV_Query.csv" 58 | ############################################# 59 | 60 | training_key = "" 61 | prediction_key = "" 62 | 63 | predictor = prediction_endpoint.PredictionEndpoint(prediction_key) 64 | print(predictor) 65 | trainer = training_api.TrainingApi(training_key) 66 | project = trainer.get_project(project_Id) 67 | print(project.id) 68 | 69 | tags = trainer.get_tags(project.id) 70 | 71 | tag_dic = {} 72 | tag = [] 73 | for t in tags: 74 | tag.append(t.name) 75 | tag_dic[t.name] = t.id 76 | 77 | 78 | count = 0 79 | test_ids = [] 80 | preds = [] 81 | 82 | test_dir = os.listdir(dir_src) 83 | test_dir.sort() 84 | for d in test_dir: 85 | d_path = join(dir_src, d) 86 | image_dir = os.listdir(d_path) 87 | for p in image_dir: 88 | 89 | path = join(d_path, p) 90 | print(path) 91 | with open(path, mode="rb") as test_data: 92 | #print(test_data) 93 | results = predictor.predict_image(project.id, test_data) 94 | 95 | # Display the results. 96 | re = [] 97 | re.append(path.split('/')[2] + "_" + path.split('/')[-1][:-4]) 98 | for i in range(0,5): 99 | predictedClass = results.predictions[i].tag_name 100 | predictedProb = results.predictions[i].probability 101 | print(predictedClass) 102 | print(predictedProb) 103 | 104 | re.append(predictedClass) 105 | print(re) 106 | with open(outputPath, "a") as f: 107 | for r in re: 108 | f.write(r+",") 109 | f.write("\n") 110 | 111 | f.close() 112 | 113 | 114 | input("All done. Press any key...") 115 | 116 | -------------------------------------------------------------------------------- /Caffe/Createlmdb.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.insert(1, "/usr/lib/python3/dist-packages") 3 | from PIL import Image 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | import csv 7 | import cv2 8 | import caffe 9 | from caffe.proto import caffe_pb2 10 | import lmdb 11 | 12 | def ComputeMean(dir_path,mean_file_write_to): 13 | #resize 尺寸 14 | protosize=(48,48) 15 | 16 | #可以限定生成均值图像使用的图像数量 17 | mean_count=100 18 | i=0 19 | totalMean=np.zeros((protosize[0],protosize[1],3), dtype=np.float) 20 | accedImage=np.zeros((protosize[0],protosize[1],3), dtype=np.float) 21 | with open(dir_path,"r") as f: 22 | reader = csv.reader(f) 23 | for row in reader: 24 | if(i < mean_count): 25 | img_path= row[0] 26 | img_data=cv2.imread(img_path) 27 | img_resized=cv2.resize(img_data,protosize,interpolation=cv2.INTER_LINEAR) 28 | cv2.accumulate(img_resized,accedImage) 29 | 30 | #累计1000次计算一次均值速度会快一些,如果图像太多汇总起来再计算可能会溢出。 31 | if(i%10 ==0 and i>0): 32 | accedImage=accedImage/float(mean_count) 33 | cv2.accumulate(accedImage,totalMean) 34 | accedImage=np.zeros((protosize[0],protosize[1],3), dtype=np.float) 35 | print( "processed: "+str(i)) 36 | if i==mean_count: 37 | break 38 | i=i+1 39 | accedImage=accedImage/float(mean_count) 40 | cv2.accumulate(accedImage,totalMean) 41 | 42 | 43 | #for RGB image 44 | # totalMean=totalMean.transpose((2, 0, 1)) 45 | 46 | # 存储为binaryproto 47 | blob = caffe_pb2.BlobProto() 48 | blob.channels=3 49 | blob.height = protosize[0] 50 | blob.width = protosize[1] 51 | blob.num=1 52 | blob.data.extend(totalMean.astype(float).flat) 53 | binaryproto_file = open(mean_file_write_to, 'wb' ) 54 | binaryproto_file.write(blob.SerializeToString()) 55 | binaryproto_file.close() 56 | 57 | N = 100 58 | 59 | # Let's pretend this is interesting data 60 | X = np.zeros((N, 3, 48, 48), dtype=np.float) 61 | Y = np.zeros(N, dtype=np.int) 62 | 63 | dir_path = 'caffedata/Caffe_testing_100.csv' 64 | i=0 65 | with open(dir_path, "r") as f: 66 | reader = csv.reader(f) 67 | for row in reader: 68 | if(i < N): 69 | images_plt = plt.imread(row[0]) 70 | # convert your lists into a numpy array of size (N, H, W, C) 71 | im2arr = np.array(images_plt) 72 | print(im2arr.shape) 73 | nchannels = 3 74 | new_img = np.resize(im2arr,(nchannels,im2arr.shape[0],im2arr.shape[1])) 75 | 76 | X[i] = new_img 77 | Y[i] = int(row[1]) 78 | i = i+1 79 | print("-------------------------------------------------------------------------") 80 | 81 | print(X) 82 | print(Y) 83 | 84 | map_size = X.nbytes * 10 85 | 86 | env = lmdb.open('test_100_lmdb', map_size=map_size) 87 | 88 | with env.begin(write=True) as txn: 89 | # txn is a Transaction object 90 | for i in range(N): 91 | datum = caffe.proto.caffe_pb2.Datum() 92 | datum.channels = X.shape[1] 93 | datum.width = X.shape[2] 94 | datum.height = X.shape[3] 95 | datum.data = X[i].tobytes() # or .tostring() if numpy < 1.9 96 | datum.label = int(Y[i]) 97 | str_id = '{:08}'.format(i) 98 | 99 | # The encode is only essential in Python 3 100 | txn.put(str_id.encode('ascii'),datum.SerializeToString()) 101 | ComputeMean(dir_path,'test_100_mean.binaryproto') 102 | # train_file = '/home/yunyuntsai/Documents/Caffe/vgg19_train_val_deepid_mcv_traffic.prototxt' 103 | # caffe_model = '/home/yunyuntsai/Documents/Caffe/VGG_ILSVRC_19_layers.caffemodel' 104 | # 105 | # net = caffe.Net(train_file,caffe_model,caffe.TRAIN) -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import PIL 3 | from IPython.display import display 4 | import numpy as np 5 | import sys 6 | from google.protobuf import text_format 7 | import matplotlib 8 | matplotlib.use('Agg') 9 | import pylab as plt # NOQA 10 | caffe_root = '/home/exx/Documents/caffe/' 11 | sys.path.insert(0, caffe_root + 'python') 12 | import caffe # NOQA 13 | caffe.set_mode_gpu() 14 | 15 | 16 | def binary_to_nparray(binAdr): 17 | blob = caffe.proto.caffe_pb2.BlobProto() 18 | data = open(binAdr, 'rb').read() 19 | blob.ParseFromString(data) 20 | arr = np.array(caffe.io.blobproto_to_array(blob)) 21 | arr = arr[0, ...] 22 | return arr 23 | 24 | 25 | model_path_dict = {'caffenet': '/home/exx/Documents/pretrain_networks/AlexNet/retrained_caffe_model2150/', 26 | } 27 | 28 | net_fn_dict = {'caffenet': '/home/exx/Documents/pretrain_networks/AlexNet/alexnet_deploy.prototxt', 29 | } 30 | 31 | param_fn_dict = {'caffenet': '/home/exx/Documents/pretrain_networks/AlexNet/retrained_caffe_model2150/alexnet_solver_iter_1000.caffemodel', 32 | } 33 | 34 | data_mean_dict = {'caffenet': 35 | binary_to_nparray('/home/exx/Documents/dataset_all/randomdataset2150_train_mean.binaryproto'), 36 | } 37 | 38 | 39 | def init_model(model_name): 40 | model_path = model_path_dict[model_name] 41 | net_fn = net_fn_dict[model_name] 42 | param_fn = param_fn_dict[model_name] 43 | model = caffe.io.caffe_pb2.NetParameter() 44 | text_format.Merge(open(net_fn).read(), model) 45 | model.force_backward = True 46 | open('tmp.prototxt', 'w').write(str(model)) 47 | 48 | net = caffe.Classifier('tmp.prototxt', param_fn, 49 | mean=data_mean_dict[model_name], 50 | input_scale=None 51 | ) 52 | 53 | return net 54 | 55 | 56 | def read_image_rgb_noresize(fname): 57 | """ 58 | Caffe doesn't keep the aspect ratio. 59 | 60 | NOTE: Keep the range of values in an image [0,255] before using 61 | preprocessing of a network. Make sure any function you use from scikit, 62 | PIL or opencv keeps that range. sckit for example always changes the output 63 | to [0,255] range regardless of the input range. 64 | """ 65 | img = cv2.imread(fname)[:, :, ::-1] 66 | if img.ndim == 2 or img.shape[2] == 1: 67 | img = img.reshape((img.shape[0], img.shape[1], 1)) 68 | img = np.concatenate((img, img, img), axis=2) 69 | return img 70 | 71 | 72 | def image_resize(net, img): 73 | img = cv2.resize(img, tuple(net.image_dims)) 74 | return img 75 | 76 | 77 | def read_image_rgb(fname, net): 78 | img = read_image_rgb_noresize(fname) 79 | img = image_resize(net, img) 80 | return img 81 | 82 | 83 | def preprocess(net, img): 84 | '''This is specific to imagenet classification nets 85 | that does only channel swapping and mean subtraction 86 | ''' 87 | if hasattr(net, 'use_self_transformer') and net.use_self_transformer: 88 | return net.transformer.preprocess(net.inputs[0], img) 89 | return np.float32(np.rollaxis(img, 2)[::-1]) - net.transformer.mean['data'] 90 | 91 | 92 | def deprocess(net, img): 93 | if hasattr(net, 'use_self_transformer') and net.use_self_transformer: 94 | return net.transformer.deprocess(net.inputs[0], img) 95 | return np.dstack((img + net.transformer.mean['data'])[::-1]) 96 | 97 | 98 | def extract_feat(net, img, layer='prob'): 99 | src = net.blobs['data'] 100 | src.data[0] = img 101 | net.forward() 102 | return net.blobs[layer].data[0].copy() 103 | 104 | 105 | def showarray_noproc(a): 106 | """ 107 | Note: uint8 is for visualization. 108 | """ 109 | img = PIL.Image.fromarray(np.uint8(a)) 110 | display(img) 111 | 112 | 113 | def showarray_deproc(a, net): 114 | b = deprocess(net, a) 115 | img = PIL.Image.fromarray(np.uint8(b)) 116 | display(img) 117 | -------------------------------------------------------------------------------- /pre_trained network/alexnet/deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "AlexNet" 2 | layer { 3 | name: "data" 4 | type: "Input" 5 | top: "data" 6 | input_param { shape: { dim: 10 dim: 3 dim: 227 dim: 227 } } 7 | } 8 | layer { 9 | name: "conv1" 10 | type: "Convolution" 11 | bottom: "data" 12 | top: "conv1" 13 | param { 14 | lr_mult: 1 15 | decay_mult: 1 16 | } 17 | param { 18 | lr_mult: 2 19 | decay_mult: 0 20 | } 21 | convolution_param { 22 | num_output: 96 23 | kernel_size: 11 24 | stride: 4 25 | } 26 | } 27 | layer { 28 | name: "relu1" 29 | type: "ReLU" 30 | bottom: "conv1" 31 | top: "conv1" 32 | } 33 | layer { 34 | name: "norm1" 35 | type: "LRN" 36 | bottom: "conv1" 37 | top: "norm1" 38 | lrn_param { 39 | local_size: 5 40 | alpha: 0.0001 41 | beta: 0.75 42 | } 43 | } 44 | layer { 45 | name: "pool1" 46 | type: "Pooling" 47 | bottom: "norm1" 48 | top: "pool1" 49 | pooling_param { 50 | pool: MAX 51 | kernel_size: 3 52 | stride: 2 53 | } 54 | } 55 | layer { 56 | name: "conv2" 57 | type: "Convolution" 58 | bottom: "pool1" 59 | top: "conv2" 60 | param { 61 | lr_mult: 1 62 | decay_mult: 1 63 | } 64 | param { 65 | lr_mult: 2 66 | decay_mult: 0 67 | } 68 | convolution_param { 69 | num_output: 256 70 | pad: 2 71 | kernel_size: 5 72 | group: 2 73 | } 74 | } 75 | layer { 76 | name: "relu2" 77 | type: "ReLU" 78 | bottom: "conv2" 79 | top: "conv2" 80 | } 81 | layer { 82 | name: "norm2" 83 | type: "LRN" 84 | bottom: "conv2" 85 | top: "norm2" 86 | lrn_param { 87 | local_size: 5 88 | alpha: 0.0001 89 | beta: 0.75 90 | } 91 | } 92 | layer { 93 | name: "pool2" 94 | type: "Pooling" 95 | bottom: "norm2" 96 | top: "pool2" 97 | pooling_param { 98 | pool: MAX 99 | kernel_size: 3 100 | stride: 2 101 | } 102 | } 103 | layer { 104 | name: "conv3" 105 | type: "Convolution" 106 | bottom: "pool2" 107 | top: "conv3" 108 | param { 109 | lr_mult: 1 110 | decay_mult: 1 111 | } 112 | param { 113 | lr_mult: 2 114 | decay_mult: 0 115 | } 116 | convolution_param { 117 | num_output: 384 118 | pad: 1 119 | kernel_size: 3 120 | } 121 | } 122 | layer { 123 | name: "relu3" 124 | type: "ReLU" 125 | bottom: "conv3" 126 | top: "conv3" 127 | } 128 | layer { 129 | name: "conv4" 130 | type: "Convolution" 131 | bottom: "conv3" 132 | top: "conv4" 133 | param { 134 | lr_mult: 1 135 | decay_mult: 1 136 | } 137 | param { 138 | lr_mult: 2 139 | decay_mult: 0 140 | } 141 | convolution_param { 142 | num_output: 384 143 | pad: 1 144 | kernel_size: 3 145 | group: 2 146 | } 147 | } 148 | layer { 149 | name: "relu4" 150 | type: "ReLU" 151 | bottom: "conv4" 152 | top: "conv4" 153 | } 154 | layer { 155 | name: "conv5" 156 | type: "Convolution" 157 | bottom: "conv4" 158 | top: "conv5" 159 | param { 160 | lr_mult: 1 161 | decay_mult: 1 162 | } 163 | param { 164 | lr_mult: 2 165 | decay_mult: 0 166 | } 167 | convolution_param { 168 | num_output: 256 169 | pad: 1 170 | kernel_size: 3 171 | group: 2 172 | } 173 | } 174 | layer { 175 | name: "relu5" 176 | type: "ReLU" 177 | bottom: "conv5" 178 | top: "conv5" 179 | } 180 | layer { 181 | name: "pool5" 182 | type: "Pooling" 183 | bottom: "conv5" 184 | top: "pool5" 185 | pooling_param { 186 | pool: MAX 187 | kernel_size: 3 188 | stride: 2 189 | } 190 | } 191 | layer { 192 | name: "fc6" 193 | type: "InnerProduct" 194 | bottom: "pool5" 195 | top: "fc6" 196 | param { 197 | lr_mult: 1 198 | decay_mult: 1 199 | } 200 | param { 201 | lr_mult: 2 202 | decay_mult: 0 203 | } 204 | inner_product_param { 205 | num_output: 4096 206 | } 207 | } 208 | layer { 209 | name: "relu6" 210 | type: "ReLU" 211 | bottom: "fc6" 212 | top: "fc6" 213 | } 214 | layer { 215 | name: "drop6" 216 | type: "Dropout" 217 | bottom: "fc6" 218 | top: "fc6" 219 | dropout_param { 220 | dropout_ratio: 0.5 221 | } 222 | } 223 | layer { 224 | name: "fc7" 225 | type: "InnerProduct" 226 | bottom: "fc6" 227 | top: "fc7" 228 | param { 229 | lr_mult: 1 230 | decay_mult: 1 231 | } 232 | param { 233 | lr_mult: 2 234 | decay_mult: 0 235 | } 236 | inner_product_param { 237 | num_output: 4096 238 | } 239 | } 240 | layer { 241 | name: "relu7" 242 | type: "ReLU" 243 | bottom: "fc7" 244 | top: "fc7" 245 | } 246 | layer { 247 | name: "drop7" 248 | type: "Dropout" 249 | bottom: "fc7" 250 | top: "fc7" 251 | dropout_param { 252 | dropout_ratio: 0.5 253 | } 254 | } 255 | layer { 256 | name: "fc8" 257 | type: "InnerProduct" 258 | bottom: "fc7" 259 | top: "fc8" 260 | param { 261 | lr_mult: 1 262 | decay_mult: 1 263 | } 264 | param { 265 | lr_mult: 2 266 | decay_mult: 0 267 | } 268 | inner_product_param { 269 | num_output: 1000 270 | } 271 | } 272 | layer { 273 | name: "prob" 274 | type: "Softmax" 275 | bottom: "fc8" 276 | top: "prob" 277 | } -------------------------------------------------------------------------------- /pre_trained network/alexnet/alexnet_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "AlexNet" 2 | layer { 3 | name: "data" 4 | type: "Input" 5 | top: "data" 6 | input_param { shape: { dim: 1 dim: 3 dim: 227 dim: 227 } } 7 | } 8 | layer { 9 | name: "conv1" 10 | type: "Convolution" 11 | bottom: "data" 12 | top: "conv1" 13 | param { 14 | lr_mult: 1 15 | decay_mult: 1 16 | } 17 | param { 18 | lr_mult: 2 19 | decay_mult: 0 20 | } 21 | convolution_param { 22 | num_output: 96 23 | kernel_size: 11 24 | stride: 4 25 | } 26 | } 27 | layer { 28 | name: "relu1" 29 | type: "ReLU" 30 | bottom: "conv1" 31 | top: "conv1" 32 | } 33 | layer { 34 | name: "norm1" 35 | type: "LRN" 36 | bottom: "conv1" 37 | top: "norm1" 38 | lrn_param { 39 | local_size: 5 40 | alpha: 0.0001 41 | beta: 0.75 42 | } 43 | } 44 | layer { 45 | name: "pool1" 46 | type: "Pooling" 47 | bottom: "norm1" 48 | top: "pool1" 49 | pooling_param { 50 | pool: MAX 51 | kernel_size: 3 52 | stride: 2 53 | } 54 | } 55 | layer { 56 | name: "conv2" 57 | type: "Convolution" 58 | bottom: "pool1" 59 | top: "conv2" 60 | param { 61 | lr_mult: 1 62 | decay_mult: 1 63 | } 64 | param { 65 | lr_mult: 2 66 | decay_mult: 0 67 | } 68 | convolution_param { 69 | num_output: 256 70 | pad: 2 71 | kernel_size: 5 72 | group: 2 73 | } 74 | } 75 | layer { 76 | name: "relu2" 77 | type: "ReLU" 78 | bottom: "conv2" 79 | top: "conv2" 80 | } 81 | layer { 82 | name: "norm2" 83 | type: "LRN" 84 | bottom: "conv2" 85 | top: "norm2" 86 | lrn_param { 87 | local_size: 5 88 | alpha: 0.0001 89 | beta: 0.75 90 | } 91 | } 92 | layer { 93 | name: "pool2" 94 | type: "Pooling" 95 | bottom: "norm2" 96 | top: "pool2" 97 | pooling_param { 98 | pool: MAX 99 | kernel_size: 3 100 | stride: 2 101 | } 102 | } 103 | layer { 104 | name: "conv3" 105 | type: "Convolution" 106 | bottom: "pool2" 107 | top: "conv3" 108 | param { 109 | lr_mult: 1 110 | decay_mult: 1 111 | } 112 | param { 113 | lr_mult: 2 114 | decay_mult: 0 115 | } 116 | convolution_param { 117 | num_output: 384 118 | pad: 1 119 | kernel_size: 3 120 | } 121 | } 122 | layer { 123 | name: "relu3" 124 | type: "ReLU" 125 | bottom: "conv3" 126 | top: "conv3" 127 | } 128 | layer { 129 | name: "conv4" 130 | type: "Convolution" 131 | bottom: "conv3" 132 | top: "conv4" 133 | param { 134 | lr_mult: 1 135 | decay_mult: 1 136 | } 137 | param { 138 | lr_mult: 2 139 | decay_mult: 0 140 | } 141 | convolution_param { 142 | num_output: 384 143 | pad: 1 144 | kernel_size: 3 145 | group: 2 146 | } 147 | } 148 | layer { 149 | name: "relu4" 150 | type: "ReLU" 151 | bottom: "conv4" 152 | top: "conv4" 153 | } 154 | layer { 155 | name: "conv5" 156 | type: "Convolution" 157 | bottom: "conv4" 158 | top: "conv5" 159 | param { 160 | lr_mult: 1 161 | decay_mult: 1 162 | } 163 | param { 164 | lr_mult: 2 165 | decay_mult: 0 166 | } 167 | convolution_param { 168 | num_output: 256 169 | pad: 1 170 | kernel_size: 3 171 | group: 2 172 | } 173 | } 174 | layer { 175 | name: "relu5" 176 | type: "ReLU" 177 | bottom: "conv5" 178 | top: "conv5" 179 | } 180 | layer { 181 | name: "pool5" 182 | type: "Pooling" 183 | bottom: "conv5" 184 | top: "pool5" 185 | pooling_param { 186 | pool: MAX 187 | kernel_size: 3 188 | stride: 2 189 | } 190 | } 191 | layer { 192 | name: "fc6" 193 | type: "InnerProduct" 194 | bottom: "pool5" 195 | top: "fc6" 196 | param { 197 | lr_mult: 1 198 | decay_mult: 1 199 | } 200 | param { 201 | lr_mult: 2 202 | decay_mult: 0 203 | } 204 | inner_product_param { 205 | num_output: 4096 206 | } 207 | } 208 | layer { 209 | name: "relu6" 210 | type: "ReLU" 211 | bottom: "fc6" 212 | top: "fc6" 213 | } 214 | layer { 215 | name: "drop6" 216 | type: "Dropout" 217 | bottom: "fc6" 218 | top: "fc6" 219 | dropout_param { 220 | dropout_ratio: 0.5 221 | } 222 | } 223 | layer { 224 | name: "fc7" 225 | type: "InnerProduct" 226 | bottom: "fc6" 227 | top: "fc7" 228 | param { 229 | lr_mult: 1 230 | decay_mult: 1 231 | } 232 | param { 233 | lr_mult: 2 234 | decay_mult: 0 235 | } 236 | inner_product_param { 237 | num_output: 4096 238 | } 239 | } 240 | layer { 241 | name: "relu7" 242 | type: "ReLU" 243 | bottom: "fc7" 244 | top: "fc7" 245 | } 246 | layer { 247 | name: "drop7" 248 | type: "Dropout" 249 | bottom: "fc7" 250 | top: "fc7" 251 | dropout_param { 252 | dropout_ratio: 0.5 253 | } 254 | } 255 | layer { 256 | name: "gtsrb_fc8" 257 | type: "InnerProduct" 258 | bottom: "fc7" 259 | top: "gtsrb_fc8" 260 | param { 261 | lr_mult: 1 262 | decay_mult: 1 263 | } 264 | param { 265 | lr_mult: 2 266 | decay_mult: 0 267 | } 268 | inner_product_param { 269 | num_output: 43 270 | } 271 | } 272 | layer { 273 | name: "prob" 274 | type: "Softmax" 275 | bottom: "gtsrb_fc8" 276 | top: "prob" 277 | } -------------------------------------------------------------------------------- /Caffe/ms_emotion.py: -------------------------------------------------------------------------------- 1 | 2 | import requests 3 | import json 4 | import sys 5 | import os 6 | from os.path import join 7 | import time 8 | import csv 9 | from decimal import * 10 | import operator 11 | from io import BytesIO 12 | 13 | KEY = 'c8e74a1743b14e739897bacd84f7f0d5' 14 | 15 | FACE_API_URL = 'https://southeastasia.api.cognitive.microsoft.com' # Replace with your regional Base URL 16 | 17 | img_url = 'ferdata/FER2013Valid/fer0028737.png' 18 | 19 | 20 | 21 | headers = { 22 | 'Content-Type': 'application/octet-stream', 23 | 'Ocp-Apim-Subscription-Key': KEY, 24 | } 25 | 26 | params = { 27 | 'returnFaceId': 'true', 28 | 'returnFaceLandmarks': 'false', 29 | 'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise', 30 | } 31 | 32 | label = ['neutral', 'happiness', 'surprise', 'sadness', 'anger', 'disgust', 'fear', 'contempt', 'unknown'] 33 | 34 | #body = {'url': 'http://d.ibtimes.co.uk/en/full/1571929/donald-trump.jpg'} 35 | error = [] 36 | 37 | def annotate_image(image_path): 38 | # Read file 39 | # imgs = os.listdir(dir_path) 40 | # imgs.sort() 41 | # for img in imgs: 42 | dir_path = 'ferdata' 43 | image_path = join (dir_path, image_path) 44 | print("Image Path: ", image_path) 45 | with open(image_path,'rb') as f: 46 | data = f.read() 47 | 48 | try: 49 | response = requests.request('POST',FACE_API_URL + '/face/v1.0/detect',data=data,headers=headers,params=params) 50 | # response = requests.post(FACE_API_URL,params=params,headers=headers,json={"url": img_url}) 51 | faces = response.json()[0] 52 | # print(faces) 53 | print('Response:') 54 | 55 | parsed = json.loads(response.text)[0] 56 | print('faceId: ',parsed['faceId']) 57 | print('faceRectangle: ',parsed['faceRectangle']) 58 | print('faceEmotion: ',parsed['faceAttributes']['emotion']) 59 | foo = {} 60 | foo.update({'neutral': float(parsed['faceAttributes']['emotion']['neutral']) }) 61 | foo.update({'happiness': float(parsed['faceAttributes']['emotion']['happiness']) }) 62 | foo.update({'surprise': float(parsed['faceAttributes']['emotion']['surprise']) }) 63 | foo.update({'sadness': float(parsed['faceAttributes']['emotion']['sadness'])}) 64 | foo.update({'anger': float(parsed['faceAttributes']['emotion']['anger'])}) 65 | foo.update({'disgust': float(parsed['faceAttributes']['emotion']['disgust'])}) 66 | foo.update({'fear': float(parsed['faceAttributes']['emotion']['fear'])}) 67 | foo.update({'contempt': float(parsed['faceAttributes']['emotion']['contempt'])}) 68 | key = max(foo.items(),key=operator.itemgetter(1))[0] 69 | value = Decimal(foo[key]) 70 | print("key: ",key) 71 | print("value: ", value) 72 | print("label: ", label.index(key)) 73 | tag = [image_path,label.index(key)] 74 | print (tag) 75 | with open("caffedata/Caffe_testing_100.csv","a") as f: 76 | for t in tag: 77 | f.write(str(t) + ", ") 78 | f.write("\n") 79 | f.close() 80 | 81 | #print(json.dumps(parsed,sort_keys=True,indent=2)) 82 | 83 | 84 | except Exception as e: 85 | 86 | print('Error: ', e) 87 | error.append(image_path) 88 | tag = [image_path, label.index('unknown')] 89 | print(tag) 90 | with open("caffedata/Caffe_testing_100.csv","a") as f: 91 | for t in tag: 92 | f.write(str(t) + ", ") 93 | f.write("\n") 94 | f.close() 95 | time.sleep(15) 96 | # image_file = BytesIO(requests.get(image_url).content) 97 | # image = Image.open(image_file) 98 | # 99 | # plt.figure(figsize=(8,8)) 100 | # ax = plt.imshow(image, alpha=0.6) 101 | # for face in faces: 102 | # fr = face["faceRectangle"] 103 | # fa = face["faceAttributes"] 104 | # origin = (fr["left"], fr["top"]) 105 | # p = patches.Rectangle(origin, fr["width"], \ 106 | # fr["height"], fill=False, linewidth=2, color='b') 107 | # ax.axes.add_patch(p) 108 | # plt.text(origin[0], origin[1], "%s, %d"%(fa["gender"].capitalize(), fa["age"]), \ 109 | # fontsize=20, weight="bold", va="bottom") 110 | # plt.axis("off") 111 | 112 | 113 | dir_path = sys.argv[1] 114 | count = sys.argv[2] 115 | i=0 116 | with open(dir_path, "r") as f: 117 | print("count: ", int(count)) 118 | reader = csv.reader(f) 119 | 120 | for row in reader: 121 | if(i 0) 57 | return obj 58 | 59 | 60 | def objective_guide_label_noloss(prob_layer, diff_layer, g_feat, verbose=True): 61 | """ 62 | To be used when optimizing on prediction but from 'prob' layer 63 | and there is no explicit loss layer. 64 | 65 | Taken from softmax_loss_layer.cpp forward() 66 | """ 67 | g_label = np.argmax(g_feat) 68 | obj = -np.log(max(prob_layer.data[0][g_label], sys.float_info.min)) 69 | if verbose: 70 | print obj, np.argmax(prob_layer.data[0]) 71 | diff_layer.diff[0][...] = prob_layer.data[0] 72 | diff_layer.diff[0][g_label] = prob_layer.data[0][g_label] - 1. 73 | return obj 74 | 75 | 76 | def get_layer_objective(layer, net): 77 | layer_names = [net._layer_names[i] for i in range(len(net._layer_names))] 78 | idx = layer_names.index(layer) 79 | if net.layers[idx].type == 'Softmax': 80 | print "Objective: label_noloss" 81 | return objective_guide_label_noloss 82 | if idx+1 < len(net.layers): 83 | if net.layers[idx+1].type == 'ReLU': 84 | print "Objective: relu" 85 | return objective_guide_relu 86 | else: 87 | print "Objective: euclidean" 88 | return objective_guide_euclidean 89 | return None 90 | 91 | 92 | def get_next_layer(layer, net): 93 | layer_names = net.blobs.keys() 94 | idx = layer_names.index(layer) 95 | if idx == len(layer)-1: 96 | return layer_names[idx] 97 | return layer_names[idx+1] 98 | 99 | 100 | def calc_gstep(cs_x, net, g_feat, end, objective, verbose=True): 101 | 102 | src = net.blobs['data'] # input image is stored in Net's 'data' blob 103 | dst = net.blobs[end] 104 | src.data[0][...] = cs_x.reshape(src.data[0].shape) 105 | if objective == objective_guide_euclidean: 106 | net.forward(end=end) 107 | obj = objective(dst, g_feat, verbose) 108 | net.backward(start=end) 109 | elif objective == objective_guide_relu: 110 | # two forwrad props to handle in place operations like relu 111 | next_layer = get_next_layer(end, net) 112 | net.forward(end=next_layer) 113 | rfeat = dst.data[0].copy() 114 | net.forward(end=end) 115 | # specify the optimization objective 116 | obj = objective(dst, g_feat, rfeat, verbose) 117 | net.backward(start=end) 118 | elif objective == objective_guide_label_noloss: 119 | diff_layer = net.blobs.keys()[net.blobs.keys().index('prob') - 1] 120 | net.forward(end='prob') 121 | obj = objective(net.blobs['prob'], net.blobs[diff_layer], 122 | g_feat, verbose) 123 | net.backward(start=diff_layer) 124 | else: 125 | raise Exception("Unknown objective function.") 126 | 127 | g = src.diff[0] 128 | 129 | return obj, g.flatten().astype(float) 130 | 131 | 132 | def constOptimize(net, base_img, guide_img, objective, iter_n, max_thres, 133 | end, factr=factr, pgtol=pgtol, verbose=True): 134 | proc_base = utils.preprocess(net, base_img) 135 | proc_guide = utils.preprocess(net, guide_img) 136 | src = net.blobs['data'] 137 | ch, h, w = proc_base.shape 138 | src.reshape(1, ch, h, w) 139 | # allocate image for network-produced details 140 | src, dst = net.blobs['data'], net.blobs[end] 141 | src.data[0] = proc_guide 142 | net.forward(end='prob') 143 | guide_features = dst.data[0].copy() 144 | 145 | up_bnd = proc_base + max_thres 146 | lw_bnd = proc_base - max_thres 147 | mean_arr = net.transformer.mean['data'] 148 | if mean_arr.ndim == 1: 149 | mean_arr = mean_arr.reshape((3, 1, 1)) 150 | up_bnd = np.minimum(up_bnd, 255 - mean_arr) 151 | lw_bnd = np.maximum(lw_bnd, 0 - mean_arr) 152 | bound = zip(lw_bnd.flatten(), up_bnd.flatten()) 153 | src.data[0] = proc_base 154 | x, f, d = cnstOpt(calc_gstep, proc_base.flatten().astype(float), 155 | args=(net, guide_features, end, objective, verbose), 156 | bounds=bound, maxiter=iter_n, iprint=0, factr=factr, 157 | pgtol=pgtol) 158 | 159 | return x.reshape(proc_base.shape), f, d 160 | 161 | 162 | def optimize_single(seed_fname, guide_fname, model_name, layer, iter_n, 163 | max_thres, net, verbose=True): 164 | seed = utils.read_image_rgb(seed_fname, net) 165 | guide = utils.read_image_rgb(guide_fname, net) 166 | objective = get_layer_objective(layer, net) 167 | ad, bc, cd = constOptimize( 168 | net, seed, guide, iter_n=iter_n, max_thres=max_thres, 169 | end=layer, objective=objective, verbose=verbose) 170 | print cd 171 | 172 | return utils.deprocess(net, ad), bc, cd 173 | -------------------------------------------------------------------------------- /pre_trained network/alexnet/alexnet_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "AlexNet" 2 | layer { 3 | name: "data" 4 | type: "Data" 5 | top: "data" 6 | top: "label" 7 | include { 8 | phase: TRAIN 9 | } 10 | transform_param { 11 | mirror: true 12 | crop_size: 227 13 | mean_file: "/home/exx/Documents/dataset_all/featurefool2150_train_mean.binaryproto" 14 | } 15 | data_param { 16 | source: "/home/exx/Documents/dataset_all/featurefool_train2150_lmdb" 17 | batch_size: 256 18 | backend: LMDB 19 | } 20 | } 21 | layer { 22 | name: "data" 23 | type: "Data" 24 | top: "data" 25 | top: "label" 26 | include { 27 | phase: TEST 28 | } 29 | transform_param { 30 | mirror: false 31 | crop_size: 227 32 | mean_file: "/home/exx/Documents/dataset_all/featurefool2150_validation_mean.binaryproto" 33 | } 34 | data_param { 35 | source: "/home/exx/Documents/dataset_all/featurefool_validation2150_lmdb" 36 | batch_size: 50 37 | backend: LMDB 38 | } 39 | } 40 | layer { 41 | name: "conv1" 42 | type: "Convolution" 43 | bottom: "data" 44 | top: "conv1" 45 | param { 46 | lr_mult: 0 47 | decay_mult: 0 48 | } 49 | param { 50 | lr_mult: 0 51 | decay_mult: 0 52 | } 53 | convolution_param { 54 | num_output: 96 55 | kernel_size: 11 56 | stride: 4 57 | weight_filler { 58 | type: "gaussian" 59 | std: 0.01 60 | } 61 | bias_filler { 62 | type: "constant" 63 | value: 0 64 | } 65 | } 66 | } 67 | layer { 68 | name: "relu1" 69 | type: "ReLU" 70 | bottom: "conv1" 71 | top: "conv1" 72 | } 73 | layer { 74 | name: "norm1" 75 | type: "LRN" 76 | bottom: "conv1" 77 | top: "norm1" 78 | lrn_param { 79 | local_size: 5 80 | alpha: 0.0001 81 | beta: 0.75 82 | } 83 | } 84 | layer { 85 | name: "pool1" 86 | type: "Pooling" 87 | bottom: "norm1" 88 | top: "pool1" 89 | pooling_param { 90 | pool: MAX 91 | kernel_size: 3 92 | stride: 2 93 | } 94 | } 95 | layer { 96 | name: "conv2" 97 | type: "Convolution" 98 | bottom: "pool1" 99 | top: "conv2" 100 | param { 101 | lr_mult: 0 102 | decay_mult: 0 103 | } 104 | param { 105 | lr_mult: 0 106 | decay_mult: 0 107 | } 108 | convolution_param { 109 | num_output: 256 110 | pad: 2 111 | kernel_size: 5 112 | group: 2 113 | weight_filler { 114 | type: "gaussian" 115 | std: 0.01 116 | } 117 | bias_filler { 118 | type: "constant" 119 | value: 0.1 120 | } 121 | } 122 | } 123 | layer { 124 | name: "relu2" 125 | type: "ReLU" 126 | bottom: "conv2" 127 | top: "conv2" 128 | } 129 | layer { 130 | name: "norm2" 131 | type: "LRN" 132 | bottom: "conv2" 133 | top: "norm2" 134 | lrn_param { 135 | local_size: 5 136 | alpha: 0.0001 137 | beta: 0.75 138 | } 139 | } 140 | layer { 141 | name: "pool2" 142 | type: "Pooling" 143 | bottom: "norm2" 144 | top: "pool2" 145 | pooling_param { 146 | pool: MAX 147 | kernel_size: 3 148 | stride: 2 149 | } 150 | } 151 | layer { 152 | name: "conv3" 153 | type: "Convolution" 154 | bottom: "pool2" 155 | top: "conv3" 156 | param { 157 | lr_mult: 0 158 | decay_mult: 0 159 | } 160 | param { 161 | lr_mult: 0 162 | decay_mult: 0 163 | } 164 | convolution_param { 165 | num_output: 384 166 | pad: 1 167 | kernel_size: 3 168 | weight_filler { 169 | type: "gaussian" 170 | std: 0.01 171 | } 172 | bias_filler { 173 | type: "constant" 174 | value: 0 175 | } 176 | } 177 | } 178 | layer { 179 | name: "relu3" 180 | type: "ReLU" 181 | bottom: "conv3" 182 | top: "conv3" 183 | } 184 | layer { 185 | name: "conv4" 186 | type: "Convolution" 187 | bottom: "conv3" 188 | top: "conv4" 189 | param { 190 | lr_mult: 0 191 | decay_mult: 0 192 | } 193 | param { 194 | lr_mult: 0 195 | decay_mult: 0 196 | } 197 | convolution_param { 198 | num_output: 384 199 | pad: 1 200 | kernel_size: 3 201 | group: 2 202 | weight_filler { 203 | type: "gaussian" 204 | std: 0.01 205 | } 206 | bias_filler { 207 | type: "constant" 208 | value: 0.1 209 | } 210 | } 211 | } 212 | layer { 213 | name: "relu4" 214 | type: "ReLU" 215 | bottom: "conv4" 216 | top: "conv4" 217 | } 218 | layer { 219 | name: "conv5" 220 | type: "Convolution" 221 | bottom: "conv4" 222 | top: "conv5" 223 | param { 224 | lr_mult: 0 225 | decay_mult: 0 226 | } 227 | param { 228 | lr_mult: 0 229 | decay_mult: 0 230 | } 231 | convolution_param { 232 | num_output: 256 233 | pad: 1 234 | kernel_size: 3 235 | group: 2 236 | weight_filler { 237 | type: "gaussian" 238 | std: 0.01 239 | } 240 | bias_filler { 241 | type: "constant" 242 | value: 0.1 243 | } 244 | } 245 | } 246 | layer { 247 | name: "relu5" 248 | type: "ReLU" 249 | bottom: "conv5" 250 | top: "conv5" 251 | } 252 | layer { 253 | name: "pool5" 254 | type: "Pooling" 255 | bottom: "conv5" 256 | top: "pool5" 257 | pooling_param { 258 | pool: MAX 259 | kernel_size: 3 260 | stride: 2 261 | } 262 | } 263 | layer { 264 | name: "fc6" 265 | type: "InnerProduct" 266 | bottom: "pool5" 267 | top: "fc6" 268 | param { 269 | lr_mult: 1 270 | decay_mult: 1 271 | } 272 | param { 273 | lr_mult: 2 274 | decay_mult: 0 275 | } 276 | inner_product_param { 277 | num_output: 4096 278 | weight_filler { 279 | type: "gaussian" 280 | std: 0.005 281 | } 282 | bias_filler { 283 | type: "constant" 284 | value: 0.1 285 | } 286 | } 287 | } 288 | layer { 289 | name: "relu6" 290 | type: "ReLU" 291 | bottom: "fc6" 292 | top: "fc6" 293 | } 294 | layer { 295 | name: "drop6" 296 | type: "Dropout" 297 | bottom: "fc6" 298 | top: "fc6" 299 | dropout_param { 300 | dropout_ratio: 0.5 301 | } 302 | } 303 | layer { 304 | name: "fc7" 305 | type: "InnerProduct" 306 | bottom: "fc6" 307 | top: "fc7" 308 | param { 309 | lr_mult: 1 310 | decay_mult: 1 311 | } 312 | param { 313 | lr_mult: 2 314 | decay_mult: 0 315 | } 316 | inner_product_param { 317 | num_output: 4096 318 | weight_filler { 319 | type: "gaussian" 320 | std: 0.005 321 | } 322 | bias_filler { 323 | type: "constant" 324 | value: 0.1 325 | } 326 | } 327 | } 328 | layer { 329 | name: "relu7" 330 | type: "ReLU" 331 | bottom: "fc7" 332 | top: "fc7" 333 | } 334 | layer { 335 | name: "drop7" 336 | type: "Dropout" 337 | bottom: "fc7" 338 | top: "fc7" 339 | dropout_param { 340 | dropout_ratio: 0.5 341 | } 342 | } 343 | layer { 344 | name: "gtsrb_fc8" 345 | type: "InnerProduct" 346 | bottom: "fc7" 347 | top: "gtsrb_fc8" 348 | param { 349 | lr_mult: 1 350 | decay_mult: 1 351 | } 352 | param { 353 | lr_mult: 2 354 | decay_mult: 0 355 | } 356 | inner_product_param { 357 | num_output: 43 358 | weight_filler { 359 | type: "gaussian" 360 | std: 0.01 361 | } 362 | bias_filler { 363 | type: "constant" 364 | value: 0 365 | } 366 | } 367 | } 368 | layer { 369 | name: "accuracy" 370 | type: "Accuracy" 371 | bottom: "gtsrb_fc8" 372 | bottom: "label" 373 | top: "accuracy" 374 | include { 375 | phase: TEST 376 | } 377 | } 378 | layer { 379 | name: "loss" 380 | type: "SoftmaxWithLoss" 381 | bottom: "gtsrb_fc8" 382 | bottom: "label" 383 | top: "loss" 384 | } -------------------------------------------------------------------------------- /pre_trained network/vgg19/VGG_ILSVRC_19_layers_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "VGG_ILSVRC_19_layers" 2 | input: "data" 3 | input_dim: 10 4 | input_dim: 3 5 | input_dim: 224 6 | input_dim: 224 7 | layers { 8 | bottom: "data" 9 | top: "conv1_1" 10 | name: "conv1_1" 11 | type: CONVOLUTION 12 | convolution_param { 13 | num_output: 64 14 | pad: 1 15 | kernel_size: 3 16 | } 17 | } 18 | layers { 19 | bottom: "conv1_1" 20 | top: "conv1_1" 21 | name: "relu1_1" 22 | type: RELU 23 | } 24 | layers { 25 | bottom: "conv1_1" 26 | top: "conv1_2" 27 | name: "conv1_2" 28 | type: CONVOLUTION 29 | convolution_param { 30 | num_output: 64 31 | pad: 1 32 | kernel_size: 3 33 | } 34 | } 35 | layers { 36 | bottom: "conv1_2" 37 | top: "conv1_2" 38 | name: "relu1_2" 39 | type: RELU 40 | } 41 | layers { 42 | bottom: "conv1_2" 43 | top: "pool1" 44 | name: "pool1" 45 | type: POOLING 46 | pooling_param { 47 | pool: MAX 48 | kernel_size: 2 49 | stride: 2 50 | } 51 | } 52 | layers { 53 | bottom: "pool1" 54 | top: "conv2_1" 55 | name: "conv2_1" 56 | type: CONVOLUTION 57 | convolution_param { 58 | num_output: 128 59 | pad: 1 60 | kernel_size: 3 61 | } 62 | } 63 | layers { 64 | bottom: "conv2_1" 65 | top: "conv2_1" 66 | name: "relu2_1" 67 | type: RELU 68 | } 69 | layers { 70 | bottom: "conv2_1" 71 | top: "conv2_2" 72 | name: "conv2_2" 73 | type: CONVOLUTION 74 | convolution_param { 75 | num_output: 128 76 | pad: 1 77 | kernel_size: 3 78 | } 79 | } 80 | layers { 81 | bottom: "conv2_2" 82 | top: "conv2_2" 83 | name: "relu2_2" 84 | type: RELU 85 | } 86 | layers { 87 | bottom: "conv2_2" 88 | top: "pool2" 89 | name: "pool2" 90 | type: POOLING 91 | pooling_param { 92 | pool: MAX 93 | kernel_size: 2 94 | stride: 2 95 | } 96 | } 97 | layers { 98 | bottom: "pool2" 99 | top: "conv3_1" 100 | name: "conv3_1" 101 | type: CONVOLUTION 102 | convolution_param { 103 | num_output: 256 104 | pad: 1 105 | kernel_size: 3 106 | } 107 | } 108 | layers { 109 | bottom: "conv3_1" 110 | top: "conv3_1" 111 | name: "relu3_1" 112 | type: RELU 113 | } 114 | layers { 115 | bottom: "conv3_1" 116 | top: "conv3_2" 117 | name: "conv3_2" 118 | type: CONVOLUTION 119 | convolution_param { 120 | num_output: 256 121 | pad: 1 122 | kernel_size: 3 123 | } 124 | } 125 | layers { 126 | bottom: "conv3_2" 127 | top: "conv3_2" 128 | name: "relu3_2" 129 | type: RELU 130 | } 131 | layers { 132 | bottom: "conv3_2" 133 | top: "conv3_3" 134 | name: "conv3_3" 135 | type: CONVOLUTION 136 | convolution_param { 137 | num_output: 256 138 | pad: 1 139 | kernel_size: 3 140 | } 141 | } 142 | layers { 143 | bottom: "conv3_3" 144 | top: "conv3_3" 145 | name: "relu3_3" 146 | type: RELU 147 | } 148 | layers { 149 | bottom: "conv3_3" 150 | top: "conv3_4" 151 | name: "conv3_4" 152 | type: CONVOLUTION 153 | convolution_param { 154 | num_output: 256 155 | pad: 1 156 | kernel_size: 3 157 | } 158 | } 159 | layers { 160 | bottom: "conv3_4" 161 | top: "conv3_4" 162 | name: "relu3_4" 163 | type: RELU 164 | } 165 | layers { 166 | bottom: "conv3_4" 167 | top: "pool3" 168 | name: "pool3" 169 | type: POOLING 170 | pooling_param { 171 | pool: MAX 172 | kernel_size: 2 173 | stride: 2 174 | } 175 | } 176 | layers { 177 | bottom: "pool3" 178 | top: "conv4_1" 179 | name: "conv4_1" 180 | type: CONVOLUTION 181 | convolution_param { 182 | num_output: 512 183 | pad: 1 184 | kernel_size: 3 185 | } 186 | } 187 | layers { 188 | bottom: "conv4_1" 189 | top: "conv4_1" 190 | name: "relu4_1" 191 | type: RELU 192 | } 193 | layers { 194 | bottom: "conv4_1" 195 | top: "conv4_2" 196 | name: "conv4_2" 197 | type: CONVOLUTION 198 | convolution_param { 199 | num_output: 512 200 | pad: 1 201 | kernel_size: 3 202 | } 203 | } 204 | layers { 205 | bottom: "conv4_2" 206 | top: "conv4_2" 207 | name: "relu4_2" 208 | type: RELU 209 | } 210 | layers { 211 | bottom: "conv4_2" 212 | top: "conv4_3" 213 | name: "conv4_3" 214 | type: CONVOLUTION 215 | convolution_param { 216 | num_output: 512 217 | pad: 1 218 | kernel_size: 3 219 | } 220 | } 221 | layers { 222 | bottom: "conv4_3" 223 | top: "conv4_3" 224 | name: "relu4_3" 225 | type: RELU 226 | } 227 | layers { 228 | bottom: "conv4_3" 229 | top: "conv4_4" 230 | name: "conv4_4" 231 | type: CONVOLUTION 232 | convolution_param { 233 | num_output: 512 234 | pad: 1 235 | kernel_size: 3 236 | } 237 | } 238 | layers { 239 | bottom: "conv4_4" 240 | top: "conv4_4" 241 | name: "relu4_4" 242 | type: RELU 243 | } 244 | layers { 245 | bottom: "conv4_4" 246 | top: "pool4" 247 | name: "pool4" 248 | type: POOLING 249 | pooling_param { 250 | pool: MAX 251 | kernel_size: 2 252 | stride: 2 253 | } 254 | } 255 | layers { 256 | bottom: "pool4" 257 | top: "conv5_1" 258 | name: "conv5_1" 259 | type: CONVOLUTION 260 | convolution_param { 261 | num_output: 512 262 | pad: 1 263 | kernel_size: 3 264 | } 265 | } 266 | layers { 267 | bottom: "conv5_1" 268 | top: "conv5_1" 269 | name: "relu5_1" 270 | type: RELU 271 | } 272 | layers { 273 | bottom: "conv5_1" 274 | top: "conv5_2" 275 | name: "conv5_2" 276 | type: CONVOLUTION 277 | convolution_param { 278 | num_output: 512 279 | pad: 1 280 | kernel_size: 3 281 | } 282 | } 283 | layers { 284 | bottom: "conv5_2" 285 | top: "conv5_2" 286 | name: "relu5_2" 287 | type: RELU 288 | } 289 | layers { 290 | bottom: "conv5_2" 291 | top: "conv5_3" 292 | name: "conv5_3" 293 | type: CONVOLUTION 294 | convolution_param { 295 | num_output: 512 296 | pad: 1 297 | kernel_size: 3 298 | } 299 | } 300 | layers { 301 | bottom: "conv5_3" 302 | top: "conv5_3" 303 | name: "relu5_3" 304 | type: RELU 305 | } 306 | layers { 307 | bottom: "conv5_3" 308 | top: "conv5_4" 309 | name: "conv5_4" 310 | type: CONVOLUTION 311 | convolution_param { 312 | num_output: 512 313 | pad: 1 314 | kernel_size: 3 315 | } 316 | } 317 | layers { 318 | bottom: "conv5_4" 319 | top: "conv5_4" 320 | name: "relu5_4" 321 | type: RELU 322 | } 323 | layers { 324 | bottom: "conv5_4" 325 | top: "pool5" 326 | name: "pool5" 327 | type: POOLING 328 | pooling_param { 329 | pool: MAX 330 | kernel_size: 2 331 | stride: 2 332 | } 333 | } 334 | layers { 335 | bottom: "pool5" 336 | top: "fc6" 337 | name: "fc6" 338 | type: INNER_PRODUCT 339 | inner_product_param { 340 | num_output: 4096 341 | } 342 | } 343 | layers { 344 | bottom: "fc6" 345 | top: "fc6" 346 | name: "relu6" 347 | type: RELU 348 | } 349 | layers { 350 | bottom: "fc6" 351 | top: "fc6" 352 | name: "drop6" 353 | type: DROPOUT 354 | dropout_param { 355 | dropout_ratio: 0.5 356 | } 357 | } 358 | layers { 359 | bottom: "fc6" 360 | top: "fc7" 361 | name: "fc7" 362 | type: INNER_PRODUCT 363 | inner_product_param { 364 | num_output: 4096 365 | } 366 | } 367 | layers { 368 | bottom: "fc7" 369 | top: "fc7" 370 | name: "relu7" 371 | type: RELU 372 | } 373 | layers { 374 | bottom: "fc7" 375 | top: "fc7" 376 | name: "drop7" 377 | type: DROPOUT 378 | dropout_param { 379 | dropout_ratio: 0.5 380 | } 381 | } 382 | layers { 383 | bottom: "fc7" 384 | top: "gtsrb_fc8" 385 | name: "gtsrb_fc8" 386 | type: INNER_PRODUCT 387 | inner_product_param { 388 | num_output: 43 389 | } 390 | } 391 | layers { 392 | bottom: "gtsrb_fc8" 393 | top: "prob" 394 | name: "prob" 395 | type: SOFTMAX 396 | } -------------------------------------------------------------------------------- /pre_trained network/vgg19/VGG_ILSVRC_19_layers_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "VGG_ILSVRC_19_layers" 2 | layers { 3 | name: "data" 4 | type: DATA 5 | include { 6 | phase: TRAIN 7 | } 8 | transform_param { 9 | crop_size: 224 10 | mean_value: 104 11 | mean_value: 117 12 | mean_value: 123 13 | mirror: true 14 | } 15 | data_param { 16 | source: "/home/exx/Documents/dataset_all/featurefool_train2150_lmdb" 17 | batch_size: 32 18 | backend: LMDB 19 | } 20 | top: "data" 21 | top: "label" 22 | } 23 | layers { 24 | name: "data" 25 | type: DATA 26 | include { 27 | phase: TEST 28 | } 29 | transform_param { 30 | crop_size: 224 31 | mean_value: 104 32 | mean_value: 117 33 | mean_value: 123 34 | mirror: false 35 | } 36 | data_param { 37 | source: "/home/exx/Documents/dataset_all/featurefool_validation2150_lmdb" 38 | batch_size: 32 39 | backend: LMDB 40 | } 41 | top: "data" 42 | top: "label" 43 | } 44 | layers { 45 | bottom: "data" 46 | top: "conv1_1" 47 | name: "conv1_1" 48 | type: CONVOLUTION 49 | convolution_param { 50 | num_output: 64 51 | pad: 1 52 | kernel_size: 3 53 | } 54 | } 55 | layers { 56 | bottom: "conv1_1" 57 | top: "conv1_1" 58 | name: "relu1_1" 59 | type: RELU 60 | } 61 | layers { 62 | bottom: "conv1_1" 63 | top: "conv1_2" 64 | name: "conv1_2" 65 | type: CONVOLUTION 66 | convolution_param { 67 | num_output: 64 68 | pad: 1 69 | kernel_size: 3 70 | } 71 | } 72 | layers { 73 | bottom: "conv1_2" 74 | top: "conv1_2" 75 | name: "relu1_2" 76 | type: RELU 77 | } 78 | layers { 79 | bottom: "conv1_2" 80 | top: "pool1" 81 | name: "pool1" 82 | type: POOLING 83 | pooling_param { 84 | pool: MAX 85 | kernel_size: 2 86 | stride: 2 87 | } 88 | } 89 | layers { 90 | bottom: "pool1" 91 | top: "conv2_1" 92 | name: "conv2_1" 93 | type: CONVOLUTION 94 | convolution_param { 95 | num_output: 128 96 | pad: 1 97 | kernel_size: 3 98 | } 99 | } 100 | layers { 101 | bottom: "conv2_1" 102 | top: "conv2_1" 103 | name: "relu2_1" 104 | type: RELU 105 | } 106 | layers { 107 | bottom: "conv2_1" 108 | top: "conv2_2" 109 | name: "conv2_2" 110 | type: CONVOLUTION 111 | convolution_param { 112 | num_output: 128 113 | pad: 1 114 | kernel_size: 3 115 | } 116 | } 117 | layers { 118 | bottom: "conv2_2" 119 | top: "conv2_2" 120 | name: "relu2_2" 121 | type: RELU 122 | } 123 | layers { 124 | bottom: "conv2_2" 125 | top: "pool2" 126 | name: "pool2" 127 | type: POOLING 128 | pooling_param { 129 | pool: MAX 130 | kernel_size: 2 131 | stride: 2 132 | } 133 | } 134 | layers { 135 | bottom: "pool2" 136 | top: "conv3_1" 137 | name: "conv3_1" 138 | type: CONVOLUTION 139 | convolution_param { 140 | num_output: 256 141 | pad: 1 142 | kernel_size: 3 143 | } 144 | } 145 | layers { 146 | bottom: "conv3_1" 147 | top: "conv3_1" 148 | name: "relu3_1" 149 | type: RELU 150 | } 151 | layers { 152 | bottom: "conv3_1" 153 | top: "conv3_2" 154 | name: "conv3_2" 155 | type: CONVOLUTION 156 | convolution_param { 157 | num_output: 256 158 | pad: 1 159 | kernel_size: 3 160 | } 161 | } 162 | layers { 163 | bottom: "conv3_2" 164 | top: "conv3_2" 165 | name: "relu3_2" 166 | type: RELU 167 | } 168 | layers { 169 | bottom: "conv3_2" 170 | top: "conv3_3" 171 | name: "conv3_3" 172 | type: CONVOLUTION 173 | convolution_param { 174 | num_output: 256 175 | pad: 1 176 | kernel_size: 3 177 | } 178 | } 179 | layers { 180 | bottom: "conv3_3" 181 | top: "conv3_3" 182 | name: "relu3_3" 183 | type: RELU 184 | } 185 | layers { 186 | bottom: "conv3_3" 187 | top: "conv3_4" 188 | name: "conv3_4" 189 | type: CONVOLUTION 190 | convolution_param { 191 | num_output: 256 192 | pad: 1 193 | kernel_size: 3 194 | } 195 | } 196 | layers { 197 | bottom: "conv3_4" 198 | top: "conv3_4" 199 | name: "relu3_4" 200 | type: RELU 201 | } 202 | layers { 203 | bottom: "conv3_4" 204 | top: "pool3" 205 | name: "pool3" 206 | type: POOLING 207 | pooling_param { 208 | pool: MAX 209 | kernel_size: 2 210 | stride: 2 211 | } 212 | } 213 | layers { 214 | bottom: "pool3" 215 | top: "conv4_1" 216 | name: "conv4_1" 217 | type: CONVOLUTION 218 | convolution_param { 219 | num_output: 512 220 | pad: 1 221 | kernel_size: 3 222 | } 223 | } 224 | layers { 225 | bottom: "conv4_1" 226 | top: "conv4_1" 227 | name: "relu4_1" 228 | type: RELU 229 | } 230 | layers { 231 | bottom: "conv4_1" 232 | top: "conv4_2" 233 | name: "conv4_2" 234 | type: CONVOLUTION 235 | convolution_param { 236 | num_output: 512 237 | pad: 1 238 | kernel_size: 3 239 | } 240 | } 241 | layers { 242 | bottom: "conv4_2" 243 | top: "conv4_2" 244 | name: "relu4_2" 245 | type: RELU 246 | } 247 | layers { 248 | bottom: "conv4_2" 249 | top: "conv4_3" 250 | name: "conv4_3" 251 | type: CONVOLUTION 252 | convolution_param { 253 | num_output: 512 254 | pad: 1 255 | kernel_size: 3 256 | } 257 | } 258 | layers { 259 | bottom: "conv4_3" 260 | top: "conv4_3" 261 | name: "relu4_3" 262 | type: RELU 263 | } 264 | layers { 265 | bottom: "conv4_3" 266 | top: "conv4_4" 267 | name: "conv4_4" 268 | type: CONVOLUTION 269 | convolution_param { 270 | num_output: 512 271 | pad: 1 272 | kernel_size: 3 273 | } 274 | } 275 | layers { 276 | bottom: "conv4_4" 277 | top: "conv4_4" 278 | name: "relu4_4" 279 | type: RELU 280 | } 281 | layers { 282 | bottom: "conv4_4" 283 | top: "pool4" 284 | name: "pool4" 285 | type: POOLING 286 | pooling_param { 287 | pool: MAX 288 | kernel_size: 2 289 | stride: 2 290 | } 291 | } 292 | layers { 293 | bottom: "pool4" 294 | top: "conv5_1" 295 | name: "conv5_1" 296 | type: CONVOLUTION 297 | convolution_param { 298 | num_output: 512 299 | pad: 1 300 | kernel_size: 3 301 | } 302 | } 303 | layers { 304 | bottom: "conv5_1" 305 | top: "conv5_1" 306 | name: "relu5_1" 307 | type: RELU 308 | } 309 | layers { 310 | bottom: "conv5_1" 311 | top: "conv5_2" 312 | name: "conv5_2" 313 | type: CONVOLUTION 314 | convolution_param { 315 | num_output: 512 316 | pad: 1 317 | kernel_size: 3 318 | } 319 | } 320 | layers { 321 | bottom: "conv5_2" 322 | top: "conv5_2" 323 | name: "relu5_2" 324 | type: RELU 325 | } 326 | layers { 327 | bottom: "conv5_2" 328 | top: "conv5_3" 329 | name: "conv5_3" 330 | type: CONVOLUTION 331 | convolution_param { 332 | num_output: 512 333 | pad: 1 334 | kernel_size: 3 335 | } 336 | } 337 | layers { 338 | bottom: "conv5_3" 339 | top: "conv5_3" 340 | name: "relu5_3" 341 | type: RELU 342 | } 343 | layers { 344 | bottom: "conv5_3" 345 | top: "conv5_4" 346 | name: "conv5_4" 347 | type: CONVOLUTION 348 | convolution_param { 349 | num_output: 512 350 | pad: 1 351 | kernel_size: 3 352 | } 353 | } 354 | layers { 355 | bottom: "conv5_4" 356 | top: "conv5_4" 357 | name: "relu5_4" 358 | type: RELU 359 | } 360 | layers { 361 | bottom: "conv5_4" 362 | top: "pool5" 363 | name: "pool5" 364 | type: POOLING 365 | pooling_param { 366 | pool: MAX 367 | kernel_size: 2 368 | stride: 2 369 | } 370 | } 371 | layers { 372 | bottom: "pool5" 373 | top: "fc6" 374 | name: "fc6" 375 | type: INNER_PRODUCT 376 | inner_product_param { 377 | num_output: 4096 378 | } 379 | } 380 | layers { 381 | bottom: "fc6" 382 | top: "fc6" 383 | name: "relu6" 384 | type: RELU 385 | } 386 | layers { 387 | bottom: "fc6" 388 | top: "fc6" 389 | name: "drop6" 390 | type: DROPOUT 391 | dropout_param { 392 | dropout_ratio: 0.5 393 | } 394 | } 395 | layers { 396 | bottom: "fc6" 397 | top: "fc7" 398 | name: "fc7" 399 | type: INNER_PRODUCT 400 | inner_product_param { 401 | num_output: 4096 402 | } 403 | } 404 | layers { 405 | bottom: "fc7" 406 | top: "fc7" 407 | name: "relu7" 408 | type: RELU 409 | } 410 | layers { 411 | bottom: "fc7" 412 | top: "fc7" 413 | name: "drop7" 414 | type: DROPOUT 415 | dropout_param { 416 | dropout_ratio: 0.5 417 | } 418 | } 419 | layers { 420 | name: "gtsrb_fc8" 421 | bottom: "fc7" 422 | top: "gtsrb_fc8" 423 | type: INNER_PRODUCT 424 | inner_product_param { 425 | num_output: 43 426 | } 427 | } 428 | layers { 429 | name: "loss" 430 | type: SOFTMAX_LOSS 431 | bottom: "gtsrb_fc8" 432 | bottom: "label" 433 | top: "loss/loss" 434 | } 435 | layers { 436 | name: "accuracy/top1" 437 | type: ACCURACY 438 | bottom: "gtsrb_fc8" 439 | bottom: "label" 440 | top: "accuracy@1" 441 | include: { phase: TEST } 442 | accuracy_param { 443 | top_k: 1 444 | } 445 | } 446 | layers { 447 | name: "accuracy/top5" 448 | type: ACCURACY 449 | bottom: "gtsrb_fc8" 450 | bottom: "label" 451 | top: "accuracy@5" 452 | include: { phase: TEST } 453 | accuracy_param { 454 | top_k: 5 455 | } 456 | } -------------------------------------------------------------------------------- /pre_trained network/resnet50/ResNet-50-deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "ResNet-50" 2 | input: "data" 3 | input_dim: 1 4 | input_dim: 3 5 | input_dim: 224 6 | input_dim: 224 7 | 8 | layer { 9 | bottom: "data" 10 | top: "conv1" 11 | name: "conv1" 12 | type: "Convolution" 13 | convolution_param { 14 | num_output: 64 15 | kernel_size: 7 16 | pad: 3 17 | stride: 2 18 | } 19 | } 20 | 21 | layer { 22 | bottom: "conv1" 23 | top: "conv1" 24 | name: "bn_conv1" 25 | type: "BatchNorm" 26 | batch_norm_param { 27 | use_global_stats: true 28 | } 29 | } 30 | 31 | layer { 32 | bottom: "conv1" 33 | top: "conv1" 34 | name: "scale_conv1" 35 | type: "Scale" 36 | scale_param { 37 | bias_term: true 38 | } 39 | } 40 | 41 | layer { 42 | bottom: "conv1" 43 | top: "conv1" 44 | name: "conv1_relu" 45 | type: "ReLU" 46 | } 47 | 48 | layer { 49 | bottom: "conv1" 50 | top: "pool1" 51 | name: "pool1" 52 | type: "Pooling" 53 | pooling_param { 54 | kernel_size: 3 55 | stride: 2 56 | pool: MAX 57 | } 58 | } 59 | 60 | layer { 61 | bottom: "pool1" 62 | top: "res2a_branch1" 63 | name: "res2a_branch1" 64 | type: "Convolution" 65 | convolution_param { 66 | num_output: 256 67 | kernel_size: 1 68 | pad: 0 69 | stride: 1 70 | bias_term: false 71 | } 72 | } 73 | 74 | layer { 75 | bottom: "res2a_branch1" 76 | top: "res2a_branch1" 77 | name: "bn2a_branch1" 78 | type: "BatchNorm" 79 | batch_norm_param { 80 | use_global_stats: true 81 | } 82 | } 83 | 84 | layer { 85 | bottom: "res2a_branch1" 86 | top: "res2a_branch1" 87 | name: "scale2a_branch1" 88 | type: "Scale" 89 | scale_param { 90 | bias_term: true 91 | } 92 | } 93 | 94 | layer { 95 | bottom: "pool1" 96 | top: "res2a_branch2a" 97 | name: "res2a_branch2a" 98 | type: "Convolution" 99 | convolution_param { 100 | num_output: 64 101 | kernel_size: 1 102 | pad: 0 103 | stride: 1 104 | bias_term: false 105 | } 106 | } 107 | 108 | layer { 109 | bottom: "res2a_branch2a" 110 | top: "res2a_branch2a" 111 | name: "bn2a_branch2a" 112 | type: "BatchNorm" 113 | batch_norm_param { 114 | use_global_stats: true 115 | } 116 | } 117 | 118 | layer { 119 | bottom: "res2a_branch2a" 120 | top: "res2a_branch2a" 121 | name: "scale2a_branch2a" 122 | type: "Scale" 123 | scale_param { 124 | bias_term: true 125 | } 126 | } 127 | 128 | layer { 129 | bottom: "res2a_branch2a" 130 | top: "res2a_branch2a" 131 | name: "res2a_branch2a_relu" 132 | type: "ReLU" 133 | } 134 | 135 | layer { 136 | bottom: "res2a_branch2a" 137 | top: "res2a_branch2b" 138 | name: "res2a_branch2b" 139 | type: "Convolution" 140 | convolution_param { 141 | num_output: 64 142 | kernel_size: 3 143 | pad: 1 144 | stride: 1 145 | bias_term: false 146 | } 147 | } 148 | 149 | layer { 150 | bottom: "res2a_branch2b" 151 | top: "res2a_branch2b" 152 | name: "bn2a_branch2b" 153 | type: "BatchNorm" 154 | batch_norm_param { 155 | use_global_stats: true 156 | } 157 | } 158 | 159 | layer { 160 | bottom: "res2a_branch2b" 161 | top: "res2a_branch2b" 162 | name: "scale2a_branch2b" 163 | type: "Scale" 164 | scale_param { 165 | bias_term: true 166 | } 167 | } 168 | 169 | layer { 170 | bottom: "res2a_branch2b" 171 | top: "res2a_branch2b" 172 | name: "res2a_branch2b_relu" 173 | type: "ReLU" 174 | } 175 | 176 | layer { 177 | bottom: "res2a_branch2b" 178 | top: "res2a_branch2c" 179 | name: "res2a_branch2c" 180 | type: "Convolution" 181 | convolution_param { 182 | num_output: 256 183 | kernel_size: 1 184 | pad: 0 185 | stride: 1 186 | bias_term: false 187 | } 188 | } 189 | 190 | layer { 191 | bottom: "res2a_branch2c" 192 | top: "res2a_branch2c" 193 | name: "bn2a_branch2c" 194 | type: "BatchNorm" 195 | batch_norm_param { 196 | use_global_stats: true 197 | } 198 | } 199 | 200 | layer { 201 | bottom: "res2a_branch2c" 202 | top: "res2a_branch2c" 203 | name: "scale2a_branch2c" 204 | type: "Scale" 205 | scale_param { 206 | bias_term: true 207 | } 208 | } 209 | 210 | layer { 211 | bottom: "res2a_branch1" 212 | bottom: "res2a_branch2c" 213 | top: "res2a" 214 | name: "res2a" 215 | type: "Eltwise" 216 | } 217 | 218 | layer { 219 | bottom: "res2a" 220 | top: "res2a" 221 | name: "res2a_relu" 222 | type: "ReLU" 223 | } 224 | 225 | layer { 226 | bottom: "res2a" 227 | top: "res2b_branch2a" 228 | name: "res2b_branch2a" 229 | type: "Convolution" 230 | convolution_param { 231 | num_output: 64 232 | kernel_size: 1 233 | pad: 0 234 | stride: 1 235 | bias_term: false 236 | } 237 | } 238 | 239 | layer { 240 | bottom: "res2b_branch2a" 241 | top: "res2b_branch2a" 242 | name: "bn2b_branch2a" 243 | type: "BatchNorm" 244 | batch_norm_param { 245 | use_global_stats: true 246 | } 247 | } 248 | 249 | layer { 250 | bottom: "res2b_branch2a" 251 | top: "res2b_branch2a" 252 | name: "scale2b_branch2a" 253 | type: "Scale" 254 | scale_param { 255 | bias_term: true 256 | } 257 | } 258 | 259 | layer { 260 | bottom: "res2b_branch2a" 261 | top: "res2b_branch2a" 262 | name: "res2b_branch2a_relu" 263 | type: "ReLU" 264 | } 265 | 266 | layer { 267 | bottom: "res2b_branch2a" 268 | top: "res2b_branch2b" 269 | name: "res2b_branch2b" 270 | type: "Convolution" 271 | convolution_param { 272 | num_output: 64 273 | kernel_size: 3 274 | pad: 1 275 | stride: 1 276 | bias_term: false 277 | } 278 | } 279 | 280 | layer { 281 | bottom: "res2b_branch2b" 282 | top: "res2b_branch2b" 283 | name: "bn2b_branch2b" 284 | type: "BatchNorm" 285 | batch_norm_param { 286 | use_global_stats: true 287 | } 288 | } 289 | 290 | layer { 291 | bottom: "res2b_branch2b" 292 | top: "res2b_branch2b" 293 | name: "scale2b_branch2b" 294 | type: "Scale" 295 | scale_param { 296 | bias_term: true 297 | } 298 | } 299 | 300 | layer { 301 | bottom: "res2b_branch2b" 302 | top: "res2b_branch2b" 303 | name: "res2b_branch2b_relu" 304 | type: "ReLU" 305 | } 306 | 307 | layer { 308 | bottom: "res2b_branch2b" 309 | top: "res2b_branch2c" 310 | name: "res2b_branch2c" 311 | type: "Convolution" 312 | convolution_param { 313 | num_output: 256 314 | kernel_size: 1 315 | pad: 0 316 | stride: 1 317 | bias_term: false 318 | } 319 | } 320 | 321 | layer { 322 | bottom: "res2b_branch2c" 323 | top: "res2b_branch2c" 324 | name: "bn2b_branch2c" 325 | type: "BatchNorm" 326 | batch_norm_param { 327 | use_global_stats: true 328 | } 329 | } 330 | 331 | layer { 332 | bottom: "res2b_branch2c" 333 | top: "res2b_branch2c" 334 | name: "scale2b_branch2c" 335 | type: "Scale" 336 | scale_param { 337 | bias_term: true 338 | } 339 | } 340 | 341 | layer { 342 | bottom: "res2a" 343 | bottom: "res2b_branch2c" 344 | top: "res2b" 345 | name: "res2b" 346 | type: "Eltwise" 347 | } 348 | 349 | layer { 350 | bottom: "res2b" 351 | top: "res2b" 352 | name: "res2b_relu" 353 | type: "ReLU" 354 | } 355 | 356 | layer { 357 | bottom: "res2b" 358 | top: "res2c_branch2a" 359 | name: "res2c_branch2a" 360 | type: "Convolution" 361 | convolution_param { 362 | num_output: 64 363 | kernel_size: 1 364 | pad: 0 365 | stride: 1 366 | bias_term: false 367 | } 368 | } 369 | 370 | layer { 371 | bottom: "res2c_branch2a" 372 | top: "res2c_branch2a" 373 | name: "bn2c_branch2a" 374 | type: "BatchNorm" 375 | batch_norm_param { 376 | use_global_stats: true 377 | } 378 | } 379 | 380 | layer { 381 | bottom: "res2c_branch2a" 382 | top: "res2c_branch2a" 383 | name: "scale2c_branch2a" 384 | type: "Scale" 385 | scale_param { 386 | bias_term: true 387 | } 388 | } 389 | 390 | layer { 391 | bottom: "res2c_branch2a" 392 | top: "res2c_branch2a" 393 | name: "res2c_branch2a_relu" 394 | type: "ReLU" 395 | } 396 | 397 | layer { 398 | bottom: "res2c_branch2a" 399 | top: "res2c_branch2b" 400 | name: "res2c_branch2b" 401 | type: "Convolution" 402 | convolution_param { 403 | num_output: 64 404 | kernel_size: 3 405 | pad: 1 406 | stride: 1 407 | bias_term: false 408 | } 409 | } 410 | 411 | layer { 412 | bottom: "res2c_branch2b" 413 | top: "res2c_branch2b" 414 | name: "bn2c_branch2b" 415 | type: "BatchNorm" 416 | batch_norm_param { 417 | use_global_stats: true 418 | } 419 | } 420 | 421 | layer { 422 | bottom: "res2c_branch2b" 423 | top: "res2c_branch2b" 424 | name: "scale2c_branch2b" 425 | type: "Scale" 426 | scale_param { 427 | bias_term: true 428 | } 429 | } 430 | 431 | layer { 432 | bottom: "res2c_branch2b" 433 | top: "res2c_branch2b" 434 | name: "res2c_branch2b_relu" 435 | type: "ReLU" 436 | } 437 | 438 | layer { 439 | bottom: "res2c_branch2b" 440 | top: "res2c_branch2c" 441 | name: "res2c_branch2c" 442 | type: "Convolution" 443 | convolution_param { 444 | num_output: 256 445 | kernel_size: 1 446 | pad: 0 447 | stride: 1 448 | bias_term: false 449 | } 450 | } 451 | 452 | layer { 453 | bottom: "res2c_branch2c" 454 | top: "res2c_branch2c" 455 | name: "bn2c_branch2c" 456 | type: "BatchNorm" 457 | batch_norm_param { 458 | use_global_stats: true 459 | } 460 | } 461 | 462 | layer { 463 | bottom: "res2c_branch2c" 464 | top: "res2c_branch2c" 465 | name: "scale2c_branch2c" 466 | type: "Scale" 467 | scale_param { 468 | bias_term: true 469 | } 470 | } 471 | 472 | layer { 473 | bottom: "res2b" 474 | bottom: "res2c_branch2c" 475 | top: "res2c" 476 | name: "res2c" 477 | type: "Eltwise" 478 | } 479 | 480 | layer { 481 | bottom: "res2c" 482 | top: "res2c" 483 | name: "res2c_relu" 484 | type: "ReLU" 485 | } 486 | 487 | layer { 488 | bottom: "res2c" 489 | top: "res3a_branch1" 490 | name: "res3a_branch1" 491 | type: "Convolution" 492 | convolution_param { 493 | num_output: 512 494 | kernel_size: 1 495 | pad: 0 496 | stride: 2 497 | bias_term: false 498 | } 499 | } 500 | 501 | layer { 502 | bottom: "res3a_branch1" 503 | top: "res3a_branch1" 504 | name: "bn3a_branch1" 505 | type: "BatchNorm" 506 | batch_norm_param { 507 | use_global_stats: true 508 | } 509 | } 510 | 511 | layer { 512 | bottom: "res3a_branch1" 513 | top: "res3a_branch1" 514 | name: "scale3a_branch1" 515 | type: "Scale" 516 | scale_param { 517 | bias_term: true 518 | } 519 | } 520 | 521 | layer { 522 | bottom: "res2c" 523 | top: "res3a_branch2a" 524 | name: "res3a_branch2a" 525 | type: "Convolution" 526 | convolution_param { 527 | num_output: 128 528 | kernel_size: 1 529 | pad: 0 530 | stride: 2 531 | bias_term: false 532 | } 533 | } 534 | 535 | layer { 536 | bottom: "res3a_branch2a" 537 | top: "res3a_branch2a" 538 | name: "bn3a_branch2a" 539 | type: "BatchNorm" 540 | batch_norm_param { 541 | use_global_stats: true 542 | } 543 | } 544 | 545 | layer { 546 | bottom: "res3a_branch2a" 547 | top: "res3a_branch2a" 548 | name: "scale3a_branch2a" 549 | type: "Scale" 550 | scale_param { 551 | bias_term: true 552 | } 553 | } 554 | 555 | layer { 556 | bottom: "res3a_branch2a" 557 | top: "res3a_branch2a" 558 | name: "res3a_branch2a_relu" 559 | type: "ReLU" 560 | } 561 | 562 | layer { 563 | bottom: "res3a_branch2a" 564 | top: "res3a_branch2b" 565 | name: "res3a_branch2b" 566 | type: "Convolution" 567 | convolution_param { 568 | num_output: 128 569 | kernel_size: 3 570 | pad: 1 571 | stride: 1 572 | bias_term: false 573 | } 574 | } 575 | 576 | layer { 577 | bottom: "res3a_branch2b" 578 | top: "res3a_branch2b" 579 | name: "bn3a_branch2b" 580 | type: "BatchNorm" 581 | batch_norm_param { 582 | use_global_stats: true 583 | } 584 | } 585 | 586 | layer { 587 | bottom: "res3a_branch2b" 588 | top: "res3a_branch2b" 589 | name: "scale3a_branch2b" 590 | type: "Scale" 591 | scale_param { 592 | bias_term: true 593 | } 594 | } 595 | 596 | layer { 597 | bottom: "res3a_branch2b" 598 | top: "res3a_branch2b" 599 | name: "res3a_branch2b_relu" 600 | type: "ReLU" 601 | } 602 | 603 | layer { 604 | bottom: "res3a_branch2b" 605 | top: "res3a_branch2c" 606 | name: "res3a_branch2c" 607 | type: "Convolution" 608 | convolution_param { 609 | num_output: 512 610 | kernel_size: 1 611 | pad: 0 612 | stride: 1 613 | bias_term: false 614 | } 615 | } 616 | 617 | layer { 618 | bottom: "res3a_branch2c" 619 | top: "res3a_branch2c" 620 | name: "bn3a_branch2c" 621 | type: "BatchNorm" 622 | batch_norm_param { 623 | use_global_stats: true 624 | } 625 | } 626 | 627 | layer { 628 | bottom: "res3a_branch2c" 629 | top: "res3a_branch2c" 630 | name: "scale3a_branch2c" 631 | type: "Scale" 632 | scale_param { 633 | bias_term: true 634 | } 635 | } 636 | 637 | layer { 638 | bottom: "res3a_branch1" 639 | bottom: "res3a_branch2c" 640 | top: "res3a" 641 | name: "res3a" 642 | type: "Eltwise" 643 | } 644 | 645 | layer { 646 | bottom: "res3a" 647 | top: "res3a" 648 | name: "res3a_relu" 649 | type: "ReLU" 650 | } 651 | 652 | layer { 653 | bottom: "res3a" 654 | top: "res3b_branch2a" 655 | name: "res3b_branch2a" 656 | type: "Convolution" 657 | convolution_param { 658 | num_output: 128 659 | kernel_size: 1 660 | pad: 0 661 | stride: 1 662 | bias_term: false 663 | } 664 | } 665 | 666 | layer { 667 | bottom: "res3b_branch2a" 668 | top: "res3b_branch2a" 669 | name: "bn3b_branch2a" 670 | type: "BatchNorm" 671 | batch_norm_param { 672 | use_global_stats: true 673 | } 674 | } 675 | 676 | layer { 677 | bottom: "res3b_branch2a" 678 | top: "res3b_branch2a" 679 | name: "scale3b_branch2a" 680 | type: "Scale" 681 | scale_param { 682 | bias_term: true 683 | } 684 | } 685 | 686 | layer { 687 | bottom: "res3b_branch2a" 688 | top: "res3b_branch2a" 689 | name: "res3b_branch2a_relu" 690 | type: "ReLU" 691 | } 692 | 693 | layer { 694 | bottom: "res3b_branch2a" 695 | top: "res3b_branch2b" 696 | name: "res3b_branch2b" 697 | type: "Convolution" 698 | convolution_param { 699 | num_output: 128 700 | kernel_size: 3 701 | pad: 1 702 | stride: 1 703 | bias_term: false 704 | } 705 | } 706 | 707 | layer { 708 | bottom: "res3b_branch2b" 709 | top: "res3b_branch2b" 710 | name: "bn3b_branch2b" 711 | type: "BatchNorm" 712 | batch_norm_param { 713 | use_global_stats: true 714 | } 715 | } 716 | 717 | layer { 718 | bottom: "res3b_branch2b" 719 | top: "res3b_branch2b" 720 | name: "scale3b_branch2b" 721 | type: "Scale" 722 | scale_param { 723 | bias_term: true 724 | } 725 | } 726 | 727 | layer { 728 | bottom: "res3b_branch2b" 729 | top: "res3b_branch2b" 730 | name: "res3b_branch2b_relu" 731 | type: "ReLU" 732 | } 733 | 734 | layer { 735 | bottom: "res3b_branch2b" 736 | top: "res3b_branch2c" 737 | name: "res3b_branch2c" 738 | type: "Convolution" 739 | convolution_param { 740 | num_output: 512 741 | kernel_size: 1 742 | pad: 0 743 | stride: 1 744 | bias_term: false 745 | } 746 | } 747 | 748 | layer { 749 | bottom: "res3b_branch2c" 750 | top: "res3b_branch2c" 751 | name: "bn3b_branch2c" 752 | type: "BatchNorm" 753 | batch_norm_param { 754 | use_global_stats: true 755 | } 756 | } 757 | 758 | layer { 759 | bottom: "res3b_branch2c" 760 | top: "res3b_branch2c" 761 | name: "scale3b_branch2c" 762 | type: "Scale" 763 | scale_param { 764 | bias_term: true 765 | } 766 | } 767 | 768 | layer { 769 | bottom: "res3a" 770 | bottom: "res3b_branch2c" 771 | top: "res3b" 772 | name: "res3b" 773 | type: "Eltwise" 774 | } 775 | 776 | layer { 777 | bottom: "res3b" 778 | top: "res3b" 779 | name: "res3b_relu" 780 | type: "ReLU" 781 | } 782 | 783 | layer { 784 | bottom: "res3b" 785 | top: "res3c_branch2a" 786 | name: "res3c_branch2a" 787 | type: "Convolution" 788 | convolution_param { 789 | num_output: 128 790 | kernel_size: 1 791 | pad: 0 792 | stride: 1 793 | bias_term: false 794 | } 795 | } 796 | 797 | layer { 798 | bottom: "res3c_branch2a" 799 | top: "res3c_branch2a" 800 | name: "bn3c_branch2a" 801 | type: "BatchNorm" 802 | batch_norm_param { 803 | use_global_stats: true 804 | } 805 | } 806 | 807 | layer { 808 | bottom: "res3c_branch2a" 809 | top: "res3c_branch2a" 810 | name: "scale3c_branch2a" 811 | type: "Scale" 812 | scale_param { 813 | bias_term: true 814 | } 815 | } 816 | 817 | layer { 818 | bottom: "res3c_branch2a" 819 | top: "res3c_branch2a" 820 | name: "res3c_branch2a_relu" 821 | type: "ReLU" 822 | } 823 | 824 | layer { 825 | bottom: "res3c_branch2a" 826 | top: "res3c_branch2b" 827 | name: "res3c_branch2b" 828 | type: "Convolution" 829 | convolution_param { 830 | num_output: 128 831 | kernel_size: 3 832 | pad: 1 833 | stride: 1 834 | bias_term: false 835 | } 836 | } 837 | 838 | layer { 839 | bottom: "res3c_branch2b" 840 | top: "res3c_branch2b" 841 | name: "bn3c_branch2b" 842 | type: "BatchNorm" 843 | batch_norm_param { 844 | use_global_stats: true 845 | } 846 | } 847 | 848 | layer { 849 | bottom: "res3c_branch2b" 850 | top: "res3c_branch2b" 851 | name: "scale3c_branch2b" 852 | type: "Scale" 853 | scale_param { 854 | bias_term: true 855 | } 856 | } 857 | 858 | layer { 859 | bottom: "res3c_branch2b" 860 | top: "res3c_branch2b" 861 | name: "res3c_branch2b_relu" 862 | type: "ReLU" 863 | } 864 | 865 | layer { 866 | bottom: "res3c_branch2b" 867 | top: "res3c_branch2c" 868 | name: "res3c_branch2c" 869 | type: "Convolution" 870 | convolution_param { 871 | num_output: 512 872 | kernel_size: 1 873 | pad: 0 874 | stride: 1 875 | bias_term: false 876 | } 877 | } 878 | 879 | layer { 880 | bottom: "res3c_branch2c" 881 | top: "res3c_branch2c" 882 | name: "bn3c_branch2c" 883 | type: "BatchNorm" 884 | batch_norm_param { 885 | use_global_stats: true 886 | } 887 | } 888 | 889 | layer { 890 | bottom: "res3c_branch2c" 891 | top: "res3c_branch2c" 892 | name: "scale3c_branch2c" 893 | type: "Scale" 894 | scale_param { 895 | bias_term: true 896 | } 897 | } 898 | 899 | layer { 900 | bottom: "res3b" 901 | bottom: "res3c_branch2c" 902 | top: "res3c" 903 | name: "res3c" 904 | type: "Eltwise" 905 | } 906 | 907 | layer { 908 | bottom: "res3c" 909 | top: "res3c" 910 | name: "res3c_relu" 911 | type: "ReLU" 912 | } 913 | 914 | layer { 915 | bottom: "res3c" 916 | top: "res3d_branch2a" 917 | name: "res3d_branch2a" 918 | type: "Convolution" 919 | convolution_param { 920 | num_output: 128 921 | kernel_size: 1 922 | pad: 0 923 | stride: 1 924 | bias_term: false 925 | } 926 | } 927 | 928 | layer { 929 | bottom: "res3d_branch2a" 930 | top: "res3d_branch2a" 931 | name: "bn3d_branch2a" 932 | type: "BatchNorm" 933 | batch_norm_param { 934 | use_global_stats: true 935 | } 936 | } 937 | 938 | layer { 939 | bottom: "res3d_branch2a" 940 | top: "res3d_branch2a" 941 | name: "scale3d_branch2a" 942 | type: "Scale" 943 | scale_param { 944 | bias_term: true 945 | } 946 | } 947 | 948 | layer { 949 | bottom: "res3d_branch2a" 950 | top: "res3d_branch2a" 951 | name: "res3d_branch2a_relu" 952 | type: "ReLU" 953 | } 954 | 955 | layer { 956 | bottom: "res3d_branch2a" 957 | top: "res3d_branch2b" 958 | name: "res3d_branch2b" 959 | type: "Convolution" 960 | convolution_param { 961 | num_output: 128 962 | kernel_size: 3 963 | pad: 1 964 | stride: 1 965 | bias_term: false 966 | } 967 | } 968 | 969 | layer { 970 | bottom: "res3d_branch2b" 971 | top: "res3d_branch2b" 972 | name: "bn3d_branch2b" 973 | type: "BatchNorm" 974 | batch_norm_param { 975 | use_global_stats: true 976 | } 977 | } 978 | 979 | layer { 980 | bottom: "res3d_branch2b" 981 | top: "res3d_branch2b" 982 | name: "scale3d_branch2b" 983 | type: "Scale" 984 | scale_param { 985 | bias_term: true 986 | } 987 | } 988 | 989 | layer { 990 | bottom: "res3d_branch2b" 991 | top: "res3d_branch2b" 992 | name: "res3d_branch2b_relu" 993 | type: "ReLU" 994 | } 995 | 996 | layer { 997 | bottom: "res3d_branch2b" 998 | top: "res3d_branch2c" 999 | name: "res3d_branch2c" 1000 | type: "Convolution" 1001 | convolution_param { 1002 | num_output: 512 1003 | kernel_size: 1 1004 | pad: 0 1005 | stride: 1 1006 | bias_term: false 1007 | } 1008 | } 1009 | 1010 | layer { 1011 | bottom: "res3d_branch2c" 1012 | top: "res3d_branch2c" 1013 | name: "bn3d_branch2c" 1014 | type: "BatchNorm" 1015 | batch_norm_param { 1016 | use_global_stats: true 1017 | } 1018 | } 1019 | 1020 | layer { 1021 | bottom: "res3d_branch2c" 1022 | top: "res3d_branch2c" 1023 | name: "scale3d_branch2c" 1024 | type: "Scale" 1025 | scale_param { 1026 | bias_term: true 1027 | } 1028 | } 1029 | 1030 | layer { 1031 | bottom: "res3c" 1032 | bottom: "res3d_branch2c" 1033 | top: "res3d" 1034 | name: "res3d" 1035 | type: "Eltwise" 1036 | } 1037 | 1038 | layer { 1039 | bottom: "res3d" 1040 | top: "res3d" 1041 | name: "res3d_relu" 1042 | type: "ReLU" 1043 | } 1044 | 1045 | layer { 1046 | bottom: "res3d" 1047 | top: "res4a_branch1" 1048 | name: "res4a_branch1" 1049 | type: "Convolution" 1050 | convolution_param { 1051 | num_output: 1024 1052 | kernel_size: 1 1053 | pad: 0 1054 | stride: 2 1055 | bias_term: false 1056 | } 1057 | } 1058 | 1059 | layer { 1060 | bottom: "res4a_branch1" 1061 | top: "res4a_branch1" 1062 | name: "bn4a_branch1" 1063 | type: "BatchNorm" 1064 | batch_norm_param { 1065 | use_global_stats: true 1066 | } 1067 | } 1068 | 1069 | layer { 1070 | bottom: "res4a_branch1" 1071 | top: "res4a_branch1" 1072 | name: "scale4a_branch1" 1073 | type: "Scale" 1074 | scale_param { 1075 | bias_term: true 1076 | } 1077 | } 1078 | 1079 | layer { 1080 | bottom: "res3d" 1081 | top: "res4a_branch2a" 1082 | name: "res4a_branch2a" 1083 | type: "Convolution" 1084 | convolution_param { 1085 | num_output: 256 1086 | kernel_size: 1 1087 | pad: 0 1088 | stride: 2 1089 | bias_term: false 1090 | } 1091 | } 1092 | 1093 | layer { 1094 | bottom: "res4a_branch2a" 1095 | top: "res4a_branch2a" 1096 | name: "bn4a_branch2a" 1097 | type: "BatchNorm" 1098 | batch_norm_param { 1099 | use_global_stats: true 1100 | } 1101 | } 1102 | 1103 | layer { 1104 | bottom: "res4a_branch2a" 1105 | top: "res4a_branch2a" 1106 | name: "scale4a_branch2a" 1107 | type: "Scale" 1108 | scale_param { 1109 | bias_term: true 1110 | } 1111 | } 1112 | 1113 | layer { 1114 | bottom: "res4a_branch2a" 1115 | top: "res4a_branch2a" 1116 | name: "res4a_branch2a_relu" 1117 | type: "ReLU" 1118 | } 1119 | 1120 | layer { 1121 | bottom: "res4a_branch2a" 1122 | top: "res4a_branch2b" 1123 | name: "res4a_branch2b" 1124 | type: "Convolution" 1125 | convolution_param { 1126 | num_output: 256 1127 | kernel_size: 3 1128 | pad: 1 1129 | stride: 1 1130 | bias_term: false 1131 | } 1132 | } 1133 | 1134 | layer { 1135 | bottom: "res4a_branch2b" 1136 | top: "res4a_branch2b" 1137 | name: "bn4a_branch2b" 1138 | type: "BatchNorm" 1139 | batch_norm_param { 1140 | use_global_stats: true 1141 | } 1142 | } 1143 | 1144 | layer { 1145 | bottom: "res4a_branch2b" 1146 | top: "res4a_branch2b" 1147 | name: "scale4a_branch2b" 1148 | type: "Scale" 1149 | scale_param { 1150 | bias_term: true 1151 | } 1152 | } 1153 | 1154 | layer { 1155 | bottom: "res4a_branch2b" 1156 | top: "res4a_branch2b" 1157 | name: "res4a_branch2b_relu" 1158 | type: "ReLU" 1159 | } 1160 | 1161 | layer { 1162 | bottom: "res4a_branch2b" 1163 | top: "res4a_branch2c" 1164 | name: "res4a_branch2c" 1165 | type: "Convolution" 1166 | convolution_param { 1167 | num_output: 1024 1168 | kernel_size: 1 1169 | pad: 0 1170 | stride: 1 1171 | bias_term: false 1172 | } 1173 | } 1174 | 1175 | layer { 1176 | bottom: "res4a_branch2c" 1177 | top: "res4a_branch2c" 1178 | name: "bn4a_branch2c" 1179 | type: "BatchNorm" 1180 | batch_norm_param { 1181 | use_global_stats: true 1182 | } 1183 | } 1184 | 1185 | layer { 1186 | bottom: "res4a_branch2c" 1187 | top: "res4a_branch2c" 1188 | name: "scale4a_branch2c" 1189 | type: "Scale" 1190 | scale_param { 1191 | bias_term: true 1192 | } 1193 | } 1194 | 1195 | layer { 1196 | bottom: "res4a_branch1" 1197 | bottom: "res4a_branch2c" 1198 | top: "res4a" 1199 | name: "res4a" 1200 | type: "Eltwise" 1201 | } 1202 | 1203 | layer { 1204 | bottom: "res4a" 1205 | top: "res4a" 1206 | name: "res4a_relu" 1207 | type: "ReLU" 1208 | } 1209 | 1210 | layer { 1211 | bottom: "res4a" 1212 | top: "res4b_branch2a" 1213 | name: "res4b_branch2a" 1214 | type: "Convolution" 1215 | convolution_param { 1216 | num_output: 256 1217 | kernel_size: 1 1218 | pad: 0 1219 | stride: 1 1220 | bias_term: false 1221 | } 1222 | } 1223 | 1224 | layer { 1225 | bottom: "res4b_branch2a" 1226 | top: "res4b_branch2a" 1227 | name: "bn4b_branch2a" 1228 | type: "BatchNorm" 1229 | batch_norm_param { 1230 | use_global_stats: true 1231 | } 1232 | } 1233 | 1234 | layer { 1235 | bottom: "res4b_branch2a" 1236 | top: "res4b_branch2a" 1237 | name: "scale4b_branch2a" 1238 | type: "Scale" 1239 | scale_param { 1240 | bias_term: true 1241 | } 1242 | } 1243 | 1244 | layer { 1245 | bottom: "res4b_branch2a" 1246 | top: "res4b_branch2a" 1247 | name: "res4b_branch2a_relu" 1248 | type: "ReLU" 1249 | } 1250 | 1251 | layer { 1252 | bottom: "res4b_branch2a" 1253 | top: "res4b_branch2b" 1254 | name: "res4b_branch2b" 1255 | type: "Convolution" 1256 | convolution_param { 1257 | num_output: 256 1258 | kernel_size: 3 1259 | pad: 1 1260 | stride: 1 1261 | bias_term: false 1262 | } 1263 | } 1264 | 1265 | layer { 1266 | bottom: "res4b_branch2b" 1267 | top: "res4b_branch2b" 1268 | name: "bn4b_branch2b" 1269 | type: "BatchNorm" 1270 | batch_norm_param { 1271 | use_global_stats: true 1272 | } 1273 | } 1274 | 1275 | layer { 1276 | bottom: "res4b_branch2b" 1277 | top: "res4b_branch2b" 1278 | name: "scale4b_branch2b" 1279 | type: "Scale" 1280 | scale_param { 1281 | bias_term: true 1282 | } 1283 | } 1284 | 1285 | layer { 1286 | bottom: "res4b_branch2b" 1287 | top: "res4b_branch2b" 1288 | name: "res4b_branch2b_relu" 1289 | type: "ReLU" 1290 | } 1291 | 1292 | layer { 1293 | bottom: "res4b_branch2b" 1294 | top: "res4b_branch2c" 1295 | name: "res4b_branch2c" 1296 | type: "Convolution" 1297 | convolution_param { 1298 | num_output: 1024 1299 | kernel_size: 1 1300 | pad: 0 1301 | stride: 1 1302 | bias_term: false 1303 | } 1304 | } 1305 | 1306 | layer { 1307 | bottom: "res4b_branch2c" 1308 | top: "res4b_branch2c" 1309 | name: "bn4b_branch2c" 1310 | type: "BatchNorm" 1311 | batch_norm_param { 1312 | use_global_stats: true 1313 | } 1314 | } 1315 | 1316 | layer { 1317 | bottom: "res4b_branch2c" 1318 | top: "res4b_branch2c" 1319 | name: "scale4b_branch2c" 1320 | type: "Scale" 1321 | scale_param { 1322 | bias_term: true 1323 | } 1324 | } 1325 | 1326 | layer { 1327 | bottom: "res4a" 1328 | bottom: "res4b_branch2c" 1329 | top: "res4b" 1330 | name: "res4b" 1331 | type: "Eltwise" 1332 | } 1333 | 1334 | layer { 1335 | bottom: "res4b" 1336 | top: "res4b" 1337 | name: "res4b_relu" 1338 | type: "ReLU" 1339 | } 1340 | 1341 | layer { 1342 | bottom: "res4b" 1343 | top: "res4c_branch2a" 1344 | name: "res4c_branch2a" 1345 | type: "Convolution" 1346 | convolution_param { 1347 | num_output: 256 1348 | kernel_size: 1 1349 | pad: 0 1350 | stride: 1 1351 | bias_term: false 1352 | } 1353 | } 1354 | 1355 | layer { 1356 | bottom: "res4c_branch2a" 1357 | top: "res4c_branch2a" 1358 | name: "bn4c_branch2a" 1359 | type: "BatchNorm" 1360 | batch_norm_param { 1361 | use_global_stats: true 1362 | } 1363 | } 1364 | 1365 | layer { 1366 | bottom: "res4c_branch2a" 1367 | top: "res4c_branch2a" 1368 | name: "scale4c_branch2a" 1369 | type: "Scale" 1370 | scale_param { 1371 | bias_term: true 1372 | } 1373 | } 1374 | 1375 | layer { 1376 | bottom: "res4c_branch2a" 1377 | top: "res4c_branch2a" 1378 | name: "res4c_branch2a_relu" 1379 | type: "ReLU" 1380 | } 1381 | 1382 | layer { 1383 | bottom: "res4c_branch2a" 1384 | top: "res4c_branch2b" 1385 | name: "res4c_branch2b" 1386 | type: "Convolution" 1387 | convolution_param { 1388 | num_output: 256 1389 | kernel_size: 3 1390 | pad: 1 1391 | stride: 1 1392 | bias_term: false 1393 | } 1394 | } 1395 | 1396 | layer { 1397 | bottom: "res4c_branch2b" 1398 | top: "res4c_branch2b" 1399 | name: "bn4c_branch2b" 1400 | type: "BatchNorm" 1401 | batch_norm_param { 1402 | use_global_stats: true 1403 | } 1404 | } 1405 | 1406 | layer { 1407 | bottom: "res4c_branch2b" 1408 | top: "res4c_branch2b" 1409 | name: "scale4c_branch2b" 1410 | type: "Scale" 1411 | scale_param { 1412 | bias_term: true 1413 | } 1414 | } 1415 | 1416 | layer { 1417 | bottom: "res4c_branch2b" 1418 | top: "res4c_branch2b" 1419 | name: "res4c_branch2b_relu" 1420 | type: "ReLU" 1421 | } 1422 | 1423 | layer { 1424 | bottom: "res4c_branch2b" 1425 | top: "res4c_branch2c" 1426 | name: "res4c_branch2c" 1427 | type: "Convolution" 1428 | convolution_param { 1429 | num_output: 1024 1430 | kernel_size: 1 1431 | pad: 0 1432 | stride: 1 1433 | bias_term: false 1434 | } 1435 | } 1436 | 1437 | layer { 1438 | bottom: "res4c_branch2c" 1439 | top: "res4c_branch2c" 1440 | name: "bn4c_branch2c" 1441 | type: "BatchNorm" 1442 | batch_norm_param { 1443 | use_global_stats: true 1444 | } 1445 | } 1446 | 1447 | layer { 1448 | bottom: "res4c_branch2c" 1449 | top: "res4c_branch2c" 1450 | name: "scale4c_branch2c" 1451 | type: "Scale" 1452 | scale_param { 1453 | bias_term: true 1454 | } 1455 | } 1456 | 1457 | layer { 1458 | bottom: "res4b" 1459 | bottom: "res4c_branch2c" 1460 | top: "res4c" 1461 | name: "res4c" 1462 | type: "Eltwise" 1463 | } 1464 | 1465 | layer { 1466 | bottom: "res4c" 1467 | top: "res4c" 1468 | name: "res4c_relu" 1469 | type: "ReLU" 1470 | } 1471 | 1472 | layer { 1473 | bottom: "res4c" 1474 | top: "res4d_branch2a" 1475 | name: "res4d_branch2a" 1476 | type: "Convolution" 1477 | convolution_param { 1478 | num_output: 256 1479 | kernel_size: 1 1480 | pad: 0 1481 | stride: 1 1482 | bias_term: false 1483 | } 1484 | } 1485 | 1486 | layer { 1487 | bottom: "res4d_branch2a" 1488 | top: "res4d_branch2a" 1489 | name: "bn4d_branch2a" 1490 | type: "BatchNorm" 1491 | batch_norm_param { 1492 | use_global_stats: true 1493 | } 1494 | } 1495 | 1496 | layer { 1497 | bottom: "res4d_branch2a" 1498 | top: "res4d_branch2a" 1499 | name: "scale4d_branch2a" 1500 | type: "Scale" 1501 | scale_param { 1502 | bias_term: true 1503 | } 1504 | } 1505 | 1506 | layer { 1507 | bottom: "res4d_branch2a" 1508 | top: "res4d_branch2a" 1509 | name: "res4d_branch2a_relu" 1510 | type: "ReLU" 1511 | } 1512 | 1513 | layer { 1514 | bottom: "res4d_branch2a" 1515 | top: "res4d_branch2b" 1516 | name: "res4d_branch2b" 1517 | type: "Convolution" 1518 | convolution_param { 1519 | num_output: 256 1520 | kernel_size: 3 1521 | pad: 1 1522 | stride: 1 1523 | bias_term: false 1524 | } 1525 | } 1526 | 1527 | layer { 1528 | bottom: "res4d_branch2b" 1529 | top: "res4d_branch2b" 1530 | name: "bn4d_branch2b" 1531 | type: "BatchNorm" 1532 | batch_norm_param { 1533 | use_global_stats: true 1534 | } 1535 | } 1536 | 1537 | layer { 1538 | bottom: "res4d_branch2b" 1539 | top: "res4d_branch2b" 1540 | name: "scale4d_branch2b" 1541 | type: "Scale" 1542 | scale_param { 1543 | bias_term: true 1544 | } 1545 | } 1546 | 1547 | layer { 1548 | bottom: "res4d_branch2b" 1549 | top: "res4d_branch2b" 1550 | name: "res4d_branch2b_relu" 1551 | type: "ReLU" 1552 | } 1553 | 1554 | layer { 1555 | bottom: "res4d_branch2b" 1556 | top: "res4d_branch2c" 1557 | name: "res4d_branch2c" 1558 | type: "Convolution" 1559 | convolution_param { 1560 | num_output: 1024 1561 | kernel_size: 1 1562 | pad: 0 1563 | stride: 1 1564 | bias_term: false 1565 | } 1566 | } 1567 | 1568 | layer { 1569 | bottom: "res4d_branch2c" 1570 | top: "res4d_branch2c" 1571 | name: "bn4d_branch2c" 1572 | type: "BatchNorm" 1573 | batch_norm_param { 1574 | use_global_stats: true 1575 | } 1576 | } 1577 | 1578 | layer { 1579 | bottom: "res4d_branch2c" 1580 | top: "res4d_branch2c" 1581 | name: "scale4d_branch2c" 1582 | type: "Scale" 1583 | scale_param { 1584 | bias_term: true 1585 | } 1586 | } 1587 | 1588 | layer { 1589 | bottom: "res4c" 1590 | bottom: "res4d_branch2c" 1591 | top: "res4d" 1592 | name: "res4d" 1593 | type: "Eltwise" 1594 | } 1595 | 1596 | layer { 1597 | bottom: "res4d" 1598 | top: "res4d" 1599 | name: "res4d_relu" 1600 | type: "ReLU" 1601 | } 1602 | 1603 | layer { 1604 | bottom: "res4d" 1605 | top: "res4e_branch2a" 1606 | name: "res4e_branch2a" 1607 | type: "Convolution" 1608 | convolution_param { 1609 | num_output: 256 1610 | kernel_size: 1 1611 | pad: 0 1612 | stride: 1 1613 | bias_term: false 1614 | } 1615 | } 1616 | 1617 | layer { 1618 | bottom: "res4e_branch2a" 1619 | top: "res4e_branch2a" 1620 | name: "bn4e_branch2a" 1621 | type: "BatchNorm" 1622 | batch_norm_param { 1623 | use_global_stats: true 1624 | } 1625 | } 1626 | 1627 | layer { 1628 | bottom: "res4e_branch2a" 1629 | top: "res4e_branch2a" 1630 | name: "scale4e_branch2a" 1631 | type: "Scale" 1632 | scale_param { 1633 | bias_term: true 1634 | } 1635 | } 1636 | 1637 | layer { 1638 | bottom: "res4e_branch2a" 1639 | top: "res4e_branch2a" 1640 | name: "res4e_branch2a_relu" 1641 | type: "ReLU" 1642 | } 1643 | 1644 | layer { 1645 | bottom: "res4e_branch2a" 1646 | top: "res4e_branch2b" 1647 | name: "res4e_branch2b" 1648 | type: "Convolution" 1649 | convolution_param { 1650 | num_output: 256 1651 | kernel_size: 3 1652 | pad: 1 1653 | stride: 1 1654 | bias_term: false 1655 | } 1656 | } 1657 | 1658 | layer { 1659 | bottom: "res4e_branch2b" 1660 | top: "res4e_branch2b" 1661 | name: "bn4e_branch2b" 1662 | type: "BatchNorm" 1663 | batch_norm_param { 1664 | use_global_stats: true 1665 | } 1666 | } 1667 | 1668 | layer { 1669 | bottom: "res4e_branch2b" 1670 | top: "res4e_branch2b" 1671 | name: "scale4e_branch2b" 1672 | type: "Scale" 1673 | scale_param { 1674 | bias_term: true 1675 | } 1676 | } 1677 | 1678 | layer { 1679 | bottom: "res4e_branch2b" 1680 | top: "res4e_branch2b" 1681 | name: "res4e_branch2b_relu" 1682 | type: "ReLU" 1683 | } 1684 | 1685 | layer { 1686 | bottom: "res4e_branch2b" 1687 | top: "res4e_branch2c" 1688 | name: "res4e_branch2c" 1689 | type: "Convolution" 1690 | convolution_param { 1691 | num_output: 1024 1692 | kernel_size: 1 1693 | pad: 0 1694 | stride: 1 1695 | bias_term: false 1696 | } 1697 | } 1698 | 1699 | layer { 1700 | bottom: "res4e_branch2c" 1701 | top: "res4e_branch2c" 1702 | name: "bn4e_branch2c" 1703 | type: "BatchNorm" 1704 | batch_norm_param { 1705 | use_global_stats: true 1706 | } 1707 | } 1708 | 1709 | layer { 1710 | bottom: "res4e_branch2c" 1711 | top: "res4e_branch2c" 1712 | name: "scale4e_branch2c" 1713 | type: "Scale" 1714 | scale_param { 1715 | bias_term: true 1716 | } 1717 | } 1718 | 1719 | layer { 1720 | bottom: "res4d" 1721 | bottom: "res4e_branch2c" 1722 | top: "res4e" 1723 | name: "res4e" 1724 | type: "Eltwise" 1725 | } 1726 | 1727 | layer { 1728 | bottom: "res4e" 1729 | top: "res4e" 1730 | name: "res4e_relu" 1731 | type: "ReLU" 1732 | } 1733 | 1734 | layer { 1735 | bottom: "res4e" 1736 | top: "res4f_branch2a" 1737 | name: "res4f_branch2a" 1738 | type: "Convolution" 1739 | convolution_param { 1740 | num_output: 256 1741 | kernel_size: 1 1742 | pad: 0 1743 | stride: 1 1744 | bias_term: false 1745 | } 1746 | } 1747 | 1748 | layer { 1749 | bottom: "res4f_branch2a" 1750 | top: "res4f_branch2a" 1751 | name: "bn4f_branch2a" 1752 | type: "BatchNorm" 1753 | batch_norm_param { 1754 | use_global_stats: true 1755 | } 1756 | } 1757 | 1758 | layer { 1759 | bottom: "res4f_branch2a" 1760 | top: "res4f_branch2a" 1761 | name: "scale4f_branch2a" 1762 | type: "Scale" 1763 | scale_param { 1764 | bias_term: true 1765 | } 1766 | } 1767 | 1768 | layer { 1769 | bottom: "res4f_branch2a" 1770 | top: "res4f_branch2a" 1771 | name: "res4f_branch2a_relu" 1772 | type: "ReLU" 1773 | } 1774 | 1775 | layer { 1776 | bottom: "res4f_branch2a" 1777 | top: "res4f_branch2b" 1778 | name: "res4f_branch2b" 1779 | type: "Convolution" 1780 | convolution_param { 1781 | num_output: 256 1782 | kernel_size: 3 1783 | pad: 1 1784 | stride: 1 1785 | bias_term: false 1786 | } 1787 | } 1788 | 1789 | layer { 1790 | bottom: "res4f_branch2b" 1791 | top: "res4f_branch2b" 1792 | name: "bn4f_branch2b" 1793 | type: "BatchNorm" 1794 | batch_norm_param { 1795 | use_global_stats: true 1796 | } 1797 | } 1798 | 1799 | layer { 1800 | bottom: "res4f_branch2b" 1801 | top: "res4f_branch2b" 1802 | name: "scale4f_branch2b" 1803 | type: "Scale" 1804 | scale_param { 1805 | bias_term: true 1806 | } 1807 | } 1808 | 1809 | layer { 1810 | bottom: "res4f_branch2b" 1811 | top: "res4f_branch2b" 1812 | name: "res4f_branch2b_relu" 1813 | type: "ReLU" 1814 | } 1815 | 1816 | layer { 1817 | bottom: "res4f_branch2b" 1818 | top: "res4f_branch2c" 1819 | name: "res4f_branch2c" 1820 | type: "Convolution" 1821 | convolution_param { 1822 | num_output: 1024 1823 | kernel_size: 1 1824 | pad: 0 1825 | stride: 1 1826 | bias_term: false 1827 | } 1828 | } 1829 | 1830 | layer { 1831 | bottom: "res4f_branch2c" 1832 | top: "res4f_branch2c" 1833 | name: "bn4f_branch2c" 1834 | type: "BatchNorm" 1835 | batch_norm_param { 1836 | use_global_stats: true 1837 | } 1838 | } 1839 | 1840 | layer { 1841 | bottom: "res4f_branch2c" 1842 | top: "res4f_branch2c" 1843 | name: "scale4f_branch2c" 1844 | type: "Scale" 1845 | scale_param { 1846 | bias_term: true 1847 | } 1848 | } 1849 | 1850 | layer { 1851 | bottom: "res4e" 1852 | bottom: "res4f_branch2c" 1853 | top: "res4f" 1854 | name: "res4f" 1855 | type: "Eltwise" 1856 | } 1857 | 1858 | layer { 1859 | bottom: "res4f" 1860 | top: "res4f" 1861 | name: "res4f_relu" 1862 | type: "ReLU" 1863 | } 1864 | 1865 | layer { 1866 | bottom: "res4f" 1867 | top: "res5a_branch1" 1868 | name: "res5a_branch1" 1869 | type: "Convolution" 1870 | convolution_param { 1871 | num_output: 2048 1872 | kernel_size: 1 1873 | pad: 0 1874 | stride: 2 1875 | bias_term: false 1876 | } 1877 | } 1878 | 1879 | layer { 1880 | bottom: "res5a_branch1" 1881 | top: "res5a_branch1" 1882 | name: "bn5a_branch1" 1883 | type: "BatchNorm" 1884 | batch_norm_param { 1885 | use_global_stats: true 1886 | } 1887 | } 1888 | 1889 | layer { 1890 | bottom: "res5a_branch1" 1891 | top: "res5a_branch1" 1892 | name: "scale5a_branch1" 1893 | type: "Scale" 1894 | scale_param { 1895 | bias_term: true 1896 | } 1897 | } 1898 | 1899 | layer { 1900 | bottom: "res4f" 1901 | top: "res5a_branch2a" 1902 | name: "res5a_branch2a" 1903 | type: "Convolution" 1904 | convolution_param { 1905 | num_output: 512 1906 | kernel_size: 1 1907 | pad: 0 1908 | stride: 2 1909 | bias_term: false 1910 | } 1911 | } 1912 | 1913 | layer { 1914 | bottom: "res5a_branch2a" 1915 | top: "res5a_branch2a" 1916 | name: "bn5a_branch2a" 1917 | type: "BatchNorm" 1918 | batch_norm_param { 1919 | use_global_stats: true 1920 | } 1921 | } 1922 | 1923 | layer { 1924 | bottom: "res5a_branch2a" 1925 | top: "res5a_branch2a" 1926 | name: "scale5a_branch2a" 1927 | type: "Scale" 1928 | scale_param { 1929 | bias_term: true 1930 | } 1931 | } 1932 | 1933 | layer { 1934 | bottom: "res5a_branch2a" 1935 | top: "res5a_branch2a" 1936 | name: "res5a_branch2a_relu" 1937 | type: "ReLU" 1938 | } 1939 | 1940 | layer { 1941 | bottom: "res5a_branch2a" 1942 | top: "res5a_branch2b" 1943 | name: "res5a_branch2b" 1944 | type: "Convolution" 1945 | convolution_param { 1946 | num_output: 512 1947 | kernel_size: 3 1948 | pad: 1 1949 | stride: 1 1950 | bias_term: false 1951 | } 1952 | } 1953 | 1954 | layer { 1955 | bottom: "res5a_branch2b" 1956 | top: "res5a_branch2b" 1957 | name: "bn5a_branch2b" 1958 | type: "BatchNorm" 1959 | batch_norm_param { 1960 | use_global_stats: true 1961 | } 1962 | } 1963 | 1964 | layer { 1965 | bottom: "res5a_branch2b" 1966 | top: "res5a_branch2b" 1967 | name: "scale5a_branch2b" 1968 | type: "Scale" 1969 | scale_param { 1970 | bias_term: true 1971 | } 1972 | } 1973 | 1974 | layer { 1975 | bottom: "res5a_branch2b" 1976 | top: "res5a_branch2b" 1977 | name: "res5a_branch2b_relu" 1978 | type: "ReLU" 1979 | } 1980 | 1981 | layer { 1982 | bottom: "res5a_branch2b" 1983 | top: "res5a_branch2c" 1984 | name: "res5a_branch2c" 1985 | type: "Convolution" 1986 | convolution_param { 1987 | num_output: 2048 1988 | kernel_size: 1 1989 | pad: 0 1990 | stride: 1 1991 | bias_term: false 1992 | } 1993 | } 1994 | 1995 | layer { 1996 | bottom: "res5a_branch2c" 1997 | top: "res5a_branch2c" 1998 | name: "bn5a_branch2c" 1999 | type: "BatchNorm" 2000 | batch_norm_param { 2001 | use_global_stats: true 2002 | } 2003 | } 2004 | 2005 | layer { 2006 | bottom: "res5a_branch2c" 2007 | top: "res5a_branch2c" 2008 | name: "scale5a_branch2c" 2009 | type: "Scale" 2010 | scale_param { 2011 | bias_term: true 2012 | } 2013 | } 2014 | 2015 | layer { 2016 | bottom: "res5a_branch1" 2017 | bottom: "res5a_branch2c" 2018 | top: "res5a" 2019 | name: "res5a" 2020 | type: "Eltwise" 2021 | } 2022 | 2023 | layer { 2024 | bottom: "res5a" 2025 | top: "res5a" 2026 | name: "res5a_relu" 2027 | type: "ReLU" 2028 | } 2029 | 2030 | layer { 2031 | bottom: "res5a" 2032 | top: "res5b_branch2a" 2033 | name: "res5b_branch2a" 2034 | type: "Convolution" 2035 | convolution_param { 2036 | num_output: 512 2037 | kernel_size: 1 2038 | pad: 0 2039 | stride: 1 2040 | bias_term: false 2041 | } 2042 | } 2043 | 2044 | layer { 2045 | bottom: "res5b_branch2a" 2046 | top: "res5b_branch2a" 2047 | name: "bn5b_branch2a" 2048 | type: "BatchNorm" 2049 | batch_norm_param { 2050 | use_global_stats: true 2051 | } 2052 | } 2053 | 2054 | layer { 2055 | bottom: "res5b_branch2a" 2056 | top: "res5b_branch2a" 2057 | name: "scale5b_branch2a" 2058 | type: "Scale" 2059 | scale_param { 2060 | bias_term: true 2061 | } 2062 | } 2063 | 2064 | layer { 2065 | bottom: "res5b_branch2a" 2066 | top: "res5b_branch2a" 2067 | name: "res5b_branch2a_relu" 2068 | type: "ReLU" 2069 | } 2070 | 2071 | layer { 2072 | bottom: "res5b_branch2a" 2073 | top: "res5b_branch2b" 2074 | name: "res5b_branch2b" 2075 | type: "Convolution" 2076 | convolution_param { 2077 | num_output: 512 2078 | kernel_size: 3 2079 | pad: 1 2080 | stride: 1 2081 | bias_term: false 2082 | } 2083 | } 2084 | 2085 | layer { 2086 | bottom: "res5b_branch2b" 2087 | top: "res5b_branch2b" 2088 | name: "bn5b_branch2b" 2089 | type: "BatchNorm" 2090 | batch_norm_param { 2091 | use_global_stats: true 2092 | } 2093 | } 2094 | 2095 | layer { 2096 | bottom: "res5b_branch2b" 2097 | top: "res5b_branch2b" 2098 | name: "scale5b_branch2b" 2099 | type: "Scale" 2100 | scale_param { 2101 | bias_term: true 2102 | } 2103 | } 2104 | 2105 | layer { 2106 | bottom: "res5b_branch2b" 2107 | top: "res5b_branch2b" 2108 | name: "res5b_branch2b_relu" 2109 | type: "ReLU" 2110 | } 2111 | 2112 | layer { 2113 | bottom: "res5b_branch2b" 2114 | top: "res5b_branch2c" 2115 | name: "res5b_branch2c" 2116 | type: "Convolution" 2117 | convolution_param { 2118 | num_output: 2048 2119 | kernel_size: 1 2120 | pad: 0 2121 | stride: 1 2122 | bias_term: false 2123 | } 2124 | } 2125 | 2126 | layer { 2127 | bottom: "res5b_branch2c" 2128 | top: "res5b_branch2c" 2129 | name: "bn5b_branch2c" 2130 | type: "BatchNorm" 2131 | batch_norm_param { 2132 | use_global_stats: true 2133 | } 2134 | } 2135 | 2136 | layer { 2137 | bottom: "res5b_branch2c" 2138 | top: "res5b_branch2c" 2139 | name: "scale5b_branch2c" 2140 | type: "Scale" 2141 | scale_param { 2142 | bias_term: true 2143 | } 2144 | } 2145 | 2146 | layer { 2147 | bottom: "res5a" 2148 | bottom: "res5b_branch2c" 2149 | top: "res5b" 2150 | name: "res5b" 2151 | type: "Eltwise" 2152 | } 2153 | 2154 | layer { 2155 | bottom: "res5b" 2156 | top: "res5b" 2157 | name: "res5b_relu" 2158 | type: "ReLU" 2159 | } 2160 | 2161 | layer { 2162 | bottom: "res5b" 2163 | top: "res5c_branch2a" 2164 | name: "res5c_branch2a" 2165 | type: "Convolution" 2166 | convolution_param { 2167 | num_output: 512 2168 | kernel_size: 1 2169 | pad: 0 2170 | stride: 1 2171 | bias_term: false 2172 | } 2173 | } 2174 | 2175 | layer { 2176 | bottom: "res5c_branch2a" 2177 | top: "res5c_branch2a" 2178 | name: "bn5c_branch2a" 2179 | type: "BatchNorm" 2180 | batch_norm_param { 2181 | use_global_stats: true 2182 | } 2183 | } 2184 | 2185 | layer { 2186 | bottom: "res5c_branch2a" 2187 | top: "res5c_branch2a" 2188 | name: "scale5c_branch2a" 2189 | type: "Scale" 2190 | scale_param { 2191 | bias_term: true 2192 | } 2193 | } 2194 | 2195 | layer { 2196 | bottom: "res5c_branch2a" 2197 | top: "res5c_branch2a" 2198 | name: "res5c_branch2a_relu" 2199 | type: "ReLU" 2200 | } 2201 | 2202 | layer { 2203 | bottom: "res5c_branch2a" 2204 | top: "res5c_branch2b" 2205 | name: "res5c_branch2b" 2206 | type: "Convolution" 2207 | convolution_param { 2208 | num_output: 512 2209 | kernel_size: 3 2210 | pad: 1 2211 | stride: 1 2212 | bias_term: false 2213 | } 2214 | } 2215 | 2216 | layer { 2217 | bottom: "res5c_branch2b" 2218 | top: "res5c_branch2b" 2219 | name: "bn5c_branch2b" 2220 | type: "BatchNorm" 2221 | batch_norm_param { 2222 | use_global_stats: true 2223 | } 2224 | } 2225 | 2226 | layer { 2227 | bottom: "res5c_branch2b" 2228 | top: "res5c_branch2b" 2229 | name: "scale5c_branch2b" 2230 | type: "Scale" 2231 | scale_param { 2232 | bias_term: true 2233 | } 2234 | } 2235 | 2236 | layer { 2237 | bottom: "res5c_branch2b" 2238 | top: "res5c_branch2b" 2239 | name: "res5c_branch2b_relu" 2240 | type: "ReLU" 2241 | } 2242 | 2243 | layer { 2244 | bottom: "res5c_branch2b" 2245 | top: "res5c_branch2c" 2246 | name: "res5c_branch2c" 2247 | type: "Convolution" 2248 | convolution_param { 2249 | num_output: 2048 2250 | kernel_size: 1 2251 | pad: 0 2252 | stride: 1 2253 | bias_term: false 2254 | } 2255 | } 2256 | 2257 | layer { 2258 | bottom: "res5c_branch2c" 2259 | top: "res5c_branch2c" 2260 | name: "bn5c_branch2c" 2261 | type: "BatchNorm" 2262 | batch_norm_param { 2263 | use_global_stats: true 2264 | } 2265 | } 2266 | 2267 | layer { 2268 | bottom: "res5c_branch2c" 2269 | top: "res5c_branch2c" 2270 | name: "scale5c_branch2c" 2271 | type: "Scale" 2272 | scale_param { 2273 | bias_term: true 2274 | } 2275 | } 2276 | 2277 | layer { 2278 | bottom: "res5b" 2279 | bottom: "res5c_branch2c" 2280 | top: "res5c" 2281 | name: "res5c" 2282 | type: "Eltwise" 2283 | } 2284 | 2285 | layer { 2286 | bottom: "res5c" 2287 | top: "res5c" 2288 | name: "res5c_relu" 2289 | type: "ReLU" 2290 | } 2291 | 2292 | layer { 2293 | bottom: "res5c" 2294 | top: "pool5" 2295 | name: "pool5" 2296 | type: "Pooling" 2297 | pooling_param { 2298 | kernel_size: 7 2299 | stride: 1 2300 | pool: AVE 2301 | } 2302 | } 2303 | 2304 | layer { 2305 | bottom: "pool5" 2306 | top: "gtsrb_fc1000" 2307 | name: "gtsrb_fc1000" 2308 | type: "InnerProduct" 2309 | inner_product_param { 2310 | num_output: 43 2311 | } 2312 | } 2313 | 2314 | layer { 2315 | bottom: "gtsrb_fc1000" 2316 | top: "prob" 2317 | name: "prob" 2318 | type: "Softmax" 2319 | } 2320 | 2321 | -------------------------------------------------------------------------------- /pre_trained network/resnet50/resnet50_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "ResNet-50" 2 | layer { 3 | name: "data" 4 | type: "Data" 5 | top: "data" 6 | top: "label" 7 | include { 8 | phase: TRAIN 9 | } 10 | transform_param { 11 | mirror: true 12 | crop_size: 224 13 | mean_file: "/home/exx/Documents/dataset_all/featurefool2150_train_mean.binaryproto" 14 | } 15 | data_param { 16 | source: "/home/exx/Documents/dataset_all/featurefool_train2150_lmdb" 17 | batch_size: 16 18 | backend: LMDB 19 | prefetch: 2 20 | } 21 | } 22 | layer { 23 | name: "data" 24 | type: "Data" 25 | top: "data" 26 | top: "label" 27 | include { 28 | phase: TEST 29 | } 30 | transform_param { 31 | mirror: false 32 | crop_size: 224 33 | mean_file: "/home/exx/Documents/dataset_all/featurefool2150_validation_mean.binaryproto" 34 | } 35 | data_param { 36 | source: "/home/exx/Documents/dataset_all/featurefool_validation2150_lmdb" 37 | batch_size: 16 38 | backend: LMDB 39 | } 40 | } 41 | 42 | layer { 43 | bottom: "data" 44 | top: "conv1" 45 | name: "conv1" 46 | type: "Convolution" 47 | convolution_param { 48 | 49 | num_output: 64 50 | kernel_size: 7 51 | pad: 3 52 | stride: 2 53 | weight_filler { 54 | type: "xavier" 55 | } 56 | bias_filler { 57 | type: "constant" 58 | value: 0.2 59 | } 60 | } 61 | } 62 | 63 | layer { 64 | bottom: "conv1" 65 | top: "conv1" 66 | name: "bn_conv1" 67 | type: "BatchNorm" 68 | batch_norm_param { 69 | 70 | 71 | } 72 | } 73 | 74 | layer { 75 | bottom: "conv1" 76 | top: "conv1" 77 | name: "scale_conv1" 78 | type: "Scale" 79 | scale_param { 80 | bias_term: true 81 | } 82 | } 83 | 84 | layer { 85 | bottom: "conv1" 86 | top: "conv1" 87 | name: "conv1_relu" 88 | type: "ReLU" 89 | relu_param { 90 | 91 | } 92 | } 93 | 94 | layer { 95 | bottom: "conv1" 96 | top: "pool1" 97 | name: "pool1" 98 | type: "Pooling" 99 | pooling_param { 100 | 101 | kernel_size: 3 102 | stride: 2 103 | pool: MAX 104 | } 105 | } 106 | 107 | layer { 108 | bottom: "pool1" 109 | top: "res2a_branch1" 110 | name: "res2a_branch1" 111 | type: "Convolution" 112 | convolution_param { 113 | 114 | num_output: 256 115 | kernel_size: 1 116 | pad: 0 117 | stride: 1 118 | bias_term: false 119 | weight_filler { 120 | type: "xavier" 121 | } 122 | bias_filler { 123 | type: "constant" 124 | value: 0.2 125 | } 126 | } 127 | } 128 | 129 | layer { 130 | bottom: "res2a_branch1" 131 | top: "res2a_branch1" 132 | name: "bn2a_branch1" 133 | type: "BatchNorm" 134 | batch_norm_param { 135 | 136 | 137 | } 138 | } 139 | 140 | layer { 141 | bottom: "res2a_branch1" 142 | top: "res2a_branch1" 143 | name: "scale2a_branch1" 144 | type: "Scale" 145 | scale_param { 146 | bias_term: true 147 | } 148 | } 149 | 150 | layer { 151 | bottom: "pool1" 152 | top: "res2a_branch2a" 153 | name: "res2a_branch2a" 154 | type: "Convolution" 155 | convolution_param { 156 | 157 | num_output: 64 158 | kernel_size: 1 159 | pad: 0 160 | stride: 1 161 | bias_term: false 162 | weight_filler { 163 | type: "xavier" 164 | } 165 | bias_filler { 166 | type: "constant" 167 | value: 0.2 168 | } 169 | } 170 | } 171 | 172 | layer { 173 | bottom: "res2a_branch2a" 174 | top: "res2a_branch2a" 175 | name: "bn2a_branch2a" 176 | type: "BatchNorm" 177 | batch_norm_param { 178 | 179 | 180 | } 181 | } 182 | 183 | layer { 184 | bottom: "res2a_branch2a" 185 | top: "res2a_branch2a" 186 | name: "scale2a_branch2a" 187 | type: "Scale" 188 | scale_param { 189 | bias_term: true 190 | } 191 | } 192 | 193 | layer { 194 | bottom: "res2a_branch2a" 195 | top: "res2a_branch2a" 196 | name: "res2a_branch2a_relu" 197 | type: "ReLU" 198 | relu_param { 199 | 200 | } 201 | } 202 | 203 | layer { 204 | bottom: "res2a_branch2a" 205 | top: "res2a_branch2b" 206 | name: "res2a_branch2b" 207 | type: "Convolution" 208 | convolution_param { 209 | 210 | num_output: 64 211 | kernel_size: 3 212 | pad: 1 213 | stride: 1 214 | bias_term: false 215 | weight_filler { 216 | type: "xavier" 217 | } 218 | bias_filler { 219 | type: "constant" 220 | value: 0.2 221 | } 222 | } 223 | } 224 | 225 | layer { 226 | bottom: "res2a_branch2b" 227 | top: "res2a_branch2b" 228 | name: "bn2a_branch2b" 229 | type: "BatchNorm" 230 | batch_norm_param { 231 | 232 | 233 | } 234 | } 235 | 236 | layer { 237 | bottom: "res2a_branch2b" 238 | top: "res2a_branch2b" 239 | name: "scale2a_branch2b" 240 | type: "Scale" 241 | scale_param { 242 | bias_term: true 243 | } 244 | } 245 | 246 | layer { 247 | bottom: "res2a_branch2b" 248 | top: "res2a_branch2b" 249 | name: "res2a_branch2b_relu" 250 | type: "ReLU" 251 | relu_param { 252 | 253 | } 254 | } 255 | 256 | layer { 257 | bottom: "res2a_branch2b" 258 | top: "res2a_branch2c" 259 | name: "res2a_branch2c" 260 | type: "Convolution" 261 | convolution_param { 262 | 263 | num_output: 256 264 | kernel_size: 1 265 | pad: 0 266 | stride: 1 267 | bias_term: false 268 | weight_filler { 269 | type: "xavier" 270 | } 271 | bias_filler { 272 | type: "constant" 273 | value: 0.2 274 | } 275 | } 276 | } 277 | 278 | layer { 279 | bottom: "res2a_branch2c" 280 | top: "res2a_branch2c" 281 | name: "bn2a_branch2c" 282 | type: "BatchNorm" 283 | batch_norm_param { 284 | 285 | 286 | } 287 | } 288 | 289 | layer { 290 | bottom: "res2a_branch2c" 291 | top: "res2a_branch2c" 292 | name: "scale2a_branch2c" 293 | type: "Scale" 294 | scale_param { 295 | bias_term: true 296 | } 297 | } 298 | 299 | layer { 300 | bottom: "res2a_branch1" 301 | bottom: "res2a_branch2c" 302 | top: "res2a" 303 | name: "res2a" 304 | type: "Eltwise" 305 | eltwise_param { 306 | 307 | } 308 | } 309 | 310 | layer { 311 | bottom: "res2a" 312 | top: "res2a" 313 | name: "res2a_relu" 314 | type: "ReLU" 315 | relu_param { 316 | 317 | } 318 | } 319 | 320 | layer { 321 | bottom: "res2a" 322 | top: "res2b_branch2a" 323 | name: "res2b_branch2a" 324 | type: "Convolution" 325 | convolution_param { 326 | 327 | num_output: 64 328 | kernel_size: 1 329 | pad: 0 330 | stride: 1 331 | bias_term: false 332 | weight_filler { 333 | type: "xavier" 334 | } 335 | bias_filler { 336 | type: "constant" 337 | value: 0.2 338 | } 339 | } 340 | } 341 | 342 | layer { 343 | bottom: "res2b_branch2a" 344 | top: "res2b_branch2a" 345 | name: "bn2b_branch2a" 346 | type: "BatchNorm" 347 | batch_norm_param { 348 | 349 | 350 | } 351 | } 352 | 353 | layer { 354 | bottom: "res2b_branch2a" 355 | top: "res2b_branch2a" 356 | name: "scale2b_branch2a" 357 | type: "Scale" 358 | scale_param { 359 | bias_term: true 360 | } 361 | } 362 | 363 | layer { 364 | bottom: "res2b_branch2a" 365 | top: "res2b_branch2a" 366 | name: "res2b_branch2a_relu" 367 | type: "ReLU" 368 | relu_param { 369 | 370 | } 371 | } 372 | 373 | layer { 374 | bottom: "res2b_branch2a" 375 | top: "res2b_branch2b" 376 | name: "res2b_branch2b" 377 | type: "Convolution" 378 | convolution_param { 379 | 380 | num_output: 64 381 | kernel_size: 3 382 | pad: 1 383 | stride: 1 384 | bias_term: false 385 | weight_filler { 386 | type: "xavier" 387 | } 388 | bias_filler { 389 | type: "constant" 390 | value: 0.2 391 | } 392 | } 393 | } 394 | 395 | layer { 396 | bottom: "res2b_branch2b" 397 | top: "res2b_branch2b" 398 | name: "bn2b_branch2b" 399 | type: "BatchNorm" 400 | batch_norm_param { 401 | 402 | 403 | } 404 | } 405 | 406 | layer { 407 | bottom: "res2b_branch2b" 408 | top: "res2b_branch2b" 409 | name: "scale2b_branch2b" 410 | type: "Scale" 411 | scale_param { 412 | bias_term: true 413 | } 414 | } 415 | 416 | layer { 417 | bottom: "res2b_branch2b" 418 | top: "res2b_branch2b" 419 | name: "res2b_branch2b_relu" 420 | type: "ReLU" 421 | relu_param { 422 | 423 | } 424 | } 425 | 426 | layer { 427 | bottom: "res2b_branch2b" 428 | top: "res2b_branch2c" 429 | name: "res2b_branch2c" 430 | type: "Convolution" 431 | convolution_param { 432 | 433 | num_output: 256 434 | kernel_size: 1 435 | pad: 0 436 | stride: 1 437 | bias_term: false 438 | weight_filler { 439 | type: "xavier" 440 | } 441 | bias_filler { 442 | type: "constant" 443 | value: 0.2 444 | } 445 | } 446 | } 447 | 448 | layer { 449 | bottom: "res2b_branch2c" 450 | top: "res2b_branch2c" 451 | name: "bn2b_branch2c" 452 | type: "BatchNorm" 453 | batch_norm_param { 454 | 455 | 456 | } 457 | } 458 | 459 | layer { 460 | bottom: "res2b_branch2c" 461 | top: "res2b_branch2c" 462 | name: "scale2b_branch2c" 463 | type: "Scale" 464 | scale_param { 465 | bias_term: true 466 | } 467 | } 468 | 469 | layer { 470 | bottom: "res2a" 471 | bottom: "res2b_branch2c" 472 | top: "res2b" 473 | name: "res2b" 474 | type: "Eltwise" 475 | eltwise_param { 476 | 477 | } 478 | } 479 | 480 | layer { 481 | bottom: "res2b" 482 | top: "res2b" 483 | name: "res2b_relu" 484 | type: "ReLU" 485 | relu_param { 486 | 487 | } 488 | } 489 | 490 | layer { 491 | bottom: "res2b" 492 | top: "res2c_branch2a" 493 | name: "res2c_branch2a" 494 | type: "Convolution" 495 | convolution_param { 496 | 497 | num_output: 64 498 | kernel_size: 1 499 | pad: 0 500 | stride: 1 501 | bias_term: false 502 | weight_filler { 503 | type: "xavier" 504 | } 505 | bias_filler { 506 | type: "constant" 507 | value: 0.2 508 | } 509 | } 510 | } 511 | 512 | layer { 513 | bottom: "res2c_branch2a" 514 | top: "res2c_branch2a" 515 | name: "bn2c_branch2a" 516 | type: "BatchNorm" 517 | batch_norm_param { 518 | 519 | 520 | } 521 | } 522 | 523 | layer { 524 | bottom: "res2c_branch2a" 525 | top: "res2c_branch2a" 526 | name: "scale2c_branch2a" 527 | type: "Scale" 528 | scale_param { 529 | bias_term: true 530 | } 531 | } 532 | 533 | layer { 534 | bottom: "res2c_branch2a" 535 | top: "res2c_branch2a" 536 | name: "res2c_branch2a_relu" 537 | type: "ReLU" 538 | relu_param { 539 | 540 | } 541 | } 542 | 543 | layer { 544 | bottom: "res2c_branch2a" 545 | top: "res2c_branch2b" 546 | name: "res2c_branch2b" 547 | type: "Convolution" 548 | convolution_param { 549 | 550 | num_output: 64 551 | kernel_size: 3 552 | pad: 1 553 | stride: 1 554 | bias_term: false 555 | weight_filler { 556 | type: "xavier" 557 | } 558 | bias_filler { 559 | type: "constant" 560 | value: 0.2 561 | } 562 | } 563 | } 564 | 565 | layer { 566 | bottom: "res2c_branch2b" 567 | top: "res2c_branch2b" 568 | name: "bn2c_branch2b" 569 | type: "BatchNorm" 570 | batch_norm_param { 571 | 572 | 573 | } 574 | } 575 | 576 | layer { 577 | bottom: "res2c_branch2b" 578 | top: "res2c_branch2b" 579 | name: "scale2c_branch2b" 580 | type: "Scale" 581 | scale_param { 582 | bias_term: true 583 | } 584 | } 585 | 586 | layer { 587 | bottom: "res2c_branch2b" 588 | top: "res2c_branch2b" 589 | name: "res2c_branch2b_relu" 590 | type: "ReLU" 591 | relu_param { 592 | 593 | } 594 | } 595 | 596 | layer { 597 | bottom: "res2c_branch2b" 598 | top: "res2c_branch2c" 599 | name: "res2c_branch2c" 600 | type: "Convolution" 601 | convolution_param { 602 | 603 | num_output: 256 604 | kernel_size: 1 605 | pad: 0 606 | stride: 1 607 | bias_term: false 608 | weight_filler { 609 | type: "xavier" 610 | } 611 | bias_filler { 612 | type: "constant" 613 | value: 0.2 614 | } 615 | } 616 | } 617 | 618 | layer { 619 | bottom: "res2c_branch2c" 620 | top: "res2c_branch2c" 621 | name: "bn2c_branch2c" 622 | type: "BatchNorm" 623 | batch_norm_param { 624 | 625 | 626 | } 627 | } 628 | 629 | layer { 630 | bottom: "res2c_branch2c" 631 | top: "res2c_branch2c" 632 | name: "scale2c_branch2c" 633 | type: "Scale" 634 | scale_param { 635 | bias_term: true 636 | } 637 | } 638 | 639 | layer { 640 | bottom: "res2b" 641 | bottom: "res2c_branch2c" 642 | top: "res2c" 643 | name: "res2c" 644 | type: "Eltwise" 645 | eltwise_param { 646 | 647 | } 648 | } 649 | 650 | layer { 651 | bottom: "res2c" 652 | top: "res2c" 653 | name: "res2c_relu" 654 | type: "ReLU" 655 | relu_param { 656 | 657 | } 658 | } 659 | 660 | layer { 661 | bottom: "res2c" 662 | top: "res3a_branch1" 663 | name: "res3a_branch1" 664 | type: "Convolution" 665 | convolution_param { 666 | 667 | num_output: 512 668 | kernel_size: 1 669 | pad: 0 670 | stride: 2 671 | bias_term: false 672 | weight_filler { 673 | type: "xavier" 674 | } 675 | bias_filler { 676 | type: "constant" 677 | value: 0.2 678 | } 679 | } 680 | } 681 | 682 | layer { 683 | bottom: "res3a_branch1" 684 | top: "res3a_branch1" 685 | name: "bn3a_branch1" 686 | type: "BatchNorm" 687 | batch_norm_param { 688 | 689 | 690 | } 691 | } 692 | 693 | layer { 694 | bottom: "res3a_branch1" 695 | top: "res3a_branch1" 696 | name: "scale3a_branch1" 697 | type: "Scale" 698 | scale_param { 699 | bias_term: true 700 | } 701 | } 702 | 703 | layer { 704 | bottom: "res2c" 705 | top: "res3a_branch2a" 706 | name: "res3a_branch2a" 707 | type: "Convolution" 708 | convolution_param { 709 | 710 | num_output: 128 711 | kernel_size: 1 712 | pad: 0 713 | stride: 2 714 | bias_term: false 715 | weight_filler { 716 | type: "xavier" 717 | } 718 | bias_filler { 719 | type: "constant" 720 | value: 0.2 721 | } 722 | } 723 | } 724 | 725 | layer { 726 | bottom: "res3a_branch2a" 727 | top: "res3a_branch2a" 728 | name: "bn3a_branch2a" 729 | type: "BatchNorm" 730 | batch_norm_param { 731 | 732 | 733 | } 734 | } 735 | 736 | layer { 737 | bottom: "res3a_branch2a" 738 | top: "res3a_branch2a" 739 | name: "scale3a_branch2a" 740 | type: "Scale" 741 | scale_param { 742 | bias_term: true 743 | } 744 | } 745 | 746 | layer { 747 | bottom: "res3a_branch2a" 748 | top: "res3a_branch2a" 749 | name: "res3a_branch2a_relu" 750 | type: "ReLU" 751 | relu_param { 752 | 753 | } 754 | } 755 | 756 | layer { 757 | bottom: "res3a_branch2a" 758 | top: "res3a_branch2b" 759 | name: "res3a_branch2b" 760 | type: "Convolution" 761 | convolution_param { 762 | 763 | num_output: 128 764 | kernel_size: 3 765 | pad: 1 766 | stride: 1 767 | bias_term: false 768 | weight_filler { 769 | type: "xavier" 770 | } 771 | bias_filler { 772 | type: "constant" 773 | value: 0.2 774 | } 775 | } 776 | } 777 | 778 | layer { 779 | bottom: "res3a_branch2b" 780 | top: "res3a_branch2b" 781 | name: "bn3a_branch2b" 782 | type: "BatchNorm" 783 | batch_norm_param { 784 | 785 | 786 | } 787 | } 788 | 789 | layer { 790 | bottom: "res3a_branch2b" 791 | top: "res3a_branch2b" 792 | name: "scale3a_branch2b" 793 | type: "Scale" 794 | scale_param { 795 | bias_term: true 796 | } 797 | } 798 | 799 | layer { 800 | bottom: "res3a_branch2b" 801 | top: "res3a_branch2b" 802 | name: "res3a_branch2b_relu" 803 | type: "ReLU" 804 | relu_param { 805 | 806 | } 807 | } 808 | 809 | layer { 810 | bottom: "res3a_branch2b" 811 | top: "res3a_branch2c" 812 | name: "res3a_branch2c" 813 | type: "Convolution" 814 | convolution_param { 815 | 816 | num_output: 512 817 | kernel_size: 1 818 | pad: 0 819 | stride: 1 820 | bias_term: false 821 | weight_filler { 822 | type: "xavier" 823 | } 824 | bias_filler { 825 | type: "constant" 826 | value: 0.2 827 | } 828 | } 829 | } 830 | 831 | layer { 832 | bottom: "res3a_branch2c" 833 | top: "res3a_branch2c" 834 | name: "bn3a_branch2c" 835 | type: "BatchNorm" 836 | batch_norm_param { 837 | 838 | 839 | } 840 | } 841 | 842 | layer { 843 | bottom: "res3a_branch2c" 844 | top: "res3a_branch2c" 845 | name: "scale3a_branch2c" 846 | type: "Scale" 847 | scale_param { 848 | bias_term: true 849 | } 850 | } 851 | 852 | layer { 853 | bottom: "res3a_branch1" 854 | bottom: "res3a_branch2c" 855 | top: "res3a" 856 | name: "res3a" 857 | type: "Eltwise" 858 | eltwise_param { 859 | 860 | } 861 | } 862 | 863 | layer { 864 | bottom: "res3a" 865 | top: "res3a" 866 | name: "res3a_relu" 867 | type: "ReLU" 868 | relu_param { 869 | 870 | } 871 | } 872 | 873 | layer { 874 | bottom: "res3a" 875 | top: "res3b_branch2a" 876 | name: "res3b_branch2a" 877 | type: "Convolution" 878 | convolution_param { 879 | 880 | num_output: 128 881 | kernel_size: 1 882 | pad: 0 883 | stride: 1 884 | bias_term: false 885 | weight_filler { 886 | type: "xavier" 887 | } 888 | bias_filler { 889 | type: "constant" 890 | value: 0.2 891 | } 892 | } 893 | } 894 | 895 | layer { 896 | bottom: "res3b_branch2a" 897 | top: "res3b_branch2a" 898 | name: "bn3b_branch2a" 899 | type: "BatchNorm" 900 | batch_norm_param { 901 | 902 | 903 | } 904 | } 905 | 906 | layer { 907 | bottom: "res3b_branch2a" 908 | top: "res3b_branch2a" 909 | name: "scale3b_branch2a" 910 | type: "Scale" 911 | scale_param { 912 | bias_term: true 913 | } 914 | } 915 | 916 | layer { 917 | bottom: "res3b_branch2a" 918 | top: "res3b_branch2a" 919 | name: "res3b_branch2a_relu" 920 | type: "ReLU" 921 | relu_param { 922 | 923 | } 924 | } 925 | 926 | layer { 927 | bottom: "res3b_branch2a" 928 | top: "res3b_branch2b" 929 | name: "res3b_branch2b" 930 | type: "Convolution" 931 | convolution_param { 932 | 933 | num_output: 128 934 | kernel_size: 3 935 | pad: 1 936 | stride: 1 937 | bias_term: false 938 | weight_filler { 939 | type: "xavier" 940 | } 941 | bias_filler { 942 | type: "constant" 943 | value: 0.2 944 | } 945 | } 946 | } 947 | 948 | layer { 949 | bottom: "res3b_branch2b" 950 | top: "res3b_branch2b" 951 | name: "bn3b_branch2b" 952 | type: "BatchNorm" 953 | batch_norm_param { 954 | 955 | 956 | } 957 | } 958 | 959 | layer { 960 | bottom: "res3b_branch2b" 961 | top: "res3b_branch2b" 962 | name: "scale3b_branch2b" 963 | type: "Scale" 964 | scale_param { 965 | bias_term: true 966 | } 967 | } 968 | 969 | layer { 970 | bottom: "res3b_branch2b" 971 | top: "res3b_branch2b" 972 | name: "res3b_branch2b_relu" 973 | type: "ReLU" 974 | relu_param { 975 | 976 | } 977 | } 978 | 979 | layer { 980 | bottom: "res3b_branch2b" 981 | top: "res3b_branch2c" 982 | name: "res3b_branch2c" 983 | type: "Convolution" 984 | convolution_param { 985 | 986 | num_output: 512 987 | kernel_size: 1 988 | pad: 0 989 | stride: 1 990 | bias_term: false 991 | weight_filler { 992 | type: "xavier" 993 | } 994 | bias_filler { 995 | type: "constant" 996 | value: 0.2 997 | } 998 | } 999 | } 1000 | 1001 | layer { 1002 | bottom: "res3b_branch2c" 1003 | top: "res3b_branch2c" 1004 | name: "bn3b_branch2c" 1005 | type: "BatchNorm" 1006 | batch_norm_param { 1007 | 1008 | 1009 | } 1010 | } 1011 | 1012 | layer { 1013 | bottom: "res3b_branch2c" 1014 | top: "res3b_branch2c" 1015 | name: "scale3b_branch2c" 1016 | type: "Scale" 1017 | scale_param { 1018 | bias_term: true 1019 | } 1020 | } 1021 | 1022 | layer { 1023 | bottom: "res3a" 1024 | bottom: "res3b_branch2c" 1025 | top: "res3b" 1026 | name: "res3b" 1027 | type: "Eltwise" 1028 | eltwise_param { 1029 | 1030 | } 1031 | } 1032 | 1033 | layer { 1034 | bottom: "res3b" 1035 | top: "res3b" 1036 | name: "res3b_relu" 1037 | type: "ReLU" 1038 | relu_param { 1039 | 1040 | } 1041 | } 1042 | 1043 | layer { 1044 | bottom: "res3b" 1045 | top: "res3c_branch2a" 1046 | name: "res3c_branch2a" 1047 | type: "Convolution" 1048 | convolution_param { 1049 | 1050 | num_output: 128 1051 | kernel_size: 1 1052 | pad: 0 1053 | stride: 1 1054 | bias_term: false 1055 | weight_filler { 1056 | type: "xavier" 1057 | } 1058 | bias_filler { 1059 | type: "constant" 1060 | value: 0.2 1061 | } 1062 | } 1063 | } 1064 | 1065 | layer { 1066 | bottom: "res3c_branch2a" 1067 | top: "res3c_branch2a" 1068 | name: "bn3c_branch2a" 1069 | type: "BatchNorm" 1070 | batch_norm_param { 1071 | 1072 | 1073 | } 1074 | } 1075 | 1076 | layer { 1077 | bottom: "res3c_branch2a" 1078 | top: "res3c_branch2a" 1079 | name: "scale3c_branch2a" 1080 | type: "Scale" 1081 | scale_param { 1082 | bias_term: true 1083 | } 1084 | } 1085 | 1086 | layer { 1087 | bottom: "res3c_branch2a" 1088 | top: "res3c_branch2a" 1089 | name: "res3c_branch2a_relu" 1090 | type: "ReLU" 1091 | relu_param { 1092 | 1093 | } 1094 | } 1095 | 1096 | layer { 1097 | bottom: "res3c_branch2a" 1098 | top: "res3c_branch2b" 1099 | name: "res3c_branch2b" 1100 | type: "Convolution" 1101 | convolution_param { 1102 | 1103 | num_output: 128 1104 | kernel_size: 3 1105 | pad: 1 1106 | stride: 1 1107 | bias_term: false 1108 | weight_filler { 1109 | type: "xavier" 1110 | } 1111 | bias_filler { 1112 | type: "constant" 1113 | value: 0.2 1114 | } 1115 | } 1116 | } 1117 | 1118 | layer { 1119 | bottom: "res3c_branch2b" 1120 | top: "res3c_branch2b" 1121 | name: "bn3c_branch2b" 1122 | type: "BatchNorm" 1123 | batch_norm_param { 1124 | 1125 | 1126 | } 1127 | } 1128 | 1129 | layer { 1130 | bottom: "res3c_branch2b" 1131 | top: "res3c_branch2b" 1132 | name: "scale3c_branch2b" 1133 | type: "Scale" 1134 | scale_param { 1135 | bias_term: true 1136 | } 1137 | } 1138 | 1139 | layer { 1140 | bottom: "res3c_branch2b" 1141 | top: "res3c_branch2b" 1142 | name: "res3c_branch2b_relu" 1143 | type: "ReLU" 1144 | relu_param { 1145 | 1146 | } 1147 | } 1148 | 1149 | layer { 1150 | bottom: "res3c_branch2b" 1151 | top: "res3c_branch2c" 1152 | name: "res3c_branch2c" 1153 | type: "Convolution" 1154 | convolution_param { 1155 | 1156 | num_output: 512 1157 | kernel_size: 1 1158 | pad: 0 1159 | stride: 1 1160 | bias_term: false 1161 | weight_filler { 1162 | type: "xavier" 1163 | } 1164 | bias_filler { 1165 | type: "constant" 1166 | value: 0.2 1167 | } 1168 | } 1169 | } 1170 | 1171 | layer { 1172 | bottom: "res3c_branch2c" 1173 | top: "res3c_branch2c" 1174 | name: "bn3c_branch2c" 1175 | type: "BatchNorm" 1176 | batch_norm_param { 1177 | 1178 | 1179 | } 1180 | } 1181 | 1182 | layer { 1183 | bottom: "res3c_branch2c" 1184 | top: "res3c_branch2c" 1185 | name: "scale3c_branch2c" 1186 | type: "Scale" 1187 | scale_param { 1188 | bias_term: true 1189 | } 1190 | } 1191 | 1192 | layer { 1193 | bottom: "res3b" 1194 | bottom: "res3c_branch2c" 1195 | top: "res3c" 1196 | name: "res3c" 1197 | type: "Eltwise" 1198 | eltwise_param { 1199 | 1200 | } 1201 | } 1202 | 1203 | layer { 1204 | bottom: "res3c" 1205 | top: "res3c" 1206 | name: "res3c_relu" 1207 | type: "ReLU" 1208 | relu_param { 1209 | 1210 | } 1211 | } 1212 | 1213 | layer { 1214 | bottom: "res3c" 1215 | top: "res3d_branch2a" 1216 | name: "res3d_branch2a" 1217 | type: "Convolution" 1218 | convolution_param { 1219 | 1220 | num_output: 128 1221 | kernel_size: 1 1222 | pad: 0 1223 | stride: 1 1224 | bias_term: false 1225 | weight_filler { 1226 | type: "xavier" 1227 | } 1228 | bias_filler { 1229 | type: "constant" 1230 | value: 0.2 1231 | } 1232 | } 1233 | } 1234 | 1235 | layer { 1236 | bottom: "res3d_branch2a" 1237 | top: "res3d_branch2a" 1238 | name: "bn3d_branch2a" 1239 | type: "BatchNorm" 1240 | batch_norm_param { 1241 | 1242 | 1243 | } 1244 | } 1245 | 1246 | layer { 1247 | bottom: "res3d_branch2a" 1248 | top: "res3d_branch2a" 1249 | name: "scale3d_branch2a" 1250 | type: "Scale" 1251 | scale_param { 1252 | bias_term: true 1253 | } 1254 | } 1255 | 1256 | layer { 1257 | bottom: "res3d_branch2a" 1258 | top: "res3d_branch2a" 1259 | name: "res3d_branch2a_relu" 1260 | type: "ReLU" 1261 | relu_param { 1262 | 1263 | } 1264 | } 1265 | 1266 | layer { 1267 | bottom: "res3d_branch2a" 1268 | top: "res3d_branch2b" 1269 | name: "res3d_branch2b" 1270 | type: "Convolution" 1271 | convolution_param { 1272 | 1273 | num_output: 128 1274 | kernel_size: 3 1275 | pad: 1 1276 | stride: 1 1277 | bias_term: false 1278 | weight_filler { 1279 | type: "xavier" 1280 | } 1281 | bias_filler { 1282 | type: "constant" 1283 | value: 0.2 1284 | } 1285 | } 1286 | } 1287 | 1288 | layer { 1289 | bottom: "res3d_branch2b" 1290 | top: "res3d_branch2b" 1291 | name: "bn3d_branch2b" 1292 | type: "BatchNorm" 1293 | batch_norm_param { 1294 | 1295 | 1296 | } 1297 | } 1298 | 1299 | layer { 1300 | bottom: "res3d_branch2b" 1301 | top: "res3d_branch2b" 1302 | name: "scale3d_branch2b" 1303 | type: "Scale" 1304 | scale_param { 1305 | bias_term: true 1306 | } 1307 | } 1308 | 1309 | layer { 1310 | bottom: "res3d_branch2b" 1311 | top: "res3d_branch2b" 1312 | name: "res3d_branch2b_relu" 1313 | type: "ReLU" 1314 | relu_param { 1315 | 1316 | } 1317 | } 1318 | 1319 | layer { 1320 | bottom: "res3d_branch2b" 1321 | top: "res3d_branch2c" 1322 | name: "res3d_branch2c" 1323 | type: "Convolution" 1324 | convolution_param { 1325 | 1326 | num_output: 512 1327 | kernel_size: 1 1328 | pad: 0 1329 | stride: 1 1330 | bias_term: false 1331 | weight_filler { 1332 | type: "xavier" 1333 | } 1334 | bias_filler { 1335 | type: "constant" 1336 | value: 0.2 1337 | } 1338 | } 1339 | } 1340 | 1341 | layer { 1342 | bottom: "res3d_branch2c" 1343 | top: "res3d_branch2c" 1344 | name: "bn3d_branch2c" 1345 | type: "BatchNorm" 1346 | batch_norm_param { 1347 | 1348 | 1349 | } 1350 | } 1351 | 1352 | layer { 1353 | bottom: "res3d_branch2c" 1354 | top: "res3d_branch2c" 1355 | name: "scale3d_branch2c" 1356 | type: "Scale" 1357 | scale_param { 1358 | bias_term: true 1359 | } 1360 | } 1361 | 1362 | layer { 1363 | bottom: "res3c" 1364 | bottom: "res3d_branch2c" 1365 | top: "res3d" 1366 | name: "res3d" 1367 | type: "Eltwise" 1368 | eltwise_param { 1369 | 1370 | } 1371 | } 1372 | 1373 | layer { 1374 | bottom: "res3d" 1375 | top: "res3d" 1376 | name: "res3d_relu" 1377 | type: "ReLU" 1378 | relu_param { 1379 | 1380 | } 1381 | } 1382 | 1383 | layer { 1384 | bottom: "res3d" 1385 | top: "res4a_branch1" 1386 | name: "res4a_branch1" 1387 | type: "Convolution" 1388 | convolution_param { 1389 | 1390 | num_output: 1024 1391 | kernel_size: 1 1392 | pad: 0 1393 | stride: 2 1394 | bias_term: false 1395 | weight_filler { 1396 | type: "xavier" 1397 | } 1398 | bias_filler { 1399 | type: "constant" 1400 | value: 0.2 1401 | } 1402 | } 1403 | } 1404 | 1405 | layer { 1406 | bottom: "res4a_branch1" 1407 | top: "res4a_branch1" 1408 | name: "bn4a_branch1" 1409 | type: "BatchNorm" 1410 | batch_norm_param { 1411 | 1412 | 1413 | } 1414 | } 1415 | 1416 | layer { 1417 | bottom: "res4a_branch1" 1418 | top: "res4a_branch1" 1419 | name: "scale4a_branch1" 1420 | type: "Scale" 1421 | scale_param { 1422 | bias_term: true 1423 | } 1424 | } 1425 | 1426 | layer { 1427 | bottom: "res3d" 1428 | top: "res4a_branch2a" 1429 | name: "res4a_branch2a" 1430 | type: "Convolution" 1431 | convolution_param { 1432 | 1433 | num_output: 256 1434 | kernel_size: 1 1435 | pad: 0 1436 | stride: 2 1437 | bias_term: false 1438 | weight_filler { 1439 | type: "xavier" 1440 | } 1441 | bias_filler { 1442 | type: "constant" 1443 | value: 0.2 1444 | } 1445 | } 1446 | } 1447 | 1448 | layer { 1449 | bottom: "res4a_branch2a" 1450 | top: "res4a_branch2a" 1451 | name: "bn4a_branch2a" 1452 | type: "BatchNorm" 1453 | batch_norm_param { 1454 | 1455 | 1456 | } 1457 | } 1458 | 1459 | layer { 1460 | bottom: "res4a_branch2a" 1461 | top: "res4a_branch2a" 1462 | name: "scale4a_branch2a" 1463 | type: "Scale" 1464 | scale_param { 1465 | bias_term: true 1466 | } 1467 | } 1468 | 1469 | layer { 1470 | bottom: "res4a_branch2a" 1471 | top: "res4a_branch2a" 1472 | name: "res4a_branch2a_relu" 1473 | type: "ReLU" 1474 | relu_param { 1475 | 1476 | } 1477 | } 1478 | 1479 | layer { 1480 | bottom: "res4a_branch2a" 1481 | top: "res4a_branch2b" 1482 | name: "res4a_branch2b" 1483 | type: "Convolution" 1484 | convolution_param { 1485 | 1486 | num_output: 256 1487 | kernel_size: 3 1488 | pad: 1 1489 | stride: 1 1490 | bias_term: false 1491 | weight_filler { 1492 | type: "xavier" 1493 | } 1494 | bias_filler { 1495 | type: "constant" 1496 | value: 0.2 1497 | } 1498 | } 1499 | } 1500 | 1501 | layer { 1502 | bottom: "res4a_branch2b" 1503 | top: "res4a_branch2b" 1504 | name: "bn4a_branch2b" 1505 | type: "BatchNorm" 1506 | batch_norm_param { 1507 | 1508 | 1509 | } 1510 | } 1511 | 1512 | layer { 1513 | bottom: "res4a_branch2b" 1514 | top: "res4a_branch2b" 1515 | name: "scale4a_branch2b" 1516 | type: "Scale" 1517 | scale_param { 1518 | bias_term: true 1519 | } 1520 | } 1521 | 1522 | layer { 1523 | bottom: "res4a_branch2b" 1524 | top: "res4a_branch2b" 1525 | name: "res4a_branch2b_relu" 1526 | type: "ReLU" 1527 | relu_param { 1528 | 1529 | } 1530 | } 1531 | 1532 | layer { 1533 | bottom: "res4a_branch2b" 1534 | top: "res4a_branch2c" 1535 | name: "res4a_branch2c" 1536 | type: "Convolution" 1537 | convolution_param { 1538 | 1539 | num_output: 1024 1540 | kernel_size: 1 1541 | pad: 0 1542 | stride: 1 1543 | bias_term: false 1544 | weight_filler { 1545 | type: "xavier" 1546 | } 1547 | bias_filler { 1548 | type: "constant" 1549 | value: 0.2 1550 | } 1551 | } 1552 | } 1553 | 1554 | layer { 1555 | bottom: "res4a_branch2c" 1556 | top: "res4a_branch2c" 1557 | name: "bn4a_branch2c" 1558 | type: "BatchNorm" 1559 | batch_norm_param { 1560 | 1561 | 1562 | } 1563 | } 1564 | 1565 | layer { 1566 | bottom: "res4a_branch2c" 1567 | top: "res4a_branch2c" 1568 | name: "scale4a_branch2c" 1569 | type: "Scale" 1570 | scale_param { 1571 | bias_term: true 1572 | } 1573 | } 1574 | 1575 | layer { 1576 | bottom: "res4a_branch1" 1577 | bottom: "res4a_branch2c" 1578 | top: "res4a" 1579 | name: "res4a" 1580 | type: "Eltwise" 1581 | eltwise_param { 1582 | 1583 | } 1584 | } 1585 | 1586 | layer { 1587 | bottom: "res4a" 1588 | top: "res4a" 1589 | name: "res4a_relu" 1590 | type: "ReLU" 1591 | relu_param { 1592 | 1593 | } 1594 | } 1595 | 1596 | layer { 1597 | bottom: "res4a" 1598 | top: "res4b_branch2a" 1599 | name: "res4b_branch2a" 1600 | type: "Convolution" 1601 | convolution_param { 1602 | 1603 | num_output: 256 1604 | kernel_size: 1 1605 | pad: 0 1606 | stride: 1 1607 | bias_term: false 1608 | weight_filler { 1609 | type: "xavier" 1610 | } 1611 | bias_filler { 1612 | type: "constant" 1613 | value: 0.2 1614 | } 1615 | } 1616 | } 1617 | 1618 | layer { 1619 | bottom: "res4b_branch2a" 1620 | top: "res4b_branch2a" 1621 | name: "bn4b_branch2a" 1622 | type: "BatchNorm" 1623 | batch_norm_param { 1624 | 1625 | 1626 | } 1627 | } 1628 | 1629 | layer { 1630 | bottom: "res4b_branch2a" 1631 | top: "res4b_branch2a" 1632 | name: "scale4b_branch2a" 1633 | type: "Scale" 1634 | scale_param { 1635 | bias_term: true 1636 | } 1637 | } 1638 | 1639 | layer { 1640 | bottom: "res4b_branch2a" 1641 | top: "res4b_branch2a" 1642 | name: "res4b_branch2a_relu" 1643 | type: "ReLU" 1644 | relu_param { 1645 | 1646 | } 1647 | } 1648 | 1649 | layer { 1650 | bottom: "res4b_branch2a" 1651 | top: "res4b_branch2b" 1652 | name: "res4b_branch2b" 1653 | type: "Convolution" 1654 | convolution_param { 1655 | 1656 | num_output: 256 1657 | kernel_size: 3 1658 | pad: 1 1659 | stride: 1 1660 | bias_term: false 1661 | weight_filler { 1662 | type: "xavier" 1663 | } 1664 | bias_filler { 1665 | type: "constant" 1666 | value: 0.2 1667 | } 1668 | } 1669 | } 1670 | 1671 | layer { 1672 | bottom: "res4b_branch2b" 1673 | top: "res4b_branch2b" 1674 | name: "bn4b_branch2b" 1675 | type: "BatchNorm" 1676 | batch_norm_param { 1677 | 1678 | 1679 | } 1680 | } 1681 | 1682 | layer { 1683 | bottom: "res4b_branch2b" 1684 | top: "res4b_branch2b" 1685 | name: "scale4b_branch2b" 1686 | type: "Scale" 1687 | scale_param { 1688 | bias_term: true 1689 | } 1690 | } 1691 | 1692 | layer { 1693 | bottom: "res4b_branch2b" 1694 | top: "res4b_branch2b" 1695 | name: "res4b_branch2b_relu" 1696 | type: "ReLU" 1697 | relu_param { 1698 | 1699 | } 1700 | } 1701 | 1702 | layer { 1703 | bottom: "res4b_branch2b" 1704 | top: "res4b_branch2c" 1705 | name: "res4b_branch2c" 1706 | type: "Convolution" 1707 | convolution_param { 1708 | 1709 | num_output: 1024 1710 | kernel_size: 1 1711 | pad: 0 1712 | stride: 1 1713 | bias_term: false 1714 | weight_filler { 1715 | type: "xavier" 1716 | } 1717 | bias_filler { 1718 | type: "constant" 1719 | value: 0.2 1720 | } 1721 | } 1722 | } 1723 | 1724 | layer { 1725 | bottom: "res4b_branch2c" 1726 | top: "res4b_branch2c" 1727 | name: "bn4b_branch2c" 1728 | type: "BatchNorm" 1729 | batch_norm_param { 1730 | 1731 | 1732 | } 1733 | } 1734 | 1735 | layer { 1736 | bottom: "res4b_branch2c" 1737 | top: "res4b_branch2c" 1738 | name: "scale4b_branch2c" 1739 | type: "Scale" 1740 | scale_param { 1741 | bias_term: true 1742 | } 1743 | } 1744 | 1745 | layer { 1746 | bottom: "res4a" 1747 | bottom: "res4b_branch2c" 1748 | top: "res4b" 1749 | name: "res4b" 1750 | type: "Eltwise" 1751 | eltwise_param { 1752 | 1753 | } 1754 | } 1755 | 1756 | layer { 1757 | bottom: "res4b" 1758 | top: "res4b" 1759 | name: "res4b_relu" 1760 | type: "ReLU" 1761 | relu_param { 1762 | 1763 | } 1764 | } 1765 | 1766 | layer { 1767 | bottom: "res4b" 1768 | top: "res4c_branch2a" 1769 | name: "res4c_branch2a" 1770 | type: "Convolution" 1771 | convolution_param { 1772 | 1773 | num_output: 256 1774 | kernel_size: 1 1775 | pad: 0 1776 | stride: 1 1777 | bias_term: false 1778 | weight_filler { 1779 | type: "xavier" 1780 | } 1781 | bias_filler { 1782 | type: "constant" 1783 | value: 0.2 1784 | } 1785 | } 1786 | } 1787 | 1788 | layer { 1789 | bottom: "res4c_branch2a" 1790 | top: "res4c_branch2a" 1791 | name: "bn4c_branch2a" 1792 | type: "BatchNorm" 1793 | batch_norm_param { 1794 | 1795 | 1796 | } 1797 | } 1798 | 1799 | layer { 1800 | bottom: "res4c_branch2a" 1801 | top: "res4c_branch2a" 1802 | name: "scale4c_branch2a" 1803 | type: "Scale" 1804 | scale_param { 1805 | bias_term: true 1806 | } 1807 | } 1808 | 1809 | layer { 1810 | bottom: "res4c_branch2a" 1811 | top: "res4c_branch2a" 1812 | name: "res4c_branch2a_relu" 1813 | type: "ReLU" 1814 | relu_param { 1815 | 1816 | } 1817 | } 1818 | 1819 | layer { 1820 | bottom: "res4c_branch2a" 1821 | top: "res4c_branch2b" 1822 | name: "res4c_branch2b" 1823 | type: "Convolution" 1824 | convolution_param { 1825 | 1826 | num_output: 256 1827 | kernel_size: 3 1828 | pad: 1 1829 | stride: 1 1830 | bias_term: false 1831 | weight_filler { 1832 | type: "xavier" 1833 | } 1834 | bias_filler { 1835 | type: "constant" 1836 | value: 0.2 1837 | } 1838 | } 1839 | } 1840 | 1841 | layer { 1842 | bottom: "res4c_branch2b" 1843 | top: "res4c_branch2b" 1844 | name: "bn4c_branch2b" 1845 | type: "BatchNorm" 1846 | batch_norm_param { 1847 | 1848 | 1849 | } 1850 | } 1851 | 1852 | layer { 1853 | bottom: "res4c_branch2b" 1854 | top: "res4c_branch2b" 1855 | name: "scale4c_branch2b" 1856 | type: "Scale" 1857 | scale_param { 1858 | bias_term: true 1859 | } 1860 | } 1861 | 1862 | layer { 1863 | bottom: "res4c_branch2b" 1864 | top: "res4c_branch2b" 1865 | name: "res4c_branch2b_relu" 1866 | type: "ReLU" 1867 | relu_param { 1868 | 1869 | } 1870 | } 1871 | 1872 | layer { 1873 | bottom: "res4c_branch2b" 1874 | top: "res4c_branch2c" 1875 | name: "res4c_branch2c" 1876 | type: "Convolution" 1877 | convolution_param { 1878 | 1879 | num_output: 1024 1880 | kernel_size: 1 1881 | pad: 0 1882 | stride: 1 1883 | bias_term: false 1884 | weight_filler { 1885 | type: "xavier" 1886 | } 1887 | bias_filler { 1888 | type: "constant" 1889 | value: 0.2 1890 | } 1891 | } 1892 | } 1893 | 1894 | layer { 1895 | bottom: "res4c_branch2c" 1896 | top: "res4c_branch2c" 1897 | name: "bn4c_branch2c" 1898 | type: "BatchNorm" 1899 | batch_norm_param { 1900 | 1901 | 1902 | } 1903 | } 1904 | 1905 | layer { 1906 | bottom: "res4c_branch2c" 1907 | top: "res4c_branch2c" 1908 | name: "scale4c_branch2c" 1909 | type: "Scale" 1910 | scale_param { 1911 | bias_term: true 1912 | } 1913 | } 1914 | 1915 | layer { 1916 | bottom: "res4b" 1917 | bottom: "res4c_branch2c" 1918 | top: "res4c" 1919 | name: "res4c" 1920 | type: "Eltwise" 1921 | eltwise_param { 1922 | 1923 | } 1924 | } 1925 | 1926 | layer { 1927 | bottom: "res4c" 1928 | top: "res4c" 1929 | name: "res4c_relu" 1930 | type: "ReLU" 1931 | relu_param { 1932 | 1933 | } 1934 | } 1935 | 1936 | layer { 1937 | bottom: "res4c" 1938 | top: "res4d_branch2a" 1939 | name: "res4d_branch2a" 1940 | type: "Convolution" 1941 | convolution_param { 1942 | 1943 | num_output: 256 1944 | kernel_size: 1 1945 | pad: 0 1946 | stride: 1 1947 | bias_term: false 1948 | weight_filler { 1949 | type: "xavier" 1950 | } 1951 | bias_filler { 1952 | type: "constant" 1953 | value: 0.2 1954 | } 1955 | } 1956 | } 1957 | 1958 | layer { 1959 | bottom: "res4d_branch2a" 1960 | top: "res4d_branch2a" 1961 | name: "bn4d_branch2a" 1962 | type: "BatchNorm" 1963 | batch_norm_param { 1964 | 1965 | 1966 | } 1967 | } 1968 | 1969 | layer { 1970 | bottom: "res4d_branch2a" 1971 | top: "res4d_branch2a" 1972 | name: "scale4d_branch2a" 1973 | type: "Scale" 1974 | scale_param { 1975 | bias_term: true 1976 | } 1977 | } 1978 | 1979 | layer { 1980 | bottom: "res4d_branch2a" 1981 | top: "res4d_branch2a" 1982 | name: "res4d_branch2a_relu" 1983 | type: "ReLU" 1984 | relu_param { 1985 | 1986 | } 1987 | } 1988 | 1989 | layer { 1990 | bottom: "res4d_branch2a" 1991 | top: "res4d_branch2b" 1992 | name: "res4d_branch2b" 1993 | type: "Convolution" 1994 | convolution_param { 1995 | 1996 | num_output: 256 1997 | kernel_size: 3 1998 | pad: 1 1999 | stride: 1 2000 | bias_term: false 2001 | weight_filler { 2002 | type: "xavier" 2003 | } 2004 | bias_filler { 2005 | type: "constant" 2006 | value: 0.2 2007 | } 2008 | } 2009 | } 2010 | 2011 | layer { 2012 | bottom: "res4d_branch2b" 2013 | top: "res4d_branch2b" 2014 | name: "bn4d_branch2b" 2015 | type: "BatchNorm" 2016 | batch_norm_param { 2017 | 2018 | 2019 | } 2020 | } 2021 | 2022 | layer { 2023 | bottom: "res4d_branch2b" 2024 | top: "res4d_branch2b" 2025 | name: "scale4d_branch2b" 2026 | type: "Scale" 2027 | scale_param { 2028 | bias_term: true 2029 | } 2030 | } 2031 | 2032 | layer { 2033 | bottom: "res4d_branch2b" 2034 | top: "res4d_branch2b" 2035 | name: "res4d_branch2b_relu" 2036 | type: "ReLU" 2037 | relu_param { 2038 | 2039 | } 2040 | } 2041 | 2042 | layer { 2043 | bottom: "res4d_branch2b" 2044 | top: "res4d_branch2c" 2045 | name: "res4d_branch2c" 2046 | type: "Convolution" 2047 | convolution_param { 2048 | 2049 | num_output: 1024 2050 | kernel_size: 1 2051 | pad: 0 2052 | stride: 1 2053 | bias_term: false 2054 | weight_filler { 2055 | type: "xavier" 2056 | } 2057 | bias_filler { 2058 | type: "constant" 2059 | value: 0.2 2060 | } 2061 | } 2062 | } 2063 | 2064 | layer { 2065 | bottom: "res4d_branch2c" 2066 | top: "res4d_branch2c" 2067 | name: "bn4d_branch2c" 2068 | type: "BatchNorm" 2069 | batch_norm_param { 2070 | 2071 | 2072 | } 2073 | } 2074 | 2075 | layer { 2076 | bottom: "res4d_branch2c" 2077 | top: "res4d_branch2c" 2078 | name: "scale4d_branch2c" 2079 | type: "Scale" 2080 | scale_param { 2081 | bias_term: true 2082 | } 2083 | } 2084 | 2085 | layer { 2086 | bottom: "res4c" 2087 | bottom: "res4d_branch2c" 2088 | top: "res4d" 2089 | name: "res4d" 2090 | type: "Eltwise" 2091 | eltwise_param { 2092 | 2093 | } 2094 | } 2095 | 2096 | layer { 2097 | bottom: "res4d" 2098 | top: "res4d" 2099 | name: "res4d_relu" 2100 | type: "ReLU" 2101 | relu_param { 2102 | 2103 | } 2104 | } 2105 | 2106 | layer { 2107 | bottom: "res4d" 2108 | top: "res4e_branch2a" 2109 | name: "res4e_branch2a" 2110 | type: "Convolution" 2111 | convolution_param { 2112 | 2113 | num_output: 256 2114 | kernel_size: 1 2115 | pad: 0 2116 | stride: 1 2117 | bias_term: false 2118 | weight_filler { 2119 | type: "xavier" 2120 | } 2121 | bias_filler { 2122 | type: "constant" 2123 | value: 0.2 2124 | } 2125 | } 2126 | } 2127 | 2128 | layer { 2129 | bottom: "res4e_branch2a" 2130 | top: "res4e_branch2a" 2131 | name: "bn4e_branch2a" 2132 | type: "BatchNorm" 2133 | batch_norm_param { 2134 | 2135 | 2136 | } 2137 | } 2138 | 2139 | layer { 2140 | bottom: "res4e_branch2a" 2141 | top: "res4e_branch2a" 2142 | name: "scale4e_branch2a" 2143 | type: "Scale" 2144 | scale_param { 2145 | bias_term: true 2146 | } 2147 | } 2148 | 2149 | layer { 2150 | bottom: "res4e_branch2a" 2151 | top: "res4e_branch2a" 2152 | name: "res4e_branch2a_relu" 2153 | type: "ReLU" 2154 | relu_param { 2155 | 2156 | } 2157 | } 2158 | 2159 | layer { 2160 | bottom: "res4e_branch2a" 2161 | top: "res4e_branch2b" 2162 | name: "res4e_branch2b" 2163 | type: "Convolution" 2164 | convolution_param { 2165 | 2166 | num_output: 256 2167 | kernel_size: 3 2168 | pad: 1 2169 | stride: 1 2170 | bias_term: false 2171 | weight_filler { 2172 | type: "xavier" 2173 | } 2174 | bias_filler { 2175 | type: "constant" 2176 | value: 0.2 2177 | } 2178 | } 2179 | } 2180 | 2181 | layer { 2182 | bottom: "res4e_branch2b" 2183 | top: "res4e_branch2b" 2184 | name: "bn4e_branch2b" 2185 | type: "BatchNorm" 2186 | batch_norm_param { 2187 | 2188 | 2189 | } 2190 | } 2191 | 2192 | layer { 2193 | bottom: "res4e_branch2b" 2194 | top: "res4e_branch2b" 2195 | name: "scale4e_branch2b" 2196 | type: "Scale" 2197 | scale_param { 2198 | bias_term: true 2199 | } 2200 | } 2201 | 2202 | layer { 2203 | bottom: "res4e_branch2b" 2204 | top: "res4e_branch2b" 2205 | name: "res4e_branch2b_relu" 2206 | type: "ReLU" 2207 | relu_param { 2208 | 2209 | } 2210 | } 2211 | 2212 | layer { 2213 | bottom: "res4e_branch2b" 2214 | top: "res4e_branch2c" 2215 | name: "res4e_branch2c" 2216 | type: "Convolution" 2217 | convolution_param { 2218 | 2219 | num_output: 1024 2220 | kernel_size: 1 2221 | pad: 0 2222 | stride: 1 2223 | bias_term: false 2224 | weight_filler { 2225 | type: "xavier" 2226 | } 2227 | bias_filler { 2228 | type: "constant" 2229 | value: 0.2 2230 | } 2231 | } 2232 | } 2233 | 2234 | layer { 2235 | bottom: "res4e_branch2c" 2236 | top: "res4e_branch2c" 2237 | name: "bn4e_branch2c" 2238 | type: "BatchNorm" 2239 | batch_norm_param { 2240 | 2241 | 2242 | } 2243 | } 2244 | 2245 | layer { 2246 | bottom: "res4e_branch2c" 2247 | top: "res4e_branch2c" 2248 | name: "scale4e_branch2c" 2249 | type: "Scale" 2250 | scale_param { 2251 | bias_term: true 2252 | } 2253 | } 2254 | 2255 | layer { 2256 | bottom: "res4d" 2257 | bottom: "res4e_branch2c" 2258 | top: "res4e" 2259 | name: "res4e" 2260 | type: "Eltwise" 2261 | eltwise_param { 2262 | 2263 | } 2264 | } 2265 | 2266 | layer { 2267 | bottom: "res4e" 2268 | top: "res4e" 2269 | name: "res4e_relu" 2270 | type: "ReLU" 2271 | relu_param { 2272 | 2273 | } 2274 | } 2275 | 2276 | layer { 2277 | bottom: "res4e" 2278 | top: "res4f_branch2a" 2279 | name: "res4f_branch2a" 2280 | type: "Convolution" 2281 | convolution_param { 2282 | 2283 | num_output: 256 2284 | kernel_size: 1 2285 | pad: 0 2286 | stride: 1 2287 | bias_term: false 2288 | weight_filler { 2289 | type: "xavier" 2290 | } 2291 | bias_filler { 2292 | type: "constant" 2293 | value: 0.2 2294 | } 2295 | } 2296 | } 2297 | 2298 | layer { 2299 | bottom: "res4f_branch2a" 2300 | top: "res4f_branch2a" 2301 | name: "bn4f_branch2a" 2302 | type: "BatchNorm" 2303 | batch_norm_param { 2304 | 2305 | 2306 | } 2307 | } 2308 | 2309 | layer { 2310 | bottom: "res4f_branch2a" 2311 | top: "res4f_branch2a" 2312 | name: "scale4f_branch2a" 2313 | type: "Scale" 2314 | scale_param { 2315 | bias_term: true 2316 | } 2317 | } 2318 | 2319 | layer { 2320 | bottom: "res4f_branch2a" 2321 | top: "res4f_branch2a" 2322 | name: "res4f_branch2a_relu" 2323 | type: "ReLU" 2324 | relu_param { 2325 | 2326 | } 2327 | } 2328 | 2329 | layer { 2330 | bottom: "res4f_branch2a" 2331 | top: "res4f_branch2b" 2332 | name: "res4f_branch2b" 2333 | type: "Convolution" 2334 | convolution_param { 2335 | 2336 | num_output: 256 2337 | kernel_size: 3 2338 | pad: 1 2339 | stride: 1 2340 | bias_term: false 2341 | weight_filler { 2342 | type: "xavier" 2343 | } 2344 | bias_filler { 2345 | type: "constant" 2346 | value: 0.2 2347 | } 2348 | } 2349 | } 2350 | 2351 | layer { 2352 | bottom: "res4f_branch2b" 2353 | top: "res4f_branch2b" 2354 | name: "bn4f_branch2b" 2355 | type: "BatchNorm" 2356 | batch_norm_param { 2357 | 2358 | 2359 | } 2360 | } 2361 | 2362 | layer { 2363 | bottom: "res4f_branch2b" 2364 | top: "res4f_branch2b" 2365 | name: "scale4f_branch2b" 2366 | type: "Scale" 2367 | scale_param { 2368 | bias_term: true 2369 | } 2370 | } 2371 | 2372 | layer { 2373 | bottom: "res4f_branch2b" 2374 | top: "res4f_branch2b" 2375 | name: "res4f_branch2b_relu" 2376 | type: "ReLU" 2377 | relu_param { 2378 | 2379 | } 2380 | } 2381 | 2382 | layer { 2383 | bottom: "res4f_branch2b" 2384 | top: "res4f_branch2c" 2385 | name: "res4f_branch2c" 2386 | type: "Convolution" 2387 | convolution_param { 2388 | 2389 | num_output: 1024 2390 | kernel_size: 1 2391 | pad: 0 2392 | stride: 1 2393 | bias_term: false 2394 | weight_filler { 2395 | type: "xavier" 2396 | } 2397 | bias_filler { 2398 | type: "constant" 2399 | value: 0.2 2400 | } 2401 | } 2402 | } 2403 | 2404 | layer { 2405 | bottom: "res4f_branch2c" 2406 | top: "res4f_branch2c" 2407 | name: "bn4f_branch2c" 2408 | type: "BatchNorm" 2409 | batch_norm_param { 2410 | 2411 | 2412 | } 2413 | } 2414 | 2415 | layer { 2416 | bottom: "res4f_branch2c" 2417 | top: "res4f_branch2c" 2418 | name: "scale4f_branch2c" 2419 | type: "Scale" 2420 | scale_param { 2421 | bias_term: true 2422 | } 2423 | } 2424 | 2425 | layer { 2426 | bottom: "res4e" 2427 | bottom: "res4f_branch2c" 2428 | top: "res4f" 2429 | name: "res4f" 2430 | type: "Eltwise" 2431 | eltwise_param { 2432 | 2433 | } 2434 | } 2435 | 2436 | layer { 2437 | bottom: "res4f" 2438 | top: "res4f" 2439 | name: "res4f_relu" 2440 | type: "ReLU" 2441 | relu_param { 2442 | 2443 | } 2444 | } 2445 | 2446 | layer { 2447 | bottom: "res4f" 2448 | top: "res5a_branch1" 2449 | name: "res5a_branch1" 2450 | type: "Convolution" 2451 | convolution_param { 2452 | 2453 | num_output: 2048 2454 | kernel_size: 1 2455 | pad: 0 2456 | stride: 2 2457 | bias_term: false 2458 | weight_filler { 2459 | type: "xavier" 2460 | } 2461 | bias_filler { 2462 | type: "constant" 2463 | value: 0.2 2464 | } 2465 | } 2466 | } 2467 | 2468 | layer { 2469 | bottom: "res5a_branch1" 2470 | top: "res5a_branch1" 2471 | name: "bn5a_branch1" 2472 | type: "BatchNorm" 2473 | batch_norm_param { 2474 | 2475 | 2476 | } 2477 | } 2478 | 2479 | layer { 2480 | bottom: "res5a_branch1" 2481 | top: "res5a_branch1" 2482 | name: "scale5a_branch1" 2483 | type: "Scale" 2484 | scale_param { 2485 | bias_term: true 2486 | } 2487 | } 2488 | 2489 | layer { 2490 | bottom: "res4f" 2491 | top: "res5a_branch2a" 2492 | name: "res5a_branch2a" 2493 | type: "Convolution" 2494 | convolution_param { 2495 | 2496 | num_output: 512 2497 | kernel_size: 1 2498 | pad: 0 2499 | stride: 2 2500 | bias_term: false 2501 | weight_filler { 2502 | type: "xavier" 2503 | } 2504 | bias_filler { 2505 | type: "constant" 2506 | value: 0.2 2507 | } 2508 | } 2509 | } 2510 | 2511 | layer { 2512 | bottom: "res5a_branch2a" 2513 | top: "res5a_branch2a" 2514 | name: "bn5a_branch2a" 2515 | type: "BatchNorm" 2516 | batch_norm_param { 2517 | 2518 | 2519 | } 2520 | } 2521 | 2522 | layer { 2523 | bottom: "res5a_branch2a" 2524 | top: "res5a_branch2a" 2525 | name: "scale5a_branch2a" 2526 | type: "Scale" 2527 | scale_param { 2528 | bias_term: true 2529 | } 2530 | } 2531 | 2532 | layer { 2533 | bottom: "res5a_branch2a" 2534 | top: "res5a_branch2a" 2535 | name: "res5a_branch2a_relu" 2536 | type: "ReLU" 2537 | relu_param { 2538 | 2539 | } 2540 | } 2541 | 2542 | layer { 2543 | bottom: "res5a_branch2a" 2544 | top: "res5a_branch2b" 2545 | name: "res5a_branch2b" 2546 | type: "Convolution" 2547 | convolution_param { 2548 | 2549 | num_output: 512 2550 | kernel_size: 3 2551 | pad: 1 2552 | stride: 1 2553 | bias_term: false 2554 | weight_filler { 2555 | type: "xavier" 2556 | } 2557 | bias_filler { 2558 | type: "constant" 2559 | value: 0.2 2560 | } 2561 | } 2562 | } 2563 | 2564 | layer { 2565 | bottom: "res5a_branch2b" 2566 | top: "res5a_branch2b" 2567 | name: "bn5a_branch2b" 2568 | type: "BatchNorm" 2569 | batch_norm_param { 2570 | 2571 | 2572 | } 2573 | } 2574 | 2575 | layer { 2576 | bottom: "res5a_branch2b" 2577 | top: "res5a_branch2b" 2578 | name: "scale5a_branch2b" 2579 | type: "Scale" 2580 | scale_param { 2581 | bias_term: true 2582 | } 2583 | } 2584 | 2585 | layer { 2586 | bottom: "res5a_branch2b" 2587 | top: "res5a_branch2b" 2588 | name: "res5a_branch2b_relu" 2589 | type: "ReLU" 2590 | relu_param { 2591 | 2592 | } 2593 | } 2594 | 2595 | layer { 2596 | bottom: "res5a_branch2b" 2597 | top: "res5a_branch2c" 2598 | name: "res5a_branch2c" 2599 | type: "Convolution" 2600 | convolution_param { 2601 | 2602 | num_output: 2048 2603 | kernel_size: 1 2604 | pad: 0 2605 | stride: 1 2606 | bias_term: false 2607 | weight_filler { 2608 | type: "xavier" 2609 | } 2610 | bias_filler { 2611 | type: "constant" 2612 | value: 0.2 2613 | } 2614 | } 2615 | } 2616 | 2617 | layer { 2618 | bottom: "res5a_branch2c" 2619 | top: "res5a_branch2c" 2620 | name: "bn5a_branch2c" 2621 | type: "BatchNorm" 2622 | batch_norm_param { 2623 | 2624 | 2625 | } 2626 | } 2627 | 2628 | layer { 2629 | bottom: "res5a_branch2c" 2630 | top: "res5a_branch2c" 2631 | name: "scale5a_branch2c" 2632 | type: "Scale" 2633 | scale_param { 2634 | bias_term: true 2635 | } 2636 | } 2637 | 2638 | layer { 2639 | bottom: "res5a_branch1" 2640 | bottom: "res5a_branch2c" 2641 | top: "res5a" 2642 | name: "res5a" 2643 | type: "Eltwise" 2644 | eltwise_param { 2645 | 2646 | } 2647 | } 2648 | 2649 | layer { 2650 | bottom: "res5a" 2651 | top: "res5a" 2652 | name: "res5a_relu" 2653 | type: "ReLU" 2654 | relu_param { 2655 | 2656 | } 2657 | } 2658 | 2659 | layer { 2660 | bottom: "res5a" 2661 | top: "res5b_branch2a" 2662 | name: "res5b_branch2a" 2663 | type: "Convolution" 2664 | convolution_param { 2665 | 2666 | num_output: 512 2667 | kernel_size: 1 2668 | pad: 0 2669 | stride: 1 2670 | bias_term: false 2671 | weight_filler { 2672 | type: "xavier" 2673 | } 2674 | bias_filler { 2675 | type: "constant" 2676 | value: 0.2 2677 | } 2678 | } 2679 | } 2680 | 2681 | layer { 2682 | bottom: "res5b_branch2a" 2683 | top: "res5b_branch2a" 2684 | name: "bn5b_branch2a" 2685 | type: "BatchNorm" 2686 | batch_norm_param { 2687 | 2688 | 2689 | } 2690 | } 2691 | 2692 | layer { 2693 | bottom: "res5b_branch2a" 2694 | top: "res5b_branch2a" 2695 | name: "scale5b_branch2a" 2696 | type: "Scale" 2697 | scale_param { 2698 | bias_term: true 2699 | } 2700 | } 2701 | 2702 | layer { 2703 | bottom: "res5b_branch2a" 2704 | top: "res5b_branch2a" 2705 | name: "res5b_branch2a_relu" 2706 | type: "ReLU" 2707 | relu_param { 2708 | 2709 | } 2710 | } 2711 | 2712 | layer { 2713 | bottom: "res5b_branch2a" 2714 | top: "res5b_branch2b" 2715 | name: "res5b_branch2b" 2716 | type: "Convolution" 2717 | convolution_param { 2718 | 2719 | num_output: 512 2720 | kernel_size: 3 2721 | pad: 1 2722 | stride: 1 2723 | bias_term: false 2724 | weight_filler { 2725 | type: "xavier" 2726 | } 2727 | bias_filler { 2728 | type: "constant" 2729 | value: 0.2 2730 | } 2731 | } 2732 | } 2733 | 2734 | layer { 2735 | bottom: "res5b_branch2b" 2736 | top: "res5b_branch2b" 2737 | name: "bn5b_branch2b" 2738 | type: "BatchNorm" 2739 | batch_norm_param { 2740 | 2741 | 2742 | } 2743 | } 2744 | 2745 | layer { 2746 | bottom: "res5b_branch2b" 2747 | top: "res5b_branch2b" 2748 | name: "scale5b_branch2b" 2749 | type: "Scale" 2750 | scale_param { 2751 | bias_term: true 2752 | } 2753 | } 2754 | 2755 | layer { 2756 | bottom: "res5b_branch2b" 2757 | top: "res5b_branch2b" 2758 | name: "res5b_branch2b_relu" 2759 | type: "ReLU" 2760 | relu_param { 2761 | 2762 | } 2763 | } 2764 | 2765 | layer { 2766 | bottom: "res5b_branch2b" 2767 | top: "res5b_branch2c" 2768 | name: "res5b_branch2c" 2769 | type: "Convolution" 2770 | convolution_param { 2771 | 2772 | num_output: 2048 2773 | kernel_size: 1 2774 | pad: 0 2775 | stride: 1 2776 | bias_term: false 2777 | weight_filler { 2778 | type: "xavier" 2779 | } 2780 | bias_filler { 2781 | type: "constant" 2782 | value: 0.2 2783 | } 2784 | } 2785 | } 2786 | 2787 | layer { 2788 | bottom: "res5b_branch2c" 2789 | top: "res5b_branch2c" 2790 | name: "bn5b_branch2c" 2791 | type: "BatchNorm" 2792 | batch_norm_param { 2793 | 2794 | 2795 | } 2796 | } 2797 | 2798 | layer { 2799 | bottom: "res5b_branch2c" 2800 | top: "res5b_branch2c" 2801 | name: "scale5b_branch2c" 2802 | type: "Scale" 2803 | scale_param { 2804 | bias_term: true 2805 | } 2806 | } 2807 | 2808 | layer { 2809 | bottom: "res5a" 2810 | bottom: "res5b_branch2c" 2811 | top: "res5b" 2812 | name: "res5b" 2813 | type: "Eltwise" 2814 | eltwise_param { 2815 | 2816 | } 2817 | } 2818 | 2819 | layer { 2820 | bottom: "res5b" 2821 | top: "res5b" 2822 | name: "res5b_relu" 2823 | type: "ReLU" 2824 | relu_param { 2825 | 2826 | } 2827 | } 2828 | 2829 | layer { 2830 | bottom: "res5b" 2831 | top: "res5c_branch2a" 2832 | name: "res5c_branch2a" 2833 | type: "Convolution" 2834 | convolution_param { 2835 | 2836 | num_output: 512 2837 | kernel_size: 1 2838 | pad: 0 2839 | stride: 1 2840 | bias_term: false 2841 | weight_filler { 2842 | type: "xavier" 2843 | } 2844 | bias_filler { 2845 | type: "constant" 2846 | value: 0.2 2847 | } 2848 | } 2849 | } 2850 | 2851 | layer { 2852 | bottom: "res5c_branch2a" 2853 | top: "res5c_branch2a" 2854 | name: "bn5c_branch2a" 2855 | type: "BatchNorm" 2856 | batch_norm_param { 2857 | 2858 | 2859 | } 2860 | } 2861 | 2862 | layer { 2863 | bottom: "res5c_branch2a" 2864 | top: "res5c_branch2a" 2865 | name: "scale5c_branch2a" 2866 | type: "Scale" 2867 | scale_param { 2868 | bias_term: true 2869 | } 2870 | } 2871 | 2872 | layer { 2873 | bottom: "res5c_branch2a" 2874 | top: "res5c_branch2a" 2875 | name: "res5c_branch2a_relu" 2876 | type: "ReLU" 2877 | relu_param { 2878 | 2879 | } 2880 | } 2881 | 2882 | layer { 2883 | bottom: "res5c_branch2a" 2884 | top: "res5c_branch2b" 2885 | name: "res5c_branch2b" 2886 | type: "Convolution" 2887 | convolution_param { 2888 | 2889 | num_output: 512 2890 | kernel_size: 3 2891 | pad: 1 2892 | stride: 1 2893 | bias_term: false 2894 | weight_filler { 2895 | type: "xavier" 2896 | } 2897 | bias_filler { 2898 | type: "constant" 2899 | value: 0.2 2900 | } 2901 | } 2902 | } 2903 | 2904 | layer { 2905 | bottom: "res5c_branch2b" 2906 | top: "res5c_branch2b" 2907 | name: "bn5c_branch2b" 2908 | type: "BatchNorm" 2909 | batch_norm_param { 2910 | 2911 | 2912 | } 2913 | } 2914 | 2915 | layer { 2916 | bottom: "res5c_branch2b" 2917 | top: "res5c_branch2b" 2918 | name: "scale5c_branch2b" 2919 | type: "Scale" 2920 | scale_param { 2921 | bias_term: true 2922 | } 2923 | } 2924 | 2925 | layer { 2926 | bottom: "res5c_branch2b" 2927 | top: "res5c_branch2b" 2928 | name: "res5c_branch2b_relu" 2929 | type: "ReLU" 2930 | relu_param { 2931 | 2932 | } 2933 | } 2934 | 2935 | layer { 2936 | bottom: "res5c_branch2b" 2937 | top: "res5c_branch2c" 2938 | name: "res5c_branch2c" 2939 | type: "Convolution" 2940 | convolution_param { 2941 | 2942 | num_output: 2048 2943 | kernel_size: 1 2944 | pad: 0 2945 | stride: 1 2946 | bias_term: false 2947 | weight_filler { 2948 | type: "xavier" 2949 | } 2950 | bias_filler { 2951 | type: "constant" 2952 | value: 0.2 2953 | } 2954 | } 2955 | } 2956 | 2957 | layer { 2958 | bottom: "res5c_branch2c" 2959 | top: "res5c_branch2c" 2960 | name: "bn5c_branch2c" 2961 | type: "BatchNorm" 2962 | batch_norm_param { 2963 | 2964 | 2965 | } 2966 | } 2967 | 2968 | layer { 2969 | bottom: "res5c_branch2c" 2970 | top: "res5c_branch2c" 2971 | name: "scale5c_branch2c" 2972 | type: "Scale" 2973 | scale_param { 2974 | bias_term: true 2975 | } 2976 | } 2977 | 2978 | layer { 2979 | bottom: "res5b" 2980 | bottom: "res5c_branch2c" 2981 | top: "res5c" 2982 | name: "res5c" 2983 | type: "Eltwise" 2984 | eltwise_param { 2985 | 2986 | } 2987 | } 2988 | 2989 | layer { 2990 | bottom: "res5c" 2991 | top: "res5c" 2992 | name: "res5c_relu" 2993 | type: "ReLU" 2994 | relu_param { 2995 | 2996 | } 2997 | } 2998 | 2999 | layer { 3000 | bottom: "res5c" 3001 | top: "pool5" 3002 | name: "pool5" 3003 | type: "Pooling" 3004 | pooling_param { 3005 | 3006 | kernel_size: 7 3007 | stride: 1 3008 | pool: AVE 3009 | } 3010 | } 3011 | 3012 | layer { 3013 | bottom: "pool5" 3014 | top: "gtsrb_fc1000" 3015 | name: "gtsrb_fc1000" 3016 | type: "InnerProduct" 3017 | inner_product_param { 3018 | num_output: 43 3019 | weight_filler { 3020 | type: "xavier" 3021 | } 3022 | bias_filler { 3023 | type: "constant" 3024 | value: 0 3025 | } 3026 | } 3027 | } 3028 | 3029 | layer { 3030 | bottom: "gtsrb_fc1000" 3031 | bottom: "label" 3032 | top: "prob" 3033 | name: "prob" 3034 | type: "SoftmaxWithLoss" 3035 | include { 3036 | phase: TRAIN 3037 | } 3038 | } 3039 | #layer { 3040 | # name: "probt" 3041 | # type: "Softmax" 3042 | # bottom: "gtsrb_fc1000" 3043 | # top: "probt" 3044 | # include { 3045 | # phase: TEST 3046 | # } 3047 | #} 3048 | layer { 3049 | name: "accuracy/top-1" 3050 | type: "Accuracy" 3051 | bottom: "gtsrb_fc1000" 3052 | bottom: "label" 3053 | top: "accuracy/top-1" 3054 | accuracy_param 3055 | { 3056 | top_k: 1 3057 | } 3058 | include { 3059 | phase: TEST 3060 | } 3061 | } 3062 | layer { 3063 | name: "accuracy/top-5" 3064 | type: "Accuracy" 3065 | bottom: "gtsrb_fc1000" 3066 | bottom: "label" 3067 | top: "accuracy/top-5" 3068 | accuracy_param 3069 | { 3070 | top_k: 5 3071 | } 3072 | include { 3073 | phase: TEST 3074 | } 3075 | } --------------------------------------------------------------------------------