diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..f9752756cfa6ac347395688b399f2d14fc6fe964 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +*.npy filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..710f9e2b3dde10d190ea93497f589af89714d420 --- /dev/null +++ b/app.py @@ -0,0 +1,53 @@ +import sys +sys.path.append('.') +sys.path.append('./face_recognition') +import os +import io +import cv2 +import base64 +import json +import gradio as gr +import requests +import numpy as np +from io import BytesIO +import configparser +import numpy as np +from PIL import Image + +from face_recognition.match import match_1_1 + +def face_recognition_on_file(file1, file2): + img1 = cv2.imread(file1) + img2 = cv2.imread(file2) + + response = match_1_1(img1, img2) + + return response + + +with gr.Blocks() as demo: + gr.Markdown( + """ + # FacePlugin Online Demo + + """ + ) + + with gr.TabItem("Face Recognition"): + with gr.Row(): + with gr.Column(): + first_input = gr.Image(type='filepath') + gr.Examples(['images/rec_5.jpg', 'images/rec_1.jpg', 'images/9.png', 'images/rec_3.jpg'], + inputs=first_input) + start_button = gr.Button("Run") + with gr.Column(): + second_input = gr.Image(type='filepath') + gr.Examples(['images/rec_6.jpg', 'images/rec_2.jpg', 'images/10.jpg', 'images/rec_4.jpg'], + inputs=second_input) + + with gr.Column(): + app_output = [gr.JSON()] + + start_button.click(face_recognition_on_file, inputs=[first_input, second_input], outputs=app_output) + +demo.queue().launch(share=True) diff --git a/face_recognition/__pycache__/extract.cpython-310.pyc b/face_recognition/__pycache__/extract.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8356b35567c50dc8f07c2676debb8a59c45ee29 Binary files /dev/null and b/face_recognition/__pycache__/extract.cpython-310.pyc differ diff --git a/face_recognition/__pycache__/match.cpython-310.pyc b/face_recognition/__pycache__/match.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7637f29f73659f844c74cfe113971afb5abfb382 Binary files /dev/null and b/face_recognition/__pycache__/match.cpython-310.pyc differ diff --git a/face_recognition/app.py b/face_recognition/app.py new file mode 100644 index 0000000000000000000000000000000000000000..76abfccc4074206f18c93a9ace7540e9f28c942e --- /dev/null +++ b/face_recognition/app.py @@ -0,0 +1,94 @@ +import os +import cv2 +import numpy as np +import base64 +import face_manage.manage as db_manage +from flask import Flask, render_template, request, jsonify +from extract import GetImageInfo + +app = Flask(__name__) + +UPLOAD_FOLDER = os.path.basename('uploads') +app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER + + +@app.route("/") +def start_page(): + print("Start") + response = jsonify({"status": "Start"}) + response.status_code = 200 + response.headers["Content-Type"] = "application/json; charset=utf-8" + return response + + +@app.route("/enroll") +def enroll(): + file = request.files['image'] + image = cv2.imdecode(np.fromstring(file.read(), np.uint8), cv2.IMREAD_UNCHANGED) + + db_manage.open_database(0) + count, boxes, scores, landmarks, alignimgs, features = GetImageInfo(image, 5) + + for idx in range(0, count): + db_manage.register_face('sample name', idx, boxes[idx], landmarks[idx], alignimgs[idx], features[idx]) + + # db_manage.clear_database() + + response = jsonify({"status": "True"}) + response.status_code = 200 + response.headers["Content-Type"] = "application/json; charset=utf-8" + return response + + +@app.route("/delete/all") +def delete_all(): + db_manage.open_database(0) + db_manage.clear_database() + + response = jsonify({"status": "True"}) + response.status_code = 200 + response.headers["Content-Type"] = "application/json; charset=utf-8" + return response + + +@app.route("/match11") +def match_1_1(): + file1 = request.files['image1'] + file2 = request.files['image2'] + + image1 = cv2.imdecode(np.fromstring(file1.read(), np.uint8), cv2.IMREAD_UNCHANGED) + image2 = cv2.imdecode(np.fromstring(file2.read(), np.uint8), cv2.IMREAD_UNCHANGED) + + count1, boxes1, scores1, landmarks1, alignimgs1, features1 = GetImageInfo(image1, 1) + count2, boxes2, scores2, landmarks2, alignimgs2, features2 = GetImageInfo(image2, 1) + + if count1 != 0 and count2 != 0: + sim = db_manage.get_similarity(features1[0], features2[0]) + if sim > db_manage.threshold: + result = True + else: + result = False + + response = jsonify({"status": result}) + response.status_code = 200 + response.headers["Content-Type"] = "application/json; charset=utf-8" + return response + + +@app.route("/match1n") +def match_1_n(): + file = request.files['image'] + image = cv2.imdecode(np.fromstring(file.read(), np.uint8), cv2.IMREAD_UNCHANGED) + + result, filename, sub_index = False, None, -1 + count, boxes, scores, landmarks, alignimgs, features = GetImageInfo(image, 1) + + for idx in range(count): + id, fn, sub_id = db_manage.verify_face(features[idx]) + if id != -1: + result, filename, sub_index = True, fn, id + + response = jsonify({"status": result, "filename": filename, "subIndex": sub_index}) + response.status_code = 200 + response.headers["Content-Type"] = "application/json; charset=utf-8" + return response diff --git a/face_recognition/extract.py b/face_recognition/extract.py new file mode 100644 index 0000000000000000000000000000000000000000..2e99d93b0c0c0262dc88da50d8c35f3741b51762 --- /dev/null +++ b/face_recognition/extract.py @@ -0,0 +1,88 @@ + +import argparse +import cv2 +import torch +import numpy as np +import ctypes +import os.path +import time + +from face_detect.detect_imgs import get_face_boundingbox +from face_landmark.GetLandmark import get_face_landmark +from face_feature.GetFeature import get_face_feature +from face_pose.GetPose import get_face_pose +import face_manage.manage as db_manage + +def GetImageInfo(image, faceMaxCount): + gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + ### Detection + start_time = time.time() * 1000 + boxes, scores = get_face_boundingbox(image) + boxes = boxes[:faceMaxCount] + scores = scores[:faceMaxCount] + count = len(boxes) + bboxes = [] + bscores = [] + for idx in range(count): + bboxes.append(boxes[idx].data.numpy()) + bscores.append(scores[idx].data.numpy()) + # print("Detection time = %s ms" % (time.time() * 1000 - start_time)) + + ### Landmark + start_time = time.time() * 1000 + landmarks = [] ### np.zeros((count, 136), dtype=np.float32) + for idx in range(count): + landmarks.append(get_face_landmark(gray_image, boxes[idx]).data.numpy()) + # print("Landmark time = %s ms" % (time.time() * 1000 - start_time)) + + ### Pose + poses = [] + for idx in range(count): + poses.append(get_face_pose(boxes[idx], landmarks[idx])) + + ### Feature + start_time = time.time() * 1000 + features = [] + alignimgs = [] + for idx in range(count): + alignimg, feature = get_face_feature(image, landmarks[idx]) + features.append(feature) + alignimgs.append(alignimg) + print("Feature extraction time = %s ms" % (time.time() * 1000 - start_time)) + + #### + if 0: + for idx in range(count): + print_image = image.copy() + box = boxes[idx].numpy() + print(">>>>>>>>: ", box) + landmark = landmarks[idx] + cv2.rectangle(print_image, (int(box[0]), int(box[1])), (int(box[2]), int(box[3])), (0, 0, 255), 2) + for p in range(68): + cv2.circle(print_image, (int(landmark[p * 2]), int(landmark[p * 2 + 1])), 1, (255,255,255)) + cv2.imshow("face recognition", print_image) + cv2.waitKey() + + return count, bboxes, bscores, landmarks, alignimgs, features + +def get_similarity(feat1, feat2): + return (np.sum(feat1 * feat2) + 1) * 50 + +if __name__ == '__main__': + threshold = 75 + test_directory = 'test' + + efn = os.getcwd() + "/test/1.png" + img = cv2.imread(efn, cv2.IMREAD_COLOR) + count, boxes, scores, landmarks, alignimgs, features1 = GetImageInfo(img, 5) + + vfn = os.getcwd() + "/test/3.png" + img = cv2.imread(vfn, cv2.IMREAD_COLOR) + count, boxes, scores, landmarks, alignimgs, features2 = GetImageInfo(img, 5) + + score = get_similarity(features1[0], features2[0]) + print('score = ', score) + if score > threshold: + print('same person') + else: + print('different person') diff --git a/face_recognition/face_detect/__pycache__/detect_imgs.cpython-310.pyc b/face_recognition/face_detect/__pycache__/detect_imgs.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e8235c36108c1176bff5427e53312c150df9715 Binary files /dev/null and b/face_recognition/face_detect/__pycache__/detect_imgs.cpython-310.pyc differ diff --git a/face_recognition/face_detect/check_gt_box.py b/face_recognition/face_detect/check_gt_box.py new file mode 100644 index 0000000000000000000000000000000000000000..d332b3542f42a83a4e9974ada4136b42fa175bce --- /dev/null +++ b/face_recognition/face_detect/check_gt_box.py @@ -0,0 +1,59 @@ +""" +This code is used to check the data size distribution in the dataset. +""" +import xml.etree.ElementTree as ET +from math import sqrt as sqrt + +import cv2 +import matplotlib.pyplot as plt + +# sets = [("./data/wider_face_add_lm_10_10", "trainval")] +sets = [("./data/wider_face_add_lm_10_10", "test")] + +classes = ['face'] + +if __name__ == '__main__': + width = [] + height = [] + + for image_set, set in sets: + image_ids = open('{}/ImageSets/Main/{}.txt'.format(image_set, set)).read().strip().split() + for image_id in image_ids: + img_path = '{}/JPEGImages/{}.jpg'.format(image_set, image_id) + label_file = open('{}/Annotations/{}.xml'.format(image_set, image_id)) + tree = ET.parse(label_file) + root = tree.getroot() + size = root.find('size') + img_w = int(size.find('width').text) + img_h = int(size.find('height').text) + img = cv2.imread(img_path) + for obj in root.iter('object'): + difficult = obj.find('difficult').text + cls = obj.find('name').text + if cls not in classes or int(difficult) == 2: + continue + cls_id = classes.index(cls) + + xmlbox = obj.find('bndbox') + xmin = int(xmlbox.find('xmin').text) + ymin = int(xmlbox.find('ymin').text) + xmax = int(xmlbox.find('xmax').text) + ymax = int(xmlbox.find('ymax').text) + w = xmax - xmin + h = ymax - ymin + + # img = cv2.rectangle(img, (int(xmin), int(ymin)), (int(xmax), int(ymax)), (0, 255, 0), 8) + w_change = (w / img_w) * 320 + h_change = (h / img_h) * 240 + s = w_change * h_change + if w_change / h_change > 6: + print("{}/{}/{}/{}".format(xmin, xmax, ymin, ymax)) + width.append(sqrt(s)) + height.append(w_change / h_change) + print(img_path) + # img = cv2.resize(img, (608, 608)) + # cv2.imwrite('{}_{}'.format(image_set.split('/')[-1], set), img) + # cv2.waitKey() + + plt.plot(width, height, 'ro') + plt.show() diff --git a/face_recognition/face_detect/create_fd_result.py b/face_recognition/face_detect/create_fd_result.py new file mode 100644 index 0000000000000000000000000000000000000000..c50827ea2efef1a9b6d9eacfcb7b90f3e4bd37e3 --- /dev/null +++ b/face_recognition/face_detect/create_fd_result.py @@ -0,0 +1,99 @@ + """ +This code is used to batch detect images in a folder. +""" +import argparse +import os +import sys + +import cv2 + +from vision.ssd.config.fd_config import define_img_size + +parser = argparse.ArgumentParser(description='detect_imgs') + +parser.add_argument('--net_type', default="RFB", type=str, + help='The network architecture ,optional: RFB (higher precision) or slim (faster)') +parser.add_argument('--input_size', default=320, type=int, + help='define network input size,default optional value 128/160/320/480/640/1280') +parser.add_argument('--threshold', default=0.65, type=float, + help='score threshold') +parser.add_argument('--candidate_size', default=1500, type=int, + help='nms candidate size') +parser.add_argument('--path', default="D:/Database/face_detect/test/originalPics", type=str, + help='imgs dir') +parser.add_argument('--test_device', default="cpu", type=str, + help='cuda:0 or cpu') +args = parser.parse_args() +define_img_size(args.input_size) # must put define_img_size() before 'import create_mb_tiny_fd, create_mb_tiny_fd_predictor' + +from vision.ssd.mb_tiny_fd import create_mb_tiny_fd, create_mb_tiny_fd_predictor +from vision.ssd.mb_tiny_RFB_fd import create_Mb_Tiny_RFB_fd, create_Mb_Tiny_RFB_fd_predictor + +result_path = "./detect_imgs_results" +label_path = "./models/voc-model-labels.txt" +fd_result_path = 'D:/Database/face_detect/test/rfb_fd_result.txt' +fddb_txt_path = 'D:/Database/face_detect/test/FDDB-folds/FDDB-fold-01-10_2845.txt' + +test_device = args.test_device + +class_names = [name.strip() for name in open(label_path).readlines()] +if args.net_type == 'slim': + model_path = "models/pretrained/version-slim-320.pth" + net = create_mb_tiny_fd(len(class_names), is_test=True, device=test_device) + predictor = create_mb_tiny_fd_predictor(net, candidate_size=args.candidate_size, device=test_device) +elif args.net_type == 'RFB': + model_path = "models/pretrained/version-RFB-320.pth" + net = create_Mb_Tiny_RFB_fd(len(class_names), is_test=True, device=test_device) + predictor = create_Mb_Tiny_RFB_fd_predictor(net, candidate_size=args.candidate_size, device=test_device) +else: + print("The net type is wrong!") + sys.exit(1) +net.load(model_path) + +def get_file_names(dir_path): + file_list = os.listdir(dir_path) + total_file_list = list() + + for entry in file_list: + full_path = os.path.join(dir_path, entry) + if (os.path.isdir(full_path)): + total_file_list = total_file_list + get_file_names(full_path) + else: + total_file_list.append(full_path) + + return total_file_list + +def get_file_paths(txt_path): + path_list = list() + with open(txt_path, "r") as txt_file: + for line in txt_file: + path_list.append(line.strip()) + + return path_list + +if __name__ == '__main__': + if not os.path.exists(result_path): + os.makedirs(result_path) + listdir = get_file_paths(fddb_txt_path) + + total_count = 0 + correct_count = 0 + for file_path in listdir: + filename = file_path + img_path = os.path.join(args.path, filename) + orig_image = cv2.imread(img_path + ".jpg") + if orig_image is None: + continue + + print("filename: ", filename) + image = cv2.cvtColor(orig_image, cv2.COLOR_BGR2RGB) + boxes, labels, probs = predictor.predict(image, args.candidate_size / 2, args.threshold) + + with open(fd_result_path, "a") as fd_result_file: + print(filename, file=fd_result_file) + print(boxes.size(0), file=fd_result_file) + for i in range(boxes.size(0)): + box = boxes[i, :] + score = f"{probs[i]:.3f}" + print(f"{box[0]:.3f}", f"{box[1]:.3f}", f"{box[2] - box[0]:.3f}", f"{box[3] - box[1]:.3f}", score, file=fd_result_file) + diff --git a/face_recognition/face_detect/detect_imgs.py b/face_recognition/face_detect/detect_imgs.py new file mode 100644 index 0000000000000000000000000000000000000000..cd19c97b5052f6f9fd08405f6e5bcde3f33eeb73 --- /dev/null +++ b/face_recognition/face_detect/detect_imgs.py @@ -0,0 +1,65 @@ +""" +This code is used to batch detect images in a folder. +""" + +import os +import sys +import cv2 +import numpy as np +import torch + +from face_detect.vision.ssd.config.fd_config import define_img_size + +input_size = 320 +test_device = 'cpu' +net_type = 'slim' +threshold = 0.6 +candidate_size = 1500 + +define_img_size(input_size) # must put define_img_size() before 'import create_mb_tiny_fd, create_mb_tiny_fd_predictor' + +from face_detect.vision.ssd.mb_tiny_fd import create_mb_tiny_fd, create_mb_tiny_fd_predictor +from face_detect.vision.ssd.mb_tiny_RFB_fd import create_Mb_Tiny_RFB_fd, create_Mb_Tiny_RFB_fd_predictor + +label_path = "./face_recognition/face_detect/models/voc-model-labels.txt" +test_device = test_device + +class_names = [name.strip() for name in open(label_path).readlines()] +if net_type == 'slim': + model_path = "./face_recognition/face_detect/models/pretrained/version-slim-320.pth" + # model_path = "./face_detect/models/pretrained/version-slim-640.pth" + net = create_mb_tiny_fd(len(class_names), is_test=True, device=test_device) + predictor = create_mb_tiny_fd_predictor(net, candidate_size=candidate_size, device=test_device) +elif net_type == 'RFB': + model_path = "./face_recognition/face_detect/models/pretrained/version-RFB-320.pth" + # model_path = "./face_detect/models/pretrained/version-RFB-640.pth" + net = create_Mb_Tiny_RFB_fd(len(class_names), is_test=True, device=test_device) + predictor = create_Mb_Tiny_RFB_fd_predictor(net, candidate_size=candidate_size, device=test_device) +else: + print("The net type is wrong!") + sys.exit(1) +net.load(model_path) + +def get_face_boundingbox(orig_image): + """ + Description: + In input image, detect face + + Args: + orig_image: input BGR image. + """ + boxes, labels, probs = predictor.predict(cv2.cvtColor(orig_image, cv2.COLOR_BGR2RGB), candidate_size / 2, threshold) + + if len(boxes) == 0: + return torch.tensor([]), torch.tensor([]) + + height, width, _ = orig_image.shape + valid_face = np.logical_and( + np.logical_and(boxes[:,0] >= 0, boxes[:,1] >= 0), + np.logical_and(boxes[:,2] < width, boxes[:,3] < height) + ) + + boxes = boxes[valid_face] + probs = probs[valid_face] + + return boxes, probs diff --git a/face_recognition/face_detect/models/pretrained/version-RFB-320.pth b/face_recognition/face_detect/models/pretrained/version-RFB-320.pth new file mode 100644 index 0000000000000000000000000000000000000000..f0bb24a6d31bde94c46fa030007cb98302602257 --- /dev/null +++ b/face_recognition/face_detect/models/pretrained/version-RFB-320.pth @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c722b4427cc71642768baef6e15c659931b56f07425e5d2b0ec033ad41b145b3 +size 1168374 diff --git a/face_recognition/face_detect/models/pretrained/version-RFB-640.pth b/face_recognition/face_detect/models/pretrained/version-RFB-640.pth new file mode 100644 index 0000000000000000000000000000000000000000..02ab7a9e43fb197c5dde45f903aaa717146f9669 --- /dev/null +++ b/face_recognition/face_detect/models/pretrained/version-RFB-640.pth @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf34512b1a93dc234178e8a701ecf25c6afddf335a3226accf62982536e160b5 +size 1168354 diff --git a/face_recognition/face_detect/models/pretrained/version-slim-320.pth b/face_recognition/face_detect/models/pretrained/version-slim-320.pth new file mode 100644 index 0000000000000000000000000000000000000000..6dd5b4fb2e4da5ce33969cc6d527fb115e356b19 --- /dev/null +++ b/face_recognition/face_detect/models/pretrained/version-slim-320.pth @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd24abce45da5dbc7cfd8167cd3d5f955382dfc9d9ae9459f0026abd3c2e38a4 +size 1091283 diff --git a/face_recognition/face_detect/models/pretrained/version-slim-640.pth b/face_recognition/face_detect/models/pretrained/version-slim-640.pth new file mode 100644 index 0000000000000000000000000000000000000000..bc30eb89ff711fda9d1ac78c40e9cc7de8293e7b --- /dev/null +++ b/face_recognition/face_detect/models/pretrained/version-slim-640.pth @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02ca778098127c46d2b2680f1c398c7b993c12a424e94c34e6d608beb73481e4 +size 1091287 diff --git a/face_recognition/face_detect/models/voc-model-labels.txt b/face_recognition/face_detect/models/voc-model-labels.txt new file mode 100644 index 0000000000000000000000000000000000000000..f80c0695da0545cd00692a0f0efab3d3bda0b30e --- /dev/null +++ b/face_recognition/face_detect/models/voc-model-labels.txt @@ -0,0 +1,2 @@ +BACKGROUND +face \ No newline at end of file diff --git a/face_recognition/face_detect/requirements.txt b/face_recognition/face_detect/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd30ccee7a4855c0f3a8dc2ae801a91dfc9ac57f --- /dev/null +++ b/face_recognition/face_detect/requirements.txt @@ -0,0 +1,11 @@ +numpy +torch +opencv_python +torchvision +typing +torchstat +torchsummary +ptflops +matplotlib +onnx +onnxruntime \ No newline at end of file diff --git a/face_recognition/face_detect/vision/__init__.py b/face_recognition/face_detect/vision/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/face_recognition/face_detect/vision/__pycache__/__init__.cpython-310.pyc b/face_recognition/face_detect/vision/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6625327ad360ab92ba626d8667b0808255de5c36 Binary files /dev/null and b/face_recognition/face_detect/vision/__pycache__/__init__.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/datasets/__init__.py b/face_recognition/face_detect/vision/datasets/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/face_recognition/face_detect/vision/datasets/caffe_pb2.py b/face_recognition/face_detect/vision/datasets/caffe_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..3fdff132e254b594a2a26d27353a52bf71aa3f1d --- /dev/null +++ b/face_recognition/face_detect/vision/datasets/caffe_pb2.py @@ -0,0 +1,5888 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: caffe.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='caffe.proto', + package='caffe', + syntax='proto2', + serialized_pb=_b('\n\x0b\x63\x61\x66\x66\x65.proto\x12\x05\x63\x61\x66\x66\x65\"\x1c\n\tBlobShape\x12\x0f\n\x03\x64im\x18\x01 \x03(\x03\x42\x02\x10\x01\"\xcc\x01\n\tBlobProto\x12\x1f\n\x05shape\x18\x07 \x01(\x0b\x32\x10.caffe.BlobShape\x12\x10\n\x04\x64\x61ta\x18\x05 \x03(\x02\x42\x02\x10\x01\x12\x10\n\x04\x64iff\x18\x06 \x03(\x02\x42\x02\x10\x01\x12\x17\n\x0b\x64ouble_data\x18\x08 \x03(\x01\x42\x02\x10\x01\x12\x17\n\x0b\x64ouble_diff\x18\t \x03(\x01\x42\x02\x10\x01\x12\x0e\n\x03num\x18\x01 \x01(\x05:\x01\x30\x12\x13\n\x08\x63hannels\x18\x02 \x01(\x05:\x01\x30\x12\x11\n\x06height\x18\x03 \x01(\x05:\x01\x30\x12\x10\n\x05width\x18\x04 \x01(\x05:\x01\x30\"2\n\x0f\x42lobProtoVector\x12\x1f\n\x05\x62lobs\x18\x01 \x03(\x0b\x32\x10.caffe.BlobProto\"\x81\x01\n\x05\x44\x61tum\x12\x10\n\x08\x63hannels\x18\x01 \x01(\x05\x12\x0e\n\x06height\x18\x02 \x01(\x05\x12\r\n\x05width\x18\x03 \x01(\x05\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\x0c\x12\r\n\x05label\x18\x05 \x01(\x05\x12\x12\n\nfloat_data\x18\x06 \x03(\x02\x12\x16\n\x07\x65ncoded\x18\x07 \x01(\x08:\x05\x66\x61lse\"\x8a\x02\n\x0f\x46illerParameter\x12\x16\n\x04type\x18\x01 \x01(\t:\x08\x63onstant\x12\x10\n\x05value\x18\x02 \x01(\x02:\x01\x30\x12\x0e\n\x03min\x18\x03 \x01(\x02:\x01\x30\x12\x0e\n\x03max\x18\x04 \x01(\x02:\x01\x31\x12\x0f\n\x04mean\x18\x05 \x01(\x02:\x01\x30\x12\x0e\n\x03std\x18\x06 \x01(\x02:\x01\x31\x12\x12\n\x06sparse\x18\x07 \x01(\x05:\x02-1\x12\x42\n\rvariance_norm\x18\x08 \x01(\x0e\x32#.caffe.FillerParameter.VarianceNorm:\x06\x46\x41N_IN\"4\n\x0cVarianceNorm\x12\n\n\x06\x46\x41N_IN\x10\x00\x12\x0b\n\x07\x46\x41N_OUT\x10\x01\x12\x0b\n\x07\x41VERAGE\x10\x02\"\x8e\x02\n\x0cNetParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x03 \x03(\t\x12%\n\x0binput_shape\x18\x08 \x03(\x0b\x32\x10.caffe.BlobShape\x12\x11\n\tinput_dim\x18\x04 \x03(\x05\x12\x1d\n\x0e\x66orce_backward\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x05state\x18\x06 \x01(\x0b\x32\x0f.caffe.NetState\x12\x19\n\ndebug_info\x18\x07 \x01(\x08:\x05\x66\x61lse\x12$\n\x05layer\x18\x64 \x03(\x0b\x32\x15.caffe.LayerParameter\x12\'\n\x06layers\x18\x02 \x03(\x0b\x32\x17.caffe.V1LayerParameter\"\xc3\n\n\x0fSolverParameter\x12\x0b\n\x03net\x18\x18 \x01(\t\x12&\n\tnet_param\x18\x19 \x01(\x0b\x32\x13.caffe.NetParameter\x12\x11\n\ttrain_net\x18\x01 \x01(\t\x12\x10\n\x08test_net\x18\x02 \x03(\t\x12,\n\x0ftrain_net_param\x18\x15 \x01(\x0b\x32\x13.caffe.NetParameter\x12+\n\x0etest_net_param\x18\x16 \x03(\x0b\x32\x13.caffe.NetParameter\x12$\n\x0btrain_state\x18\x1a \x01(\x0b\x32\x0f.caffe.NetState\x12#\n\ntest_state\x18\x1b \x03(\x0b\x32\x0f.caffe.NetState\x12\x11\n\ttest_iter\x18\x03 \x03(\x05\x12\x18\n\rtest_interval\x18\x04 \x01(\x05:\x01\x30\x12 \n\x11test_compute_loss\x18\x13 \x01(\x08:\x05\x66\x61lse\x12!\n\x13test_initialization\x18 \x01(\x08:\x04true\x12\x0f\n\x07\x62\x61se_lr\x18\x05 \x01(\x02\x12\x0f\n\x07\x64isplay\x18\x06 \x01(\x05\x12\x17\n\x0c\x61verage_loss\x18! \x01(\x05:\x01\x31\x12\x10\n\x08max_iter\x18\x07 \x01(\x05\x12\x14\n\titer_size\x18$ \x01(\x05:\x01\x31\x12\x11\n\tlr_policy\x18\x08 \x01(\t\x12\r\n\x05gamma\x18\t \x01(\x02\x12\r\n\x05power\x18\n \x01(\x02\x12\x10\n\x08momentum\x18\x0b \x01(\x02\x12\x14\n\x0cweight_decay\x18\x0c \x01(\x02\x12\x1f\n\x13regularization_type\x18\x1d \x01(\t:\x02L2\x12\x10\n\x08stepsize\x18\r \x01(\x05\x12\x11\n\tstepvalue\x18\" \x03(\x05\x12\x1a\n\x0e\x63lip_gradients\x18# \x01(\x02:\x02-1\x12\x13\n\x08snapshot\x18\x0e \x01(\x05:\x01\x30\x12\x17\n\x0fsnapshot_prefix\x18\x0f \x01(\t\x12\x1c\n\rsnapshot_diff\x18\x10 \x01(\x08:\x05\x66\x61lse\x12K\n\x0fsnapshot_format\x18% \x01(\x0e\x32%.caffe.SolverParameter.SnapshotFormat:\x0b\x42INARYPROTO\x12;\n\x0bsolver_mode\x18\x11 \x01(\x0e\x32!.caffe.SolverParameter.SolverMode:\x03GPU\x12\x14\n\tdevice_id\x18\x12 \x01(\x05:\x01\x30\x12\x17\n\x0brandom_seed\x18\x14 \x01(\x03:\x02-1\x12\x11\n\x04type\x18( \x01(\t:\x03SGD\x12\x14\n\x05\x64\x65lta\x18\x1f \x01(\x02:\x05\x31\x65-08\x12\x18\n\tmomentum2\x18\' \x01(\x02:\x05\x30.999\x12\x17\n\trms_decay\x18& \x01(\x02:\x04\x30.99\x12\x19\n\ndebug_info\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\"\n\x14snapshot_after_train\x18\x1c \x01(\x08:\x04true\x12;\n\x0bsolver_type\x18\x1e \x01(\x0e\x32!.caffe.SolverParameter.SolverType:\x03SGD\x12\x1f\n\x11layer_wise_reduce\x18) \x01(\x08:\x04true\"+\n\x0eSnapshotFormat\x12\x08\n\x04HDF5\x10\x00\x12\x0f\n\x0b\x42INARYPROTO\x10\x01\"\x1e\n\nSolverMode\x12\x07\n\x03\x43PU\x10\x00\x12\x07\n\x03GPU\x10\x01\"U\n\nSolverType\x12\x07\n\x03SGD\x10\x00\x12\x0c\n\x08NESTEROV\x10\x01\x12\x0b\n\x07\x41\x44\x41GRAD\x10\x02\x12\x0b\n\x07RMSPROP\x10\x03\x12\x0c\n\x08\x41\x44\x41\x44\x45LTA\x10\x04\x12\x08\n\x04\x41\x44\x41M\x10\x05\"l\n\x0bSolverState\x12\x0c\n\x04iter\x18\x01 \x01(\x05\x12\x13\n\x0blearned_net\x18\x02 \x01(\t\x12!\n\x07history\x18\x03 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x17\n\x0c\x63urrent_step\x18\x04 \x01(\x05:\x01\x30\"N\n\x08NetState\x12!\n\x05phase\x18\x01 \x01(\x0e\x32\x0c.caffe.Phase:\x04TEST\x12\x10\n\x05level\x18\x02 \x01(\x05:\x01\x30\x12\r\n\x05stage\x18\x03 \x03(\t\"s\n\x0cNetStateRule\x12\x1b\n\x05phase\x18\x01 \x01(\x0e\x32\x0c.caffe.Phase\x12\x11\n\tmin_level\x18\x02 \x01(\x05\x12\x11\n\tmax_level\x18\x03 \x01(\x05\x12\r\n\x05stage\x18\x04 \x03(\t\x12\x11\n\tnot_stage\x18\x05 \x03(\t\"\xa3\x01\n\tParamSpec\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\nshare_mode\x18\x02 \x01(\x0e\x32\x1d.caffe.ParamSpec.DimCheckMode\x12\x12\n\x07lr_mult\x18\x03 \x01(\x02:\x01\x31\x12\x15\n\ndecay_mult\x18\x04 \x01(\x02:\x01\x31\"*\n\x0c\x44imCheckMode\x12\n\n\x06STRICT\x10\x00\x12\x0e\n\nPERMISSIVE\x10\x01\"\x82\x14\n\x0eLayerParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x0e\n\x06\x62ottom\x18\x03 \x03(\t\x12\x0b\n\x03top\x18\x04 \x03(\t\x12\x1b\n\x05phase\x18\n \x01(\x0e\x32\x0c.caffe.Phase\x12\x13\n\x0bloss_weight\x18\x05 \x03(\x02\x12\x1f\n\x05param\x18\x06 \x03(\x0b\x32\x10.caffe.ParamSpec\x12\x1f\n\x05\x62lobs\x18\x07 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x16\n\x0epropagate_down\x18\x0b \x03(\x08\x12$\n\x07include\x18\x08 \x03(\x0b\x32\x13.caffe.NetStateRule\x12$\n\x07\x65xclude\x18\t \x03(\x0b\x32\x13.caffe.NetStateRule\x12\x37\n\x0ftransform_param\x18\x64 \x01(\x0b\x32\x1e.caffe.TransformationParameter\x12(\n\nloss_param\x18\x65 \x01(\x0b\x32\x14.caffe.LossParameter\x12\x30\n\x0e\x61\x63\x63uracy_param\x18\x66 \x01(\x0b\x32\x18.caffe.AccuracyParameter\x12,\n\x0c\x61rgmax_param\x18g \x01(\x0b\x32\x16.caffe.ArgMaxParameter\x12\x34\n\x10\x62\x61tch_norm_param\x18\x8b\x01 \x01(\x0b\x32\x19.caffe.BatchNormParameter\x12)\n\nbias_param\x18\x8d\x01 \x01(\x0b\x32\x14.caffe.BiasParameter\x12,\n\x0c\x63oncat_param\x18h \x01(\x0b\x32\x16.caffe.ConcatParameter\x12?\n\x16\x63ontrastive_loss_param\x18i \x01(\x0b\x32\x1f.caffe.ContrastiveLossParameter\x12\x36\n\x11\x63onvolution_param\x18j \x01(\x0b\x32\x1b.caffe.ConvolutionParameter\x12)\n\ncrop_param\x18\x90\x01 \x01(\x0b\x32\x14.caffe.CropParameter\x12(\n\ndata_param\x18k \x01(\x0b\x32\x14.caffe.DataParameter\x12.\n\rdropout_param\x18l \x01(\x0b\x32\x17.caffe.DropoutParameter\x12\x33\n\x10\x64ummy_data_param\x18m \x01(\x0b\x32\x19.caffe.DummyDataParameter\x12.\n\reltwise_param\x18n \x01(\x0b\x32\x17.caffe.EltwiseParameter\x12\'\n\telu_param\x18\x8c\x01 \x01(\x0b\x32\x13.caffe.ELUParameter\x12+\n\x0b\x65mbed_param\x18\x89\x01 \x01(\x0b\x32\x15.caffe.EmbedParameter\x12&\n\texp_param\x18o \x01(\x0b\x32\x13.caffe.ExpParameter\x12/\n\rflatten_param\x18\x87\x01 \x01(\x0b\x32\x17.caffe.FlattenParameter\x12\x31\n\x0fhdf5_data_param\x18p \x01(\x0b\x32\x18.caffe.HDF5DataParameter\x12\x35\n\x11hdf5_output_param\x18q \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\x12\x33\n\x10hinge_loss_param\x18r \x01(\x0b\x32\x19.caffe.HingeLossParameter\x12\x33\n\x10image_data_param\x18s \x01(\x0b\x32\x19.caffe.ImageDataParameter\x12\x39\n\x13infogain_loss_param\x18t \x01(\x0b\x32\x1c.caffe.InfogainLossParameter\x12\x39\n\x13inner_product_param\x18u \x01(\x0b\x32\x1c.caffe.InnerProductParameter\x12+\n\x0binput_param\x18\x8f\x01 \x01(\x0b\x32\x15.caffe.InputParameter\x12\'\n\tlog_param\x18\x86\x01 \x01(\x0b\x32\x13.caffe.LogParameter\x12&\n\tlrn_param\x18v \x01(\x0b\x32\x13.caffe.LRNParameter\x12\x35\n\x11memory_data_param\x18w \x01(\x0b\x32\x1a.caffe.MemoryDataParameter\x12&\n\tmvn_param\x18x \x01(\x0b\x32\x13.caffe.MVNParameter\x12\x33\n\x0fparameter_param\x18\x91\x01 \x01(\x0b\x32\x19.caffe.ParameterParameter\x12.\n\rpooling_param\x18y \x01(\x0b\x32\x17.caffe.PoolingParameter\x12*\n\x0bpower_param\x18z \x01(\x0b\x32\x15.caffe.PowerParameter\x12+\n\x0bprelu_param\x18\x83\x01 \x01(\x0b\x32\x15.caffe.PReLUParameter\x12-\n\x0cpython_param\x18\x82\x01 \x01(\x0b\x32\x16.caffe.PythonParameter\x12\x33\n\x0frecurrent_param\x18\x92\x01 \x01(\x0b\x32\x19.caffe.RecurrentParameter\x12\x33\n\x0freduction_param\x18\x88\x01 \x01(\x0b\x32\x19.caffe.ReductionParameter\x12(\n\nrelu_param\x18{ \x01(\x0b\x32\x14.caffe.ReLUParameter\x12/\n\rreshape_param\x18\x85\x01 \x01(\x0b\x32\x17.caffe.ReshapeParameter\x12+\n\x0bscale_param\x18\x8e\x01 \x01(\x0b\x32\x15.caffe.ScaleParameter\x12.\n\rsigmoid_param\x18| \x01(\x0b\x32\x17.caffe.SigmoidParameter\x12.\n\rsoftmax_param\x18} \x01(\x0b\x32\x17.caffe.SoftmaxParameter\x12\'\n\tspp_param\x18\x84\x01 \x01(\x0b\x32\x13.caffe.SPPParameter\x12*\n\x0bslice_param\x18~ \x01(\x0b\x32\x15.caffe.SliceParameter\x12(\n\ntanh_param\x18\x7f \x01(\x0b\x32\x14.caffe.TanHParameter\x12\x33\n\x0fthreshold_param\x18\x80\x01 \x01(\x0b\x32\x19.caffe.ThresholdParameter\x12)\n\ntile_param\x18\x8a\x01 \x01(\x0b\x32\x14.caffe.TileParameter\x12\x36\n\x11window_data_param\x18\x81\x01 \x01(\x0b\x32\x1a.caffe.WindowDataParameter\"\xb6\x01\n\x17TransformationParameter\x12\x10\n\x05scale\x18\x01 \x01(\x02:\x01\x31\x12\x15\n\x06mirror\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x14\n\tcrop_size\x18\x03 \x01(\r:\x01\x30\x12\x11\n\tmean_file\x18\x04 \x01(\t\x12\x12\n\nmean_value\x18\x05 \x03(\x02\x12\x1a\n\x0b\x66orce_color\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x19\n\nforce_gray\x18\x07 \x01(\x08:\x05\x66\x61lse\"\xc2\x01\n\rLossParameter\x12\x14\n\x0cignore_label\x18\x01 \x01(\x05\x12\x44\n\rnormalization\x18\x03 \x01(\x0e\x32&.caffe.LossParameter.NormalizationMode:\x05VALID\x12\x11\n\tnormalize\x18\x02 \x01(\x08\"B\n\x11NormalizationMode\x12\x08\n\x04\x46ULL\x10\x00\x12\t\n\x05VALID\x10\x01\x12\x0e\n\nBATCH_SIZE\x10\x02\x12\x08\n\x04NONE\x10\x03\"L\n\x11\x41\x63\x63uracyParameter\x12\x10\n\x05top_k\x18\x01 \x01(\r:\x01\x31\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\x12\x14\n\x0cignore_label\x18\x03 \x01(\x05\"M\n\x0f\x41rgMaxParameter\x12\x1a\n\x0bout_max_val\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\x10\n\x05top_k\x18\x02 \x01(\r:\x01\x31\x12\x0c\n\x04\x61xis\x18\x03 \x01(\x05\"9\n\x0f\x43oncatParameter\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\x12\x15\n\nconcat_dim\x18\x01 \x01(\r:\x01\x31\"j\n\x12\x42\x61tchNormParameter\x12\x18\n\x10use_global_stats\x18\x01 \x01(\x08\x12&\n\x17moving_average_fraction\x18\x02 \x01(\x02:\x05\x30.999\x12\x12\n\x03\x65ps\x18\x03 \x01(\x02:\x05\x31\x65-05\"]\n\rBiasParameter\x12\x0f\n\x04\x61xis\x18\x01 \x01(\x05:\x01\x31\x12\x13\n\x08num_axes\x18\x02 \x01(\x05:\x01\x31\x12&\n\x06\x66iller\x18\x03 \x01(\x0b\x32\x16.caffe.FillerParameter\"L\n\x18\x43ontrastiveLossParameter\x12\x11\n\x06margin\x18\x01 \x01(\x02:\x01\x31\x12\x1d\n\x0elegacy_version\x18\x02 \x01(\x08:\x05\x66\x61lse\"\xfc\x03\n\x14\x43onvolutionParameter\x12\x12\n\nnum_output\x18\x01 \x01(\r\x12\x17\n\tbias_term\x18\x02 \x01(\x08:\x04true\x12\x0b\n\x03pad\x18\x03 \x03(\r\x12\x13\n\x0bkernel_size\x18\x04 \x03(\r\x12\x0e\n\x06stride\x18\x06 \x03(\r\x12\x10\n\x08\x64ilation\x18\x12 \x03(\r\x12\x10\n\x05pad_h\x18\t \x01(\r:\x01\x30\x12\x10\n\x05pad_w\x18\n \x01(\r:\x01\x30\x12\x10\n\x08kernel_h\x18\x0b \x01(\r\x12\x10\n\x08kernel_w\x18\x0c \x01(\r\x12\x10\n\x08stride_h\x18\r \x01(\r\x12\x10\n\x08stride_w\x18\x0e \x01(\r\x12\x10\n\x05group\x18\x05 \x01(\r:\x01\x31\x12-\n\rweight_filler\x18\x07 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x08 \x01(\x0b\x32\x16.caffe.FillerParameter\x12;\n\x06\x65ngine\x18\x0f \x01(\x0e\x32\".caffe.ConvolutionParameter.Engine:\x07\x44\x45\x46\x41ULT\x12\x0f\n\x04\x61xis\x18\x10 \x01(\x05:\x01\x31\x12\x1e\n\x0f\x66orce_nd_im2col\x18\x11 \x01(\x08:\x05\x66\x61lse\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"0\n\rCropParameter\x12\x0f\n\x04\x61xis\x18\x01 \x01(\x05:\x01\x32\x12\x0e\n\x06offset\x18\x02 \x03(\r\"\xa4\x02\n\rDataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x12\n\nbatch_size\x18\x04 \x01(\r\x12\x14\n\trand_skip\x18\x07 \x01(\r:\x01\x30\x12\x31\n\x07\x62\x61\x63kend\x18\x08 \x01(\x0e\x32\x17.caffe.DataParameter.DB:\x07LEVELDB\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x11\n\tmean_file\x18\x03 \x01(\t\x12\x14\n\tcrop_size\x18\x05 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13\x66orce_encoded_color\x18\t \x01(\x08:\x05\x66\x61lse\x12\x13\n\x08prefetch\x18\n \x01(\r:\x01\x34\"\x1b\n\x02\x44\x42\x12\x0b\n\x07LEVELDB\x10\x00\x12\x08\n\x04LMDB\x10\x01\".\n\x10\x44ropoutParameter\x12\x1a\n\rdropout_ratio\x18\x01 \x01(\x02:\x03\x30.5\"\xa0\x01\n\x12\x44ummyDataParameter\x12+\n\x0b\x64\x61ta_filler\x18\x01 \x03(\x0b\x32\x16.caffe.FillerParameter\x12\x1f\n\x05shape\x18\x06 \x03(\x0b\x32\x10.caffe.BlobShape\x12\x0b\n\x03num\x18\x02 \x03(\r\x12\x10\n\x08\x63hannels\x18\x03 \x03(\r\x12\x0e\n\x06height\x18\x04 \x03(\r\x12\r\n\x05width\x18\x05 \x03(\r\"\xa5\x01\n\x10\x45ltwiseParameter\x12\x39\n\toperation\x18\x01 \x01(\x0e\x32!.caffe.EltwiseParameter.EltwiseOp:\x03SUM\x12\r\n\x05\x63oeff\x18\x02 \x03(\x02\x12\x1e\n\x10stable_prod_grad\x18\x03 \x01(\x08:\x04true\"\'\n\tEltwiseOp\x12\x08\n\x04PROD\x10\x00\x12\x07\n\x03SUM\x10\x01\x12\x07\n\x03MAX\x10\x02\" \n\x0c\x45LUParameter\x12\x10\n\x05\x61lpha\x18\x01 \x01(\x02:\x01\x31\"\xac\x01\n\x0e\x45mbedParameter\x12\x12\n\nnum_output\x18\x01 \x01(\r\x12\x11\n\tinput_dim\x18\x02 \x01(\r\x12\x17\n\tbias_term\x18\x03 \x01(\x08:\x04true\x12-\n\rweight_filler\x18\x04 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x05 \x01(\x0b\x32\x16.caffe.FillerParameter\"D\n\x0c\x45xpParameter\x12\x10\n\x04\x62\x61se\x18\x01 \x01(\x02:\x02-1\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x10\n\x05shift\x18\x03 \x01(\x02:\x01\x30\"9\n\x10\x46lattenParameter\x12\x0f\n\x04\x61xis\x18\x01 \x01(\x05:\x01\x31\x12\x14\n\x08\x65nd_axis\x18\x02 \x01(\x05:\x02-1\"O\n\x11HDF5DataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x12\n\nbatch_size\x18\x02 \x01(\r\x12\x16\n\x07shuffle\x18\x03 \x01(\x08:\x05\x66\x61lse\"(\n\x13HDF5OutputParameter\x12\x11\n\tfile_name\x18\x01 \x01(\t\"^\n\x12HingeLossParameter\x12\x30\n\x04norm\x18\x01 \x01(\x0e\x32\x1e.caffe.HingeLossParameter.Norm:\x02L1\"\x16\n\x04Norm\x12\x06\n\x02L1\x10\x01\x12\x06\n\x02L2\x10\x02\"\x97\x02\n\x12ImageDataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x15\n\nbatch_size\x18\x04 \x01(\r:\x01\x31\x12\x14\n\trand_skip\x18\x07 \x01(\r:\x01\x30\x12\x16\n\x07shuffle\x18\x08 \x01(\x08:\x05\x66\x61lse\x12\x15\n\nnew_height\x18\t \x01(\r:\x01\x30\x12\x14\n\tnew_width\x18\n \x01(\r:\x01\x30\x12\x16\n\x08is_color\x18\x0b \x01(\x08:\x04true\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x11\n\tmean_file\x18\x03 \x01(\t\x12\x14\n\tcrop_size\x18\x05 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x15\n\x0broot_folder\x18\x0c \x01(\t:\x00\"8\n\x15InfogainLossParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\"\xcb\x01\n\x15InnerProductParameter\x12\x12\n\nnum_output\x18\x01 \x01(\r\x12\x17\n\tbias_term\x18\x02 \x01(\x08:\x04true\x12-\n\rweight_filler\x18\x03 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x04 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x0f\n\x04\x61xis\x18\x05 \x01(\x05:\x01\x31\x12\x18\n\ttranspose\x18\x06 \x01(\x08:\x05\x66\x61lse\"1\n\x0eInputParameter\x12\x1f\n\x05shape\x18\x01 \x03(\x0b\x32\x10.caffe.BlobShape\"D\n\x0cLogParameter\x12\x10\n\x04\x62\x61se\x18\x01 \x01(\x02:\x02-1\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x10\n\x05shift\x18\x03 \x01(\x02:\x01\x30\"\xb8\x02\n\x0cLRNParameter\x12\x15\n\nlocal_size\x18\x01 \x01(\r:\x01\x35\x12\x10\n\x05\x61lpha\x18\x02 \x01(\x02:\x01\x31\x12\x12\n\x04\x62\x65ta\x18\x03 \x01(\x02:\x04\x30.75\x12\x44\n\x0bnorm_region\x18\x04 \x01(\x0e\x32\x1e.caffe.LRNParameter.NormRegion:\x0f\x41\x43ROSS_CHANNELS\x12\x0c\n\x01k\x18\x05 \x01(\x02:\x01\x31\x12\x33\n\x06\x65ngine\x18\x06 \x01(\x0e\x32\x1a.caffe.LRNParameter.Engine:\x07\x44\x45\x46\x41ULT\"5\n\nNormRegion\x12\x13\n\x0f\x41\x43ROSS_CHANNELS\x10\x00\x12\x12\n\x0eWITHIN_CHANNEL\x10\x01\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"Z\n\x13MemoryDataParameter\x12\x12\n\nbatch_size\x18\x01 \x01(\r\x12\x10\n\x08\x63hannels\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\r\n\x05width\x18\x04 \x01(\r\"d\n\x0cMVNParameter\x12 \n\x12normalize_variance\x18\x01 \x01(\x08:\x04true\x12\x1e\n\x0f\x61\x63ross_channels\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x12\n\x03\x65ps\x18\x03 \x01(\x02:\x05\x31\x65-09\"5\n\x12ParameterParameter\x12\x1f\n\x05shape\x18\x01 \x01(\x0b\x32\x10.caffe.BlobShape\"\xa2\x03\n\x10PoolingParameter\x12\x35\n\x04pool\x18\x01 \x01(\x0e\x32\".caffe.PoolingParameter.PoolMethod:\x03MAX\x12\x0e\n\x03pad\x18\x04 \x01(\r:\x01\x30\x12\x10\n\x05pad_h\x18\t \x01(\r:\x01\x30\x12\x10\n\x05pad_w\x18\n \x01(\r:\x01\x30\x12\x13\n\x0bkernel_size\x18\x02 \x01(\r\x12\x10\n\x08kernel_h\x18\x05 \x01(\r\x12\x10\n\x08kernel_w\x18\x06 \x01(\r\x12\x11\n\x06stride\x18\x03 \x01(\r:\x01\x31\x12\x10\n\x08stride_h\x18\x07 \x01(\r\x12\x10\n\x08stride_w\x18\x08 \x01(\r\x12\x37\n\x06\x65ngine\x18\x0b \x01(\x0e\x32\x1e.caffe.PoolingParameter.Engine:\x07\x44\x45\x46\x41ULT\x12\x1d\n\x0eglobal_pooling\x18\x0c \x01(\x08:\x05\x66\x61lse\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"F\n\x0ePowerParameter\x12\x10\n\x05power\x18\x01 \x01(\x02:\x01\x31\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x10\n\x05shift\x18\x03 \x01(\x02:\x01\x30\"g\n\x0fPythonParameter\x12\x0e\n\x06module\x18\x01 \x01(\t\x12\r\n\x05layer\x18\x02 \x01(\t\x12\x13\n\tparam_str\x18\x03 \x01(\t:\x00\x12 \n\x11share_in_parallel\x18\x04 \x01(\x08:\x05\x66\x61lse\"\xc0\x01\n\x12RecurrentParameter\x12\x15\n\nnum_output\x18\x01 \x01(\r:\x01\x30\x12-\n\rweight_filler\x18\x02 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x03 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x19\n\ndebug_info\x18\x04 \x01(\x08:\x05\x66\x61lse\x12\x1c\n\rexpose_hidden\x18\x05 \x01(\x08:\x05\x66\x61lse\"\xad\x01\n\x12ReductionParameter\x12=\n\toperation\x18\x01 \x01(\x0e\x32%.caffe.ReductionParameter.ReductionOp:\x03SUM\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x30\x12\x10\n\x05\x63oeff\x18\x03 \x01(\x02:\x01\x31\"5\n\x0bReductionOp\x12\x07\n\x03SUM\x10\x01\x12\x08\n\x04\x41SUM\x10\x02\x12\t\n\x05SUMSQ\x10\x03\x12\x08\n\x04MEAN\x10\x04\"\x8d\x01\n\rReLUParameter\x12\x19\n\x0enegative_slope\x18\x01 \x01(\x02:\x01\x30\x12\x34\n\x06\x65ngine\x18\x02 \x01(\x0e\x32\x1b.caffe.ReLUParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"Z\n\x10ReshapeParameter\x12\x1f\n\x05shape\x18\x01 \x01(\x0b\x32\x10.caffe.BlobShape\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x30\x12\x14\n\x08num_axes\x18\x03 \x01(\x05:\x02-1\"\xa5\x01\n\x0eScaleParameter\x12\x0f\n\x04\x61xis\x18\x01 \x01(\x05:\x01\x31\x12\x13\n\x08num_axes\x18\x02 \x01(\x05:\x01\x31\x12&\n\x06\x66iller\x18\x03 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x18\n\tbias_term\x18\x04 \x01(\x08:\x05\x66\x61lse\x12+\n\x0b\x62ias_filler\x18\x05 \x01(\x0b\x32\x16.caffe.FillerParameter\"x\n\x10SigmoidParameter\x12\x37\n\x06\x65ngine\x18\x01 \x01(\x0e\x32\x1e.caffe.SigmoidParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"L\n\x0eSliceParameter\x12\x0f\n\x04\x61xis\x18\x03 \x01(\x05:\x01\x31\x12\x13\n\x0bslice_point\x18\x02 \x03(\r\x12\x14\n\tslice_dim\x18\x01 \x01(\r:\x01\x31\"\x89\x01\n\x10SoftmaxParameter\x12\x37\n\x06\x65ngine\x18\x01 \x01(\x0e\x32\x1e.caffe.SoftmaxParameter.Engine:\x07\x44\x45\x46\x41ULT\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"r\n\rTanHParameter\x12\x34\n\x06\x65ngine\x18\x01 \x01(\x0e\x32\x1b.caffe.TanHParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"/\n\rTileParameter\x12\x0f\n\x04\x61xis\x18\x01 \x01(\x05:\x01\x31\x12\r\n\x05tiles\x18\x02 \x01(\x05\"*\n\x12ThresholdParameter\x12\x14\n\tthreshold\x18\x01 \x01(\x02:\x01\x30\"\xc1\x02\n\x13WindowDataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x11\n\tmean_file\x18\x03 \x01(\t\x12\x12\n\nbatch_size\x18\x04 \x01(\r\x12\x14\n\tcrop_size\x18\x05 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x19\n\x0c\x66g_threshold\x18\x07 \x01(\x02:\x03\x30.5\x12\x19\n\x0c\x62g_threshold\x18\x08 \x01(\x02:\x03\x30.5\x12\x19\n\x0b\x66g_fraction\x18\t \x01(\x02:\x04\x30.25\x12\x16\n\x0b\x63ontext_pad\x18\n \x01(\r:\x01\x30\x12\x17\n\tcrop_mode\x18\x0b \x01(\t:\x04warp\x12\x1b\n\x0c\x63\x61\x63he_images\x18\x0c \x01(\x08:\x05\x66\x61lse\x12\x15\n\x0broot_folder\x18\r \x01(\t:\x00\"\xeb\x01\n\x0cSPPParameter\x12\x16\n\x0epyramid_height\x18\x01 \x01(\r\x12\x31\n\x04pool\x18\x02 \x01(\x0e\x32\x1e.caffe.SPPParameter.PoolMethod:\x03MAX\x12\x33\n\x06\x65ngine\x18\x06 \x01(\x0e\x32\x1a.caffe.SPPParameter.Engine:\x07\x44\x45\x46\x41ULT\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"\xe0\x13\n\x10V1LayerParameter\x12\x0e\n\x06\x62ottom\x18\x02 \x03(\t\x12\x0b\n\x03top\x18\x03 \x03(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12$\n\x07include\x18 \x03(\x0b\x32\x13.caffe.NetStateRule\x12$\n\x07\x65xclude\x18! \x03(\x0b\x32\x13.caffe.NetStateRule\x12/\n\x04type\x18\x05 \x01(\x0e\x32!.caffe.V1LayerParameter.LayerType\x12\x1f\n\x05\x62lobs\x18\x06 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x0e\n\x05param\x18\xe9\x07 \x03(\t\x12>\n\x0f\x62lob_share_mode\x18\xea\x07 \x03(\x0e\x32$.caffe.V1LayerParameter.DimCheckMode\x12\x10\n\x08\x62lobs_lr\x18\x07 \x03(\x02\x12\x14\n\x0cweight_decay\x18\x08 \x03(\x02\x12\x13\n\x0bloss_weight\x18# \x03(\x02\x12\x30\n\x0e\x61\x63\x63uracy_param\x18\x1b \x01(\x0b\x32\x18.caffe.AccuracyParameter\x12,\n\x0c\x61rgmax_param\x18\x17 \x01(\x0b\x32\x16.caffe.ArgMaxParameter\x12,\n\x0c\x63oncat_param\x18\t \x01(\x0b\x32\x16.caffe.ConcatParameter\x12?\n\x16\x63ontrastive_loss_param\x18( \x01(\x0b\x32\x1f.caffe.ContrastiveLossParameter\x12\x36\n\x11\x63onvolution_param\x18\n \x01(\x0b\x32\x1b.caffe.ConvolutionParameter\x12(\n\ndata_param\x18\x0b \x01(\x0b\x32\x14.caffe.DataParameter\x12.\n\rdropout_param\x18\x0c \x01(\x0b\x32\x17.caffe.DropoutParameter\x12\x33\n\x10\x64ummy_data_param\x18\x1a \x01(\x0b\x32\x19.caffe.DummyDataParameter\x12.\n\reltwise_param\x18\x18 \x01(\x0b\x32\x17.caffe.EltwiseParameter\x12&\n\texp_param\x18) \x01(\x0b\x32\x13.caffe.ExpParameter\x12\x31\n\x0fhdf5_data_param\x18\r \x01(\x0b\x32\x18.caffe.HDF5DataParameter\x12\x35\n\x11hdf5_output_param\x18\x0e \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\x12\x33\n\x10hinge_loss_param\x18\x1d \x01(\x0b\x32\x19.caffe.HingeLossParameter\x12\x33\n\x10image_data_param\x18\x0f \x01(\x0b\x32\x19.caffe.ImageDataParameter\x12\x39\n\x13infogain_loss_param\x18\x10 \x01(\x0b\x32\x1c.caffe.InfogainLossParameter\x12\x39\n\x13inner_product_param\x18\x11 \x01(\x0b\x32\x1c.caffe.InnerProductParameter\x12&\n\tlrn_param\x18\x12 \x01(\x0b\x32\x13.caffe.LRNParameter\x12\x35\n\x11memory_data_param\x18\x16 \x01(\x0b\x32\x1a.caffe.MemoryDataParameter\x12&\n\tmvn_param\x18\" \x01(\x0b\x32\x13.caffe.MVNParameter\x12.\n\rpooling_param\x18\x13 \x01(\x0b\x32\x17.caffe.PoolingParameter\x12*\n\x0bpower_param\x18\x15 \x01(\x0b\x32\x15.caffe.PowerParameter\x12(\n\nrelu_param\x18\x1e \x01(\x0b\x32\x14.caffe.ReLUParameter\x12.\n\rsigmoid_param\x18& \x01(\x0b\x32\x17.caffe.SigmoidParameter\x12.\n\rsoftmax_param\x18\' \x01(\x0b\x32\x17.caffe.SoftmaxParameter\x12*\n\x0bslice_param\x18\x1f \x01(\x0b\x32\x15.caffe.SliceParameter\x12(\n\ntanh_param\x18% \x01(\x0b\x32\x14.caffe.TanHParameter\x12\x32\n\x0fthreshold_param\x18\x19 \x01(\x0b\x32\x19.caffe.ThresholdParameter\x12\x35\n\x11window_data_param\x18\x14 \x01(\x0b\x32\x1a.caffe.WindowDataParameter\x12\x37\n\x0ftransform_param\x18$ \x01(\x0b\x32\x1e.caffe.TransformationParameter\x12(\n\nloss_param\x18* \x01(\x0b\x32\x14.caffe.LossParameter\x12&\n\x05layer\x18\x01 \x01(\x0b\x32\x17.caffe.V0LayerParameter\"\xd8\x04\n\tLayerType\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06\x41\x42SVAL\x10#\x12\x0c\n\x08\x41\x43\x43URACY\x10\x01\x12\n\n\x06\x41RGMAX\x10\x1e\x12\x08\n\x04\x42NLL\x10\x02\x12\n\n\x06\x43ONCAT\x10\x03\x12\x14\n\x10\x43ONTRASTIVE_LOSS\x10%\x12\x0f\n\x0b\x43ONVOLUTION\x10\x04\x12\x08\n\x04\x44\x41TA\x10\x05\x12\x11\n\rDECONVOLUTION\x10\'\x12\x0b\n\x07\x44ROPOUT\x10\x06\x12\x0e\n\nDUMMY_DATA\x10 \x12\x12\n\x0e\x45UCLIDEAN_LOSS\x10\x07\x12\x0b\n\x07\x45LTWISE\x10\x19\x12\x07\n\x03\x45XP\x10&\x12\x0b\n\x07\x46LATTEN\x10\x08\x12\r\n\tHDF5_DATA\x10\t\x12\x0f\n\x0bHDF5_OUTPUT\x10\n\x12\x0e\n\nHINGE_LOSS\x10\x1c\x12\n\n\x06IM2COL\x10\x0b\x12\x0e\n\nIMAGE_DATA\x10\x0c\x12\x11\n\rINFOGAIN_LOSS\x10\r\x12\x11\n\rINNER_PRODUCT\x10\x0e\x12\x07\n\x03LRN\x10\x0f\x12\x0f\n\x0bMEMORY_DATA\x10\x1d\x12\x1d\n\x19MULTINOMIAL_LOGISTIC_LOSS\x10\x10\x12\x07\n\x03MVN\x10\"\x12\x0b\n\x07POOLING\x10\x11\x12\t\n\x05POWER\x10\x1a\x12\x08\n\x04RELU\x10\x12\x12\x0b\n\x07SIGMOID\x10\x13\x12\x1e\n\x1aSIGMOID_CROSS_ENTROPY_LOSS\x10\x1b\x12\x0b\n\x07SILENCE\x10$\x12\x0b\n\x07SOFTMAX\x10\x14\x12\x10\n\x0cSOFTMAX_LOSS\x10\x15\x12\t\n\x05SPLIT\x10\x16\x12\t\n\x05SLICE\x10!\x12\x08\n\x04TANH\x10\x17\x12\x0f\n\x0bWINDOW_DATA\x10\x18\x12\r\n\tTHRESHOLD\x10\x1f\"*\n\x0c\x44imCheckMode\x12\n\n\x06STRICT\x10\x00\x12\x0e\n\nPERMISSIVE\x10\x01\"\xfd\x07\n\x10V0LayerParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x12\n\nnum_output\x18\x03 \x01(\r\x12\x16\n\x08\x62iasterm\x18\x04 \x01(\x08:\x04true\x12-\n\rweight_filler\x18\x05 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x06 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x0e\n\x03pad\x18\x07 \x01(\r:\x01\x30\x12\x12\n\nkernelsize\x18\x08 \x01(\r\x12\x10\n\x05group\x18\t \x01(\r:\x01\x31\x12\x11\n\x06stride\x18\n \x01(\r:\x01\x31\x12\x35\n\x04pool\x18\x0b \x01(\x0e\x32\".caffe.V0LayerParameter.PoolMethod:\x03MAX\x12\x1a\n\rdropout_ratio\x18\x0c \x01(\x02:\x03\x30.5\x12\x15\n\nlocal_size\x18\r \x01(\r:\x01\x35\x12\x10\n\x05\x61lpha\x18\x0e \x01(\x02:\x01\x31\x12\x12\n\x04\x62\x65ta\x18\x0f \x01(\x02:\x04\x30.75\x12\x0c\n\x01k\x18\x16 \x01(\x02:\x01\x31\x12\x0e\n\x06source\x18\x10 \x01(\t\x12\x10\n\x05scale\x18\x11 \x01(\x02:\x01\x31\x12\x10\n\x08meanfile\x18\x12 \x01(\t\x12\x11\n\tbatchsize\x18\x13 \x01(\r\x12\x13\n\x08\x63ropsize\x18\x14 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x15 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x05\x62lobs\x18\x32 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x10\n\x08\x62lobs_lr\x18\x33 \x03(\x02\x12\x14\n\x0cweight_decay\x18\x34 \x03(\x02\x12\x14\n\trand_skip\x18\x35 \x01(\r:\x01\x30\x12\x1d\n\x10\x64\x65t_fg_threshold\x18\x36 \x01(\x02:\x03\x30.5\x12\x1d\n\x10\x64\x65t_bg_threshold\x18\x37 \x01(\x02:\x03\x30.5\x12\x1d\n\x0f\x64\x65t_fg_fraction\x18\x38 \x01(\x02:\x04\x30.25\x12\x1a\n\x0f\x64\x65t_context_pad\x18: \x01(\r:\x01\x30\x12\x1b\n\rdet_crop_mode\x18; \x01(\t:\x04warp\x12\x12\n\x07new_num\x18< \x01(\x05:\x01\x30\x12\x17\n\x0cnew_channels\x18= \x01(\x05:\x01\x30\x12\x15\n\nnew_height\x18> \x01(\x05:\x01\x30\x12\x14\n\tnew_width\x18? \x01(\x05:\x01\x30\x12\x1d\n\x0eshuffle_images\x18@ \x01(\x08:\x05\x66\x61lse\x12\x15\n\nconcat_dim\x18\x41 \x01(\r:\x01\x31\x12\x36\n\x11hdf5_output_param\x18\xe9\x07 \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"W\n\x0ePReLUParameter\x12&\n\x06\x66iller\x18\x01 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x1d\n\x0e\x63hannel_shared\x18\x02 \x01(\x08:\x05\x66\x61lse*\x1c\n\x05Phase\x12\t\n\x05TRAIN\x10\x00\x12\x08\n\x04TEST\x10\x01') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_PHASE = _descriptor.EnumDescriptor( + name='Phase', + full_name='caffe.Phase', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='TRAIN', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TEST', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=15403, + serialized_end=15431, +) +_sym_db.RegisterEnumDescriptor(_PHASE) + +Phase = enum_type_wrapper.EnumTypeWrapper(_PHASE) +TRAIN = 0 +TEST = 1 + + +_FILLERPARAMETER_VARIANCENORM = _descriptor.EnumDescriptor( + name='VarianceNorm', + full_name='caffe.FillerParameter.VarianceNorm', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='FAN_IN', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FAN_OUT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AVERAGE', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=658, + serialized_end=710, +) +_sym_db.RegisterEnumDescriptor(_FILLERPARAMETER_VARIANCENORM) + +_SOLVERPARAMETER_SNAPSHOTFORMAT = _descriptor.EnumDescriptor( + name='SnapshotFormat', + full_name='caffe.SolverParameter.SnapshotFormat', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='HDF5', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BINARYPROTO', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2171, + serialized_end=2214, +) +_sym_db.RegisterEnumDescriptor(_SOLVERPARAMETER_SNAPSHOTFORMAT) + +_SOLVERPARAMETER_SOLVERMODE = _descriptor.EnumDescriptor( + name='SolverMode', + full_name='caffe.SolverParameter.SolverMode', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='CPU', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GPU', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2216, + serialized_end=2246, +) +_sym_db.RegisterEnumDescriptor(_SOLVERPARAMETER_SOLVERMODE) + +_SOLVERPARAMETER_SOLVERTYPE = _descriptor.EnumDescriptor( + name='SolverType', + full_name='caffe.SolverParameter.SolverType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='SGD', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NESTEROV', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ADAGRAD', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RMSPROP', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ADADELTA', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ADAM', index=5, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2248, + serialized_end=2333, +) +_sym_db.RegisterEnumDescriptor(_SOLVERPARAMETER_SOLVERTYPE) + +_PARAMSPEC_DIMCHECKMODE = _descriptor.EnumDescriptor( + name='DimCheckMode', + full_name='caffe.ParamSpec.DimCheckMode', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='STRICT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PERMISSIVE', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2764, + serialized_end=2806, +) +_sym_db.RegisterEnumDescriptor(_PARAMSPEC_DIMCHECKMODE) + +_LOSSPARAMETER_NORMALIZATIONMODE = _descriptor.EnumDescriptor( + name='NormalizationMode', + full_name='caffe.LossParameter.NormalizationMode', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='FULL', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='VALID', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BATCH_SIZE', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NONE', index=3, number=3, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=5687, + serialized_end=5753, +) +_sym_db.RegisterEnumDescriptor(_LOSSPARAMETER_NORMALIZATIONMODE) + +_CONVOLUTIONPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.ConvolutionParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_CONVOLUTIONPARAMETER_ENGINE) + +_DATAPARAMETER_DB = _descriptor.EnumDescriptor( + name='DB', + full_name='caffe.DataParameter.DB', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='LEVELDB', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LMDB', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=7079, + serialized_end=7106, +) +_sym_db.RegisterEnumDescriptor(_DATAPARAMETER_DB) + +_ELTWISEPARAMETER_ELTWISEOP = _descriptor.EnumDescriptor( + name='EltwiseOp', + full_name='caffe.EltwiseParameter.EltwiseOp', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='PROD', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SUM', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MAX', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=7446, + serialized_end=7485, +) +_sym_db.RegisterEnumDescriptor(_ELTWISEPARAMETER_ELTWISEOP) + +_HINGELOSSPARAMETER_NORM = _descriptor.EnumDescriptor( + name='Norm', + full_name='caffe.HingeLossParameter.Norm', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='L1', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='L2', index=1, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=8020, + serialized_end=8042, +) +_sym_db.RegisterEnumDescriptor(_HINGELOSSPARAMETER_NORM) + +_LRNPARAMETER_NORMREGION = _descriptor.EnumDescriptor( + name='NormRegion', + full_name='caffe.LRNParameter.NormRegion', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='ACROSS_CHANNELS', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WITHIN_CHANNEL', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=8926, + serialized_end=8979, +) +_sym_db.RegisterEnumDescriptor(_LRNPARAMETER_NORMREGION) + +_LRNPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.LRNParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_LRNPARAMETER_ENGINE) + +_POOLINGPARAMETER_POOLMETHOD = _descriptor.EnumDescriptor( + name='PoolMethod', + full_name='caffe.PoolingParameter.PoolMethod', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='MAX', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AVE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STOCHASTIC', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=9603, + serialized_end=9649, +) +_sym_db.RegisterEnumDescriptor(_POOLINGPARAMETER_POOLMETHOD) + +_POOLINGPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.PoolingParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_POOLINGPARAMETER_ENGINE) + +_REDUCTIONPARAMETER_REDUCTIONOP = _descriptor.EnumDescriptor( + name='ReductionOp', + full_name='caffe.ReductionParameter.ReductionOp', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='SUM', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ASUM', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SUMSQ', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MEAN', index=3, number=4, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=10189, + serialized_end=10242, +) +_sym_db.RegisterEnumDescriptor(_REDUCTIONPARAMETER_REDUCTIONOP) + +_RELUPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.ReLUParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_RELUPARAMETER_ENGINE) + +_SIGMOIDPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.SigmoidParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_SIGMOIDPARAMETER_ENGINE) + +_SOFTMAXPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.SoftmaxParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_SOFTMAXPARAMETER_ENGINE) + +_TANHPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.TanHParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_TANHPARAMETER_ENGINE) + +_SPPPARAMETER_POOLMETHOD = _descriptor.EnumDescriptor( + name='PoolMethod', + full_name='caffe.SPPParameter.PoolMethod', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='MAX', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AVE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STOCHASTIC', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=9603, + serialized_end=9649, +) +_sym_db.RegisterEnumDescriptor(_SPPPARAMETER_POOLMETHOD) + +_SPPPARAMETER_ENGINE = _descriptor.EnumDescriptor( + name='Engine', + full_name='caffe.SPPParameter.Engine', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DEFAULT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAFFE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CUDNN', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=6718, + serialized_end=6761, +) +_sym_db.RegisterEnumDescriptor(_SPPPARAMETER_ENGINE) + +_V1LAYERPARAMETER_LAYERTYPE = _descriptor.EnumDescriptor( + name='LayerType', + full_name='caffe.V1LayerParameter.LayerType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='NONE', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ABSVAL', index=1, number=35, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ACCURACY', index=2, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ARGMAX', index=3, number=30, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BNLL', index=4, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONCAT', index=5, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONTRASTIVE_LOSS', index=6, number=37, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONVOLUTION', index=7, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DATA', index=8, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DECONVOLUTION', index=9, number=39, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DROPOUT', index=10, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DUMMY_DATA', index=11, number=32, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='EUCLIDEAN_LOSS', index=12, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ELTWISE', index=13, number=25, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='EXP', index=14, number=38, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLATTEN', index=15, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='HDF5_DATA', index=16, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='HDF5_OUTPUT', index=17, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='HINGE_LOSS', index=18, number=28, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IM2COL', index=19, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IMAGE_DATA', index=20, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INFOGAIN_LOSS', index=21, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INNER_PRODUCT', index=22, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LRN', index=23, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MEMORY_DATA', index=24, number=29, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MULTINOMIAL_LOGISTIC_LOSS', index=25, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MVN', index=26, number=34, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='POOLING', index=27, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='POWER', index=28, number=26, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RELU', index=29, number=18, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SIGMOID', index=30, number=19, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SIGMOID_CROSS_ENTROPY_LOSS', index=31, number=27, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SILENCE', index=32, number=36, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SOFTMAX', index=33, number=20, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SOFTMAX_LOSS', index=34, number=21, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SPLIT', index=35, number=22, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SLICE', index=36, number=33, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TANH', index=37, number=23, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WINDOW_DATA', index=38, number=24, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='THRESHOLD', index=39, number=31, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=13644, + serialized_end=14244, +) +_sym_db.RegisterEnumDescriptor(_V1LAYERPARAMETER_LAYERTYPE) + +_V1LAYERPARAMETER_DIMCHECKMODE = _descriptor.EnumDescriptor( + name='DimCheckMode', + full_name='caffe.V1LayerParameter.DimCheckMode', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='STRICT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PERMISSIVE', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2764, + serialized_end=2806, +) +_sym_db.RegisterEnumDescriptor(_V1LAYERPARAMETER_DIMCHECKMODE) + +_V0LAYERPARAMETER_POOLMETHOD = _descriptor.EnumDescriptor( + name='PoolMethod', + full_name='caffe.V0LayerParameter.PoolMethod', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='MAX', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AVE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STOCHASTIC', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=9603, + serialized_end=9649, +) +_sym_db.RegisterEnumDescriptor(_V0LAYERPARAMETER_POOLMETHOD) + + +_BLOBSHAPE = _descriptor.Descriptor( + name='BlobShape', + full_name='caffe.BlobShape', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='dim', full_name='caffe.BlobShape.dim', index=0, + number=1, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=22, + serialized_end=50, +) + + +_BLOBPROTO = _descriptor.Descriptor( + name='BlobProto', + full_name='caffe.BlobProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='shape', full_name='caffe.BlobProto.shape', index=0, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data', full_name='caffe.BlobProto.data', index=1, + number=5, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='diff', full_name='caffe.BlobProto.diff', index=2, + number=6, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='double_data', full_name='caffe.BlobProto.double_data', index=3, + number=8, type=1, cpp_type=5, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='double_diff', full_name='caffe.BlobProto.double_diff', index=4, + number=9, type=1, cpp_type=5, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='num', full_name='caffe.BlobProto.num', index=5, + number=1, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='channels', full_name='caffe.BlobProto.channels', index=6, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='height', full_name='caffe.BlobProto.height', index=7, + number=3, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='width', full_name='caffe.BlobProto.width', index=8, + number=4, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=53, + serialized_end=257, +) + + +_BLOBPROTOVECTOR = _descriptor.Descriptor( + name='BlobProtoVector', + full_name='caffe.BlobProtoVector', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='blobs', full_name='caffe.BlobProtoVector.blobs', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=259, + serialized_end=309, +) + + +_DATUM = _descriptor.Descriptor( + name='Datum', + full_name='caffe.Datum', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='channels', full_name='caffe.Datum.channels', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='height', full_name='caffe.Datum.height', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='width', full_name='caffe.Datum.width', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data', full_name='caffe.Datum.data', index=3, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='label', full_name='caffe.Datum.label', index=4, + number=5, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='float_data', full_name='caffe.Datum.float_data', index=5, + number=6, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='encoded', full_name='caffe.Datum.encoded', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=312, + serialized_end=441, +) + + +_FILLERPARAMETER = _descriptor.Descriptor( + name='FillerParameter', + full_name='caffe.FillerParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='caffe.FillerParameter.type', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("constant").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='caffe.FillerParameter.value', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='min', full_name='caffe.FillerParameter.min', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max', full_name='caffe.FillerParameter.max', index=3, + number=4, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mean', full_name='caffe.FillerParameter.mean', index=4, + number=5, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='std', full_name='caffe.FillerParameter.std', index=5, + number=6, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sparse', full_name='caffe.FillerParameter.sparse', index=6, + number=7, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=-1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='variance_norm', full_name='caffe.FillerParameter.variance_norm', index=7, + number=8, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _FILLERPARAMETER_VARIANCENORM, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=444, + serialized_end=710, +) + + +_NETPARAMETER = _descriptor.Descriptor( + name='NetParameter', + full_name='caffe.NetParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='caffe.NetParameter.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input', full_name='caffe.NetParameter.input', index=1, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input_shape', full_name='caffe.NetParameter.input_shape', index=2, + number=8, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input_dim', full_name='caffe.NetParameter.input_dim', index=3, + number=4, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='force_backward', full_name='caffe.NetParameter.force_backward', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='state', full_name='caffe.NetParameter.state', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='debug_info', full_name='caffe.NetParameter.debug_info', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='layer', full_name='caffe.NetParameter.layer', index=7, + number=100, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='layers', full_name='caffe.NetParameter.layers', index=8, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=713, + serialized_end=983, +) + + +_SOLVERPARAMETER = _descriptor.Descriptor( + name='SolverParameter', + full_name='caffe.SolverParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='net', full_name='caffe.SolverParameter.net', index=0, + number=24, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='net_param', full_name='caffe.SolverParameter.net_param', index=1, + number=25, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='train_net', full_name='caffe.SolverParameter.train_net', index=2, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_net', full_name='caffe.SolverParameter.test_net', index=3, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='train_net_param', full_name='caffe.SolverParameter.train_net_param', index=4, + number=21, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_net_param', full_name='caffe.SolverParameter.test_net_param', index=5, + number=22, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='train_state', full_name='caffe.SolverParameter.train_state', index=6, + number=26, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_state', full_name='caffe.SolverParameter.test_state', index=7, + number=27, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_iter', full_name='caffe.SolverParameter.test_iter', index=8, + number=3, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_interval', full_name='caffe.SolverParameter.test_interval', index=9, + number=4, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_compute_loss', full_name='caffe.SolverParameter.test_compute_loss', index=10, + number=19, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='test_initialization', full_name='caffe.SolverParameter.test_initialization', index=11, + number=32, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='base_lr', full_name='caffe.SolverParameter.base_lr', index=12, + number=5, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='display', full_name='caffe.SolverParameter.display', index=13, + number=6, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='average_loss', full_name='caffe.SolverParameter.average_loss', index=14, + number=33, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_iter', full_name='caffe.SolverParameter.max_iter', index=15, + number=7, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='iter_size', full_name='caffe.SolverParameter.iter_size', index=16, + number=36, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='lr_policy', full_name='caffe.SolverParameter.lr_policy', index=17, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='gamma', full_name='caffe.SolverParameter.gamma', index=18, + number=9, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='power', full_name='caffe.SolverParameter.power', index=19, + number=10, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='momentum', full_name='caffe.SolverParameter.momentum', index=20, + number=11, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_decay', full_name='caffe.SolverParameter.weight_decay', index=21, + number=12, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='regularization_type', full_name='caffe.SolverParameter.regularization_type', index=22, + number=29, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("L2").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stepsize', full_name='caffe.SolverParameter.stepsize', index=23, + number=13, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stepvalue', full_name='caffe.SolverParameter.stepvalue', index=24, + number=34, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='clip_gradients', full_name='caffe.SolverParameter.clip_gradients', index=25, + number=35, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(-1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='snapshot', full_name='caffe.SolverParameter.snapshot', index=26, + number=14, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='snapshot_prefix', full_name='caffe.SolverParameter.snapshot_prefix', index=27, + number=15, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='snapshot_diff', full_name='caffe.SolverParameter.snapshot_diff', index=28, + number=16, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='snapshot_format', full_name='caffe.SolverParameter.snapshot_format', index=29, + number=37, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='solver_mode', full_name='caffe.SolverParameter.solver_mode', index=30, + number=17, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='device_id', full_name='caffe.SolverParameter.device_id', index=31, + number=18, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='random_seed', full_name='caffe.SolverParameter.random_seed', index=32, + number=20, type=3, cpp_type=2, label=1, + has_default_value=True, default_value=-1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='caffe.SolverParameter.type', index=33, + number=40, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("SGD").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='delta', full_name='caffe.SolverParameter.delta', index=34, + number=31, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1e-08), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='momentum2', full_name='caffe.SolverParameter.momentum2', index=35, + number=39, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.999), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rms_decay', full_name='caffe.SolverParameter.rms_decay', index=36, + number=38, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.99), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='debug_info', full_name='caffe.SolverParameter.debug_info', index=37, + number=23, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='snapshot_after_train', full_name='caffe.SolverParameter.snapshot_after_train', index=38, + number=28, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='solver_type', full_name='caffe.SolverParameter.solver_type', index=39, + number=30, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='layer_wise_reduce', full_name='caffe.SolverParameter.layer_wise_reduce', index=40, + number=41, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _SOLVERPARAMETER_SNAPSHOTFORMAT, + _SOLVERPARAMETER_SOLVERMODE, + _SOLVERPARAMETER_SOLVERTYPE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=986, + serialized_end=2333, +) + + +_SOLVERSTATE = _descriptor.Descriptor( + name='SolverState', + full_name='caffe.SolverState', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='iter', full_name='caffe.SolverState.iter', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='learned_net', full_name='caffe.SolverState.learned_net', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='history', full_name='caffe.SolverState.history', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='current_step', full_name='caffe.SolverState.current_step', index=3, + number=4, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2335, + serialized_end=2443, +) + + +_NETSTATE = _descriptor.Descriptor( + name='NetState', + full_name='caffe.NetState', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='phase', full_name='caffe.NetState.phase', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='level', full_name='caffe.NetState.level', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stage', full_name='caffe.NetState.stage', index=2, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2445, + serialized_end=2523, +) + + +_NETSTATERULE = _descriptor.Descriptor( + name='NetStateRule', + full_name='caffe.NetStateRule', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='phase', full_name='caffe.NetStateRule.phase', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='min_level', full_name='caffe.NetStateRule.min_level', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_level', full_name='caffe.NetStateRule.max_level', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stage', full_name='caffe.NetStateRule.stage', index=3, + number=4, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='not_stage', full_name='caffe.NetStateRule.not_stage', index=4, + number=5, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2525, + serialized_end=2640, +) + + +_PARAMSPEC = _descriptor.Descriptor( + name='ParamSpec', + full_name='caffe.ParamSpec', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='caffe.ParamSpec.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='share_mode', full_name='caffe.ParamSpec.share_mode', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='lr_mult', full_name='caffe.ParamSpec.lr_mult', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='decay_mult', full_name='caffe.ParamSpec.decay_mult', index=3, + number=4, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _PARAMSPEC_DIMCHECKMODE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2643, + serialized_end=2806, +) + + +_LAYERPARAMETER = _descriptor.Descriptor( + name='LayerParameter', + full_name='caffe.LayerParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='caffe.LayerParameter.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='caffe.LayerParameter.type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bottom', full_name='caffe.LayerParameter.bottom', index=2, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='top', full_name='caffe.LayerParameter.top', index=3, + number=4, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='phase', full_name='caffe.LayerParameter.phase', index=4, + number=10, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='loss_weight', full_name='caffe.LayerParameter.loss_weight', index=5, + number=5, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='param', full_name='caffe.LayerParameter.param', index=6, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='blobs', full_name='caffe.LayerParameter.blobs', index=7, + number=7, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='propagate_down', full_name='caffe.LayerParameter.propagate_down', index=8, + number=11, type=8, cpp_type=7, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='include', full_name='caffe.LayerParameter.include', index=9, + number=8, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='exclude', full_name='caffe.LayerParameter.exclude', index=10, + number=9, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='transform_param', full_name='caffe.LayerParameter.transform_param', index=11, + number=100, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='loss_param', full_name='caffe.LayerParameter.loss_param', index=12, + number=101, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='accuracy_param', full_name='caffe.LayerParameter.accuracy_param', index=13, + number=102, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='argmax_param', full_name='caffe.LayerParameter.argmax_param', index=14, + number=103, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='batch_norm_param', full_name='caffe.LayerParameter.batch_norm_param', index=15, + number=139, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_param', full_name='caffe.LayerParameter.bias_param', index=16, + number=141, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='concat_param', full_name='caffe.LayerParameter.concat_param', index=17, + number=104, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='contrastive_loss_param', full_name='caffe.LayerParameter.contrastive_loss_param', index=18, + number=105, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='convolution_param', full_name='caffe.LayerParameter.convolution_param', index=19, + number=106, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='crop_param', full_name='caffe.LayerParameter.crop_param', index=20, + number=144, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data_param', full_name='caffe.LayerParameter.data_param', index=21, + number=107, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dropout_param', full_name='caffe.LayerParameter.dropout_param', index=22, + number=108, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dummy_data_param', full_name='caffe.LayerParameter.dummy_data_param', index=23, + number=109, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='eltwise_param', full_name='caffe.LayerParameter.eltwise_param', index=24, + number=110, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='elu_param', full_name='caffe.LayerParameter.elu_param', index=25, + number=140, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='embed_param', full_name='caffe.LayerParameter.embed_param', index=26, + number=137, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='exp_param', full_name='caffe.LayerParameter.exp_param', index=27, + number=111, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='flatten_param', full_name='caffe.LayerParameter.flatten_param', index=28, + number=135, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hdf5_data_param', full_name='caffe.LayerParameter.hdf5_data_param', index=29, + number=112, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hdf5_output_param', full_name='caffe.LayerParameter.hdf5_output_param', index=30, + number=113, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hinge_loss_param', full_name='caffe.LayerParameter.hinge_loss_param', index=31, + number=114, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='image_data_param', full_name='caffe.LayerParameter.image_data_param', index=32, + number=115, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='infogain_loss_param', full_name='caffe.LayerParameter.infogain_loss_param', index=33, + number=116, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='inner_product_param', full_name='caffe.LayerParameter.inner_product_param', index=34, + number=117, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input_param', full_name='caffe.LayerParameter.input_param', index=35, + number=143, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='log_param', full_name='caffe.LayerParameter.log_param', index=36, + number=134, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='lrn_param', full_name='caffe.LayerParameter.lrn_param', index=37, + number=118, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='memory_data_param', full_name='caffe.LayerParameter.memory_data_param', index=38, + number=119, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mvn_param', full_name='caffe.LayerParameter.mvn_param', index=39, + number=120, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_param', full_name='caffe.LayerParameter.parameter_param', index=40, + number=145, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pooling_param', full_name='caffe.LayerParameter.pooling_param', index=41, + number=121, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='power_param', full_name='caffe.LayerParameter.power_param', index=42, + number=122, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='prelu_param', full_name='caffe.LayerParameter.prelu_param', index=43, + number=131, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='python_param', full_name='caffe.LayerParameter.python_param', index=44, + number=130, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='recurrent_param', full_name='caffe.LayerParameter.recurrent_param', index=45, + number=146, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='reduction_param', full_name='caffe.LayerParameter.reduction_param', index=46, + number=136, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='relu_param', full_name='caffe.LayerParameter.relu_param', index=47, + number=123, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='reshape_param', full_name='caffe.LayerParameter.reshape_param', index=48, + number=133, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale_param', full_name='caffe.LayerParameter.scale_param', index=49, + number=142, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sigmoid_param', full_name='caffe.LayerParameter.sigmoid_param', index=50, + number=124, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='softmax_param', full_name='caffe.LayerParameter.softmax_param', index=51, + number=125, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='spp_param', full_name='caffe.LayerParameter.spp_param', index=52, + number=132, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='slice_param', full_name='caffe.LayerParameter.slice_param', index=53, + number=126, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tanh_param', full_name='caffe.LayerParameter.tanh_param', index=54, + number=127, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='threshold_param', full_name='caffe.LayerParameter.threshold_param', index=55, + number=128, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tile_param', full_name='caffe.LayerParameter.tile_param', index=56, + number=138, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='window_data_param', full_name='caffe.LayerParameter.window_data_param', index=57, + number=129, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2809, + serialized_end=5371, +) + + +_TRANSFORMATIONPARAMETER = _descriptor.Descriptor( + name='TransformationParameter', + full_name='caffe.TransformationParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.TransformationParameter.scale', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mirror', full_name='caffe.TransformationParameter.mirror', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='crop_size', full_name='caffe.TransformationParameter.crop_size', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mean_file', full_name='caffe.TransformationParameter.mean_file', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mean_value', full_name='caffe.TransformationParameter.mean_value', index=4, + number=5, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='force_color', full_name='caffe.TransformationParameter.force_color', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='force_gray', full_name='caffe.TransformationParameter.force_gray', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5374, + serialized_end=5556, +) + + +_LOSSPARAMETER = _descriptor.Descriptor( + name='LossParameter', + full_name='caffe.LossParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ignore_label', full_name='caffe.LossParameter.ignore_label', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='normalization', full_name='caffe.LossParameter.normalization', index=1, + number=3, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='normalize', full_name='caffe.LossParameter.normalize', index=2, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _LOSSPARAMETER_NORMALIZATIONMODE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5559, + serialized_end=5753, +) + + +_ACCURACYPARAMETER = _descriptor.Descriptor( + name='AccuracyParameter', + full_name='caffe.AccuracyParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='top_k', full_name='caffe.AccuracyParameter.top_k', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.AccuracyParameter.axis', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ignore_label', full_name='caffe.AccuracyParameter.ignore_label', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5755, + serialized_end=5831, +) + + +_ARGMAXPARAMETER = _descriptor.Descriptor( + name='ArgMaxParameter', + full_name='caffe.ArgMaxParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='out_max_val', full_name='caffe.ArgMaxParameter.out_max_val', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='top_k', full_name='caffe.ArgMaxParameter.top_k', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.ArgMaxParameter.axis', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5833, + serialized_end=5910, +) + + +_CONCATPARAMETER = _descriptor.Descriptor( + name='ConcatParameter', + full_name='caffe.ConcatParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.ConcatParameter.axis', index=0, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='concat_dim', full_name='caffe.ConcatParameter.concat_dim', index=1, + number=1, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5912, + serialized_end=5969, +) + + +_BATCHNORMPARAMETER = _descriptor.Descriptor( + name='BatchNormParameter', + full_name='caffe.BatchNormParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='use_global_stats', full_name='caffe.BatchNormParameter.use_global_stats', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='moving_average_fraction', full_name='caffe.BatchNormParameter.moving_average_fraction', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.999), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='eps', full_name='caffe.BatchNormParameter.eps', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1e-05), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=5971, + serialized_end=6077, +) + + +_BIASPARAMETER = _descriptor.Descriptor( + name='BiasParameter', + full_name='caffe.BiasParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.BiasParameter.axis', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num_axes', full_name='caffe.BiasParameter.num_axes', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='filler', full_name='caffe.BiasParameter.filler', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6079, + serialized_end=6172, +) + + +_CONTRASTIVELOSSPARAMETER = _descriptor.Descriptor( + name='ContrastiveLossParameter', + full_name='caffe.ContrastiveLossParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='margin', full_name='caffe.ContrastiveLossParameter.margin', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='legacy_version', full_name='caffe.ContrastiveLossParameter.legacy_version', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6174, + serialized_end=6250, +) + + +_CONVOLUTIONPARAMETER = _descriptor.Descriptor( + name='ConvolutionParameter', + full_name='caffe.ConvolutionParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='num_output', full_name='caffe.ConvolutionParameter.num_output', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_term', full_name='caffe.ConvolutionParameter.bias_term', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad', full_name='caffe.ConvolutionParameter.pad', index=2, + number=3, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernel_size', full_name='caffe.ConvolutionParameter.kernel_size', index=3, + number=4, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride', full_name='caffe.ConvolutionParameter.stride', index=4, + number=6, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dilation', full_name='caffe.ConvolutionParameter.dilation', index=5, + number=18, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad_h', full_name='caffe.ConvolutionParameter.pad_h', index=6, + number=9, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad_w', full_name='caffe.ConvolutionParameter.pad_w', index=7, + number=10, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernel_h', full_name='caffe.ConvolutionParameter.kernel_h', index=8, + number=11, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernel_w', full_name='caffe.ConvolutionParameter.kernel_w', index=9, + number=12, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride_h', full_name='caffe.ConvolutionParameter.stride_h', index=10, + number=13, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride_w', full_name='caffe.ConvolutionParameter.stride_w', index=11, + number=14, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='group', full_name='caffe.ConvolutionParameter.group', index=12, + number=5, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_filler', full_name='caffe.ConvolutionParameter.weight_filler', index=13, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_filler', full_name='caffe.ConvolutionParameter.bias_filler', index=14, + number=8, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.ConvolutionParameter.engine', index=15, + number=15, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.ConvolutionParameter.axis', index=16, + number=16, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='force_nd_im2col', full_name='caffe.ConvolutionParameter.force_nd_im2col', index=17, + number=17, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _CONVOLUTIONPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6253, + serialized_end=6761, +) + + +_CROPPARAMETER = _descriptor.Descriptor( + name='CropParameter', + full_name='caffe.CropParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.CropParameter.axis', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=2, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='offset', full_name='caffe.CropParameter.offset', index=1, + number=2, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6763, + serialized_end=6811, +) + + +_DATAPARAMETER = _descriptor.Descriptor( + name='DataParameter', + full_name='caffe.DataParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='source', full_name='caffe.DataParameter.source', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='batch_size', full_name='caffe.DataParameter.batch_size', index=1, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rand_skip', full_name='caffe.DataParameter.rand_skip', index=2, + number=7, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='backend', full_name='caffe.DataParameter.backend', index=3, + number=8, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.DataParameter.scale', index=4, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mean_file', full_name='caffe.DataParameter.mean_file', index=5, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='crop_size', full_name='caffe.DataParameter.crop_size', index=6, + number=5, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mirror', full_name='caffe.DataParameter.mirror', index=7, + number=6, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='force_encoded_color', full_name='caffe.DataParameter.force_encoded_color', index=8, + number=9, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='prefetch', full_name='caffe.DataParameter.prefetch', index=9, + number=10, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=4, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _DATAPARAMETER_DB, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=6814, + serialized_end=7106, +) + + +_DROPOUTPARAMETER = _descriptor.Descriptor( + name='DropoutParameter', + full_name='caffe.DropoutParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='dropout_ratio', full_name='caffe.DropoutParameter.dropout_ratio', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.5), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7108, + serialized_end=7154, +) + + +_DUMMYDATAPARAMETER = _descriptor.Descriptor( + name='DummyDataParameter', + full_name='caffe.DummyDataParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='data_filler', full_name='caffe.DummyDataParameter.data_filler', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shape', full_name='caffe.DummyDataParameter.shape', index=1, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num', full_name='caffe.DummyDataParameter.num', index=2, + number=2, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='channels', full_name='caffe.DummyDataParameter.channels', index=3, + number=3, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='height', full_name='caffe.DummyDataParameter.height', index=4, + number=4, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='width', full_name='caffe.DummyDataParameter.width', index=5, + number=5, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7157, + serialized_end=7317, +) + + +_ELTWISEPARAMETER = _descriptor.Descriptor( + name='EltwiseParameter', + full_name='caffe.EltwiseParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='operation', full_name='caffe.EltwiseParameter.operation', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='coeff', full_name='caffe.EltwiseParameter.coeff', index=1, + number=2, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stable_prod_grad', full_name='caffe.EltwiseParameter.stable_prod_grad', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _ELTWISEPARAMETER_ELTWISEOP, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7320, + serialized_end=7485, +) + + +_ELUPARAMETER = _descriptor.Descriptor( + name='ELUParameter', + full_name='caffe.ELUParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='alpha', full_name='caffe.ELUParameter.alpha', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7487, + serialized_end=7519, +) + + +_EMBEDPARAMETER = _descriptor.Descriptor( + name='EmbedParameter', + full_name='caffe.EmbedParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='num_output', full_name='caffe.EmbedParameter.num_output', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input_dim', full_name='caffe.EmbedParameter.input_dim', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_term', full_name='caffe.EmbedParameter.bias_term', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_filler', full_name='caffe.EmbedParameter.weight_filler', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_filler', full_name='caffe.EmbedParameter.bias_filler', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7522, + serialized_end=7694, +) + + +_EXPPARAMETER = _descriptor.Descriptor( + name='ExpParameter', + full_name='caffe.ExpParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='base', full_name='caffe.ExpParameter.base', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(-1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.ExpParameter.scale', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shift', full_name='caffe.ExpParameter.shift', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7696, + serialized_end=7764, +) + + +_FLATTENPARAMETER = _descriptor.Descriptor( + name='FlattenParameter', + full_name='caffe.FlattenParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.FlattenParameter.axis', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='end_axis', full_name='caffe.FlattenParameter.end_axis', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=-1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7766, + serialized_end=7823, +) + + +_HDF5DATAPARAMETER = _descriptor.Descriptor( + name='HDF5DataParameter', + full_name='caffe.HDF5DataParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='source', full_name='caffe.HDF5DataParameter.source', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='batch_size', full_name='caffe.HDF5DataParameter.batch_size', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shuffle', full_name='caffe.HDF5DataParameter.shuffle', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7825, + serialized_end=7904, +) + + +_HDF5OUTPUTPARAMETER = _descriptor.Descriptor( + name='HDF5OutputParameter', + full_name='caffe.HDF5OutputParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='file_name', full_name='caffe.HDF5OutputParameter.file_name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7906, + serialized_end=7946, +) + + +_HINGELOSSPARAMETER = _descriptor.Descriptor( + name='HingeLossParameter', + full_name='caffe.HingeLossParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='norm', full_name='caffe.HingeLossParameter.norm', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _HINGELOSSPARAMETER_NORM, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=7948, + serialized_end=8042, +) + + +_IMAGEDATAPARAMETER = _descriptor.Descriptor( + name='ImageDataParameter', + full_name='caffe.ImageDataParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='source', full_name='caffe.ImageDataParameter.source', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='batch_size', full_name='caffe.ImageDataParameter.batch_size', index=1, + number=4, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rand_skip', full_name='caffe.ImageDataParameter.rand_skip', index=2, + number=7, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shuffle', full_name='caffe.ImageDataParameter.shuffle', index=3, + number=8, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_height', full_name='caffe.ImageDataParameter.new_height', index=4, + number=9, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_width', full_name='caffe.ImageDataParameter.new_width', index=5, + number=10, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='is_color', full_name='caffe.ImageDataParameter.is_color', index=6, + number=11, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.ImageDataParameter.scale', index=7, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mean_file', full_name='caffe.ImageDataParameter.mean_file', index=8, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='crop_size', full_name='caffe.ImageDataParameter.crop_size', index=9, + number=5, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mirror', full_name='caffe.ImageDataParameter.mirror', index=10, + number=6, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='root_folder', full_name='caffe.ImageDataParameter.root_folder', index=11, + number=12, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=8045, + serialized_end=8324, +) + + +_INFOGAINLOSSPARAMETER = _descriptor.Descriptor( + name='InfogainLossParameter', + full_name='caffe.InfogainLossParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='source', full_name='caffe.InfogainLossParameter.source', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.InfogainLossParameter.axis', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=8326, + serialized_end=8382, +) + + +_INNERPRODUCTPARAMETER = _descriptor.Descriptor( + name='InnerProductParameter', + full_name='caffe.InnerProductParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='num_output', full_name='caffe.InnerProductParameter.num_output', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_term', full_name='caffe.InnerProductParameter.bias_term', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_filler', full_name='caffe.InnerProductParameter.weight_filler', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_filler', full_name='caffe.InnerProductParameter.bias_filler', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.InnerProductParameter.axis', index=4, + number=5, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='transpose', full_name='caffe.InnerProductParameter.transpose', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=8385, + serialized_end=8588, +) + + +_INPUTPARAMETER = _descriptor.Descriptor( + name='InputParameter', + full_name='caffe.InputParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='shape', full_name='caffe.InputParameter.shape', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=8590, + serialized_end=8639, +) + + +_LOGPARAMETER = _descriptor.Descriptor( + name='LogParameter', + full_name='caffe.LogParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='base', full_name='caffe.LogParameter.base', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(-1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.LogParameter.scale', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shift', full_name='caffe.LogParameter.shift', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=8641, + serialized_end=8709, +) + + +_LRNPARAMETER = _descriptor.Descriptor( + name='LRNParameter', + full_name='caffe.LRNParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='local_size', full_name='caffe.LRNParameter.local_size', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=5, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='alpha', full_name='caffe.LRNParameter.alpha', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='beta', full_name='caffe.LRNParameter.beta', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.75), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='norm_region', full_name='caffe.LRNParameter.norm_region', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='k', full_name='caffe.LRNParameter.k', index=4, + number=5, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.LRNParameter.engine', index=5, + number=6, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _LRNPARAMETER_NORMREGION, + _LRNPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=8712, + serialized_end=9024, +) + + +_MEMORYDATAPARAMETER = _descriptor.Descriptor( + name='MemoryDataParameter', + full_name='caffe.MemoryDataParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='batch_size', full_name='caffe.MemoryDataParameter.batch_size', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='channels', full_name='caffe.MemoryDataParameter.channels', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='height', full_name='caffe.MemoryDataParameter.height', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='width', full_name='caffe.MemoryDataParameter.width', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9026, + serialized_end=9116, +) + + +_MVNPARAMETER = _descriptor.Descriptor( + name='MVNParameter', + full_name='caffe.MVNParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='normalize_variance', full_name='caffe.MVNParameter.normalize_variance', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='across_channels', full_name='caffe.MVNParameter.across_channels', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='eps', full_name='caffe.MVNParameter.eps', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1e-09), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9118, + serialized_end=9218, +) + + +_PARAMETERPARAMETER = _descriptor.Descriptor( + name='ParameterParameter', + full_name='caffe.ParameterParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='shape', full_name='caffe.ParameterParameter.shape', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9220, + serialized_end=9273, +) + + +_POOLINGPARAMETER = _descriptor.Descriptor( + name='PoolingParameter', + full_name='caffe.PoolingParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='pool', full_name='caffe.PoolingParameter.pool', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad', full_name='caffe.PoolingParameter.pad', index=1, + number=4, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad_h', full_name='caffe.PoolingParameter.pad_h', index=2, + number=9, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad_w', full_name='caffe.PoolingParameter.pad_w', index=3, + number=10, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernel_size', full_name='caffe.PoolingParameter.kernel_size', index=4, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernel_h', full_name='caffe.PoolingParameter.kernel_h', index=5, + number=5, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernel_w', full_name='caffe.PoolingParameter.kernel_w', index=6, + number=6, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride', full_name='caffe.PoolingParameter.stride', index=7, + number=3, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride_h', full_name='caffe.PoolingParameter.stride_h', index=8, + number=7, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride_w', full_name='caffe.PoolingParameter.stride_w', index=9, + number=8, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.PoolingParameter.engine', index=10, + number=11, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='global_pooling', full_name='caffe.PoolingParameter.global_pooling', index=11, + number=12, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _POOLINGPARAMETER_POOLMETHOD, + _POOLINGPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9276, + serialized_end=9694, +) + + +_POWERPARAMETER = _descriptor.Descriptor( + name='PowerParameter', + full_name='caffe.PowerParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='power', full_name='caffe.PowerParameter.power', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.PowerParameter.scale', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shift', full_name='caffe.PowerParameter.shift', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9696, + serialized_end=9766, +) + + +_PYTHONPARAMETER = _descriptor.Descriptor( + name='PythonParameter', + full_name='caffe.PythonParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='module', full_name='caffe.PythonParameter.module', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='layer', full_name='caffe.PythonParameter.layer', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='param_str', full_name='caffe.PythonParameter.param_str', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='share_in_parallel', full_name='caffe.PythonParameter.share_in_parallel', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9768, + serialized_end=9871, +) + + +_RECURRENTPARAMETER = _descriptor.Descriptor( + name='RecurrentParameter', + full_name='caffe.RecurrentParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='num_output', full_name='caffe.RecurrentParameter.num_output', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_filler', full_name='caffe.RecurrentParameter.weight_filler', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_filler', full_name='caffe.RecurrentParameter.bias_filler', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='debug_info', full_name='caffe.RecurrentParameter.debug_info', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='expose_hidden', full_name='caffe.RecurrentParameter.expose_hidden', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=9874, + serialized_end=10066, +) + + +_REDUCTIONPARAMETER = _descriptor.Descriptor( + name='ReductionParameter', + full_name='caffe.ReductionParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='operation', full_name='caffe.ReductionParameter.operation', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.ReductionParameter.axis', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='coeff', full_name='caffe.ReductionParameter.coeff', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _REDUCTIONPARAMETER_REDUCTIONOP, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10069, + serialized_end=10242, +) + + +_RELUPARAMETER = _descriptor.Descriptor( + name='ReLUParameter', + full_name='caffe.ReLUParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='negative_slope', full_name='caffe.ReLUParameter.negative_slope', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.ReLUParameter.engine', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _RELUPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10245, + serialized_end=10386, +) + + +_RESHAPEPARAMETER = _descriptor.Descriptor( + name='ReshapeParameter', + full_name='caffe.ReshapeParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='shape', full_name='caffe.ReshapeParameter.shape', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.ReshapeParameter.axis', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num_axes', full_name='caffe.ReshapeParameter.num_axes', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=-1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10388, + serialized_end=10478, +) + + +_SCALEPARAMETER = _descriptor.Descriptor( + name='ScaleParameter', + full_name='caffe.ScaleParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.ScaleParameter.axis', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num_axes', full_name='caffe.ScaleParameter.num_axes', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='filler', full_name='caffe.ScaleParameter.filler', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_term', full_name='caffe.ScaleParameter.bias_term', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_filler', full_name='caffe.ScaleParameter.bias_filler', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10481, + serialized_end=10646, +) + + +_SIGMOIDPARAMETER = _descriptor.Descriptor( + name='SigmoidParameter', + full_name='caffe.SigmoidParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.SigmoidParameter.engine', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _SIGMOIDPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10648, + serialized_end=10768, +) + + +_SLICEPARAMETER = _descriptor.Descriptor( + name='SliceParameter', + full_name='caffe.SliceParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.SliceParameter.axis', index=0, + number=3, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='slice_point', full_name='caffe.SliceParameter.slice_point', index=1, + number=2, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='slice_dim', full_name='caffe.SliceParameter.slice_dim', index=2, + number=1, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10770, + serialized_end=10846, +) + + +_SOFTMAXPARAMETER = _descriptor.Descriptor( + name='SoftmaxParameter', + full_name='caffe.SoftmaxParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.SoftmaxParameter.engine', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.SoftmaxParameter.axis', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _SOFTMAXPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10849, + serialized_end=10986, +) + + +_TANHPARAMETER = _descriptor.Descriptor( + name='TanHParameter', + full_name='caffe.TanHParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.TanHParameter.engine', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _TANHPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=10988, + serialized_end=11102, +) + + +_TILEPARAMETER = _descriptor.Descriptor( + name='TileParameter', + full_name='caffe.TileParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='axis', full_name='caffe.TileParameter.axis', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tiles', full_name='caffe.TileParameter.tiles', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=11104, + serialized_end=11151, +) + + +_THRESHOLDPARAMETER = _descriptor.Descriptor( + name='ThresholdParameter', + full_name='caffe.ThresholdParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='threshold', full_name='caffe.ThresholdParameter.threshold', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=11153, + serialized_end=11195, +) + + +_WINDOWDATAPARAMETER = _descriptor.Descriptor( + name='WindowDataParameter', + full_name='caffe.WindowDataParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='source', full_name='caffe.WindowDataParameter.source', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.WindowDataParameter.scale', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mean_file', full_name='caffe.WindowDataParameter.mean_file', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='batch_size', full_name='caffe.WindowDataParameter.batch_size', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='crop_size', full_name='caffe.WindowDataParameter.crop_size', index=4, + number=5, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mirror', full_name='caffe.WindowDataParameter.mirror', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='fg_threshold', full_name='caffe.WindowDataParameter.fg_threshold', index=6, + number=7, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.5), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bg_threshold', full_name='caffe.WindowDataParameter.bg_threshold', index=7, + number=8, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.5), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='fg_fraction', full_name='caffe.WindowDataParameter.fg_fraction', index=8, + number=9, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.25), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='context_pad', full_name='caffe.WindowDataParameter.context_pad', index=9, + number=10, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='crop_mode', full_name='caffe.WindowDataParameter.crop_mode', index=10, + number=11, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("warp").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='cache_images', full_name='caffe.WindowDataParameter.cache_images', index=11, + number=12, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='root_folder', full_name='caffe.WindowDataParameter.root_folder', index=12, + number=13, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=11198, + serialized_end=11519, +) + + +_SPPPARAMETER = _descriptor.Descriptor( + name='SPPParameter', + full_name='caffe.SPPParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='pyramid_height', full_name='caffe.SPPParameter.pyramid_height', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pool', full_name='caffe.SPPParameter.pool', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='engine', full_name='caffe.SPPParameter.engine', index=2, + number=6, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _SPPPARAMETER_POOLMETHOD, + _SPPPARAMETER_ENGINE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=11522, + serialized_end=11757, +) + + +_V1LAYERPARAMETER = _descriptor.Descriptor( + name='V1LayerParameter', + full_name='caffe.V1LayerParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='bottom', full_name='caffe.V1LayerParameter.bottom', index=0, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='top', full_name='caffe.V1LayerParameter.top', index=1, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='caffe.V1LayerParameter.name', index=2, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='include', full_name='caffe.V1LayerParameter.include', index=3, + number=32, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='exclude', full_name='caffe.V1LayerParameter.exclude', index=4, + number=33, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='caffe.V1LayerParameter.type', index=5, + number=5, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='blobs', full_name='caffe.V1LayerParameter.blobs', index=6, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='param', full_name='caffe.V1LayerParameter.param', index=7, + number=1001, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='blob_share_mode', full_name='caffe.V1LayerParameter.blob_share_mode', index=8, + number=1002, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='blobs_lr', full_name='caffe.V1LayerParameter.blobs_lr', index=9, + number=7, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_decay', full_name='caffe.V1LayerParameter.weight_decay', index=10, + number=8, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='loss_weight', full_name='caffe.V1LayerParameter.loss_weight', index=11, + number=35, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='accuracy_param', full_name='caffe.V1LayerParameter.accuracy_param', index=12, + number=27, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='argmax_param', full_name='caffe.V1LayerParameter.argmax_param', index=13, + number=23, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='concat_param', full_name='caffe.V1LayerParameter.concat_param', index=14, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='contrastive_loss_param', full_name='caffe.V1LayerParameter.contrastive_loss_param', index=15, + number=40, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='convolution_param', full_name='caffe.V1LayerParameter.convolution_param', index=16, + number=10, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data_param', full_name='caffe.V1LayerParameter.data_param', index=17, + number=11, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dropout_param', full_name='caffe.V1LayerParameter.dropout_param', index=18, + number=12, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dummy_data_param', full_name='caffe.V1LayerParameter.dummy_data_param', index=19, + number=26, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='eltwise_param', full_name='caffe.V1LayerParameter.eltwise_param', index=20, + number=24, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='exp_param', full_name='caffe.V1LayerParameter.exp_param', index=21, + number=41, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hdf5_data_param', full_name='caffe.V1LayerParameter.hdf5_data_param', index=22, + number=13, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hdf5_output_param', full_name='caffe.V1LayerParameter.hdf5_output_param', index=23, + number=14, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hinge_loss_param', full_name='caffe.V1LayerParameter.hinge_loss_param', index=24, + number=29, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='image_data_param', full_name='caffe.V1LayerParameter.image_data_param', index=25, + number=15, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='infogain_loss_param', full_name='caffe.V1LayerParameter.infogain_loss_param', index=26, + number=16, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='inner_product_param', full_name='caffe.V1LayerParameter.inner_product_param', index=27, + number=17, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='lrn_param', full_name='caffe.V1LayerParameter.lrn_param', index=28, + number=18, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='memory_data_param', full_name='caffe.V1LayerParameter.memory_data_param', index=29, + number=22, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mvn_param', full_name='caffe.V1LayerParameter.mvn_param', index=30, + number=34, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pooling_param', full_name='caffe.V1LayerParameter.pooling_param', index=31, + number=19, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='power_param', full_name='caffe.V1LayerParameter.power_param', index=32, + number=21, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='relu_param', full_name='caffe.V1LayerParameter.relu_param', index=33, + number=30, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sigmoid_param', full_name='caffe.V1LayerParameter.sigmoid_param', index=34, + number=38, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='softmax_param', full_name='caffe.V1LayerParameter.softmax_param', index=35, + number=39, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='slice_param', full_name='caffe.V1LayerParameter.slice_param', index=36, + number=31, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tanh_param', full_name='caffe.V1LayerParameter.tanh_param', index=37, + number=37, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='threshold_param', full_name='caffe.V1LayerParameter.threshold_param', index=38, + number=25, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='window_data_param', full_name='caffe.V1LayerParameter.window_data_param', index=39, + number=20, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='transform_param', full_name='caffe.V1LayerParameter.transform_param', index=40, + number=36, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='loss_param', full_name='caffe.V1LayerParameter.loss_param', index=41, + number=42, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='layer', full_name='caffe.V1LayerParameter.layer', index=42, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _V1LAYERPARAMETER_LAYERTYPE, + _V1LAYERPARAMETER_DIMCHECKMODE, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=11760, + serialized_end=14288, +) + + +_V0LAYERPARAMETER = _descriptor.Descriptor( + name='V0LayerParameter', + full_name='caffe.V0LayerParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='caffe.V0LayerParameter.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='caffe.V0LayerParameter.type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num_output', full_name='caffe.V0LayerParameter.num_output', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='biasterm', full_name='caffe.V0LayerParameter.biasterm', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=True, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_filler', full_name='caffe.V0LayerParameter.weight_filler', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bias_filler', full_name='caffe.V0LayerParameter.bias_filler', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pad', full_name='caffe.V0LayerParameter.pad', index=6, + number=7, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='kernelsize', full_name='caffe.V0LayerParameter.kernelsize', index=7, + number=8, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='group', full_name='caffe.V0LayerParameter.group', index=8, + number=9, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='stride', full_name='caffe.V0LayerParameter.stride', index=9, + number=10, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pool', full_name='caffe.V0LayerParameter.pool', index=10, + number=11, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dropout_ratio', full_name='caffe.V0LayerParameter.dropout_ratio', index=11, + number=12, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.5), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='local_size', full_name='caffe.V0LayerParameter.local_size', index=12, + number=13, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=5, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='alpha', full_name='caffe.V0LayerParameter.alpha', index=13, + number=14, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='beta', full_name='caffe.V0LayerParameter.beta', index=14, + number=15, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.75), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='k', full_name='caffe.V0LayerParameter.k', index=15, + number=22, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='source', full_name='caffe.V0LayerParameter.source', index=16, + number=16, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='caffe.V0LayerParameter.scale', index=17, + number=17, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(1), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='meanfile', full_name='caffe.V0LayerParameter.meanfile', index=18, + number=18, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='batchsize', full_name='caffe.V0LayerParameter.batchsize', index=19, + number=19, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='cropsize', full_name='caffe.V0LayerParameter.cropsize', index=20, + number=20, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mirror', full_name='caffe.V0LayerParameter.mirror', index=21, + number=21, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='blobs', full_name='caffe.V0LayerParameter.blobs', index=22, + number=50, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='blobs_lr', full_name='caffe.V0LayerParameter.blobs_lr', index=23, + number=51, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='weight_decay', full_name='caffe.V0LayerParameter.weight_decay', index=24, + number=52, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rand_skip', full_name='caffe.V0LayerParameter.rand_skip', index=25, + number=53, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='det_fg_threshold', full_name='caffe.V0LayerParameter.det_fg_threshold', index=26, + number=54, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.5), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='det_bg_threshold', full_name='caffe.V0LayerParameter.det_bg_threshold', index=27, + number=55, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.5), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='det_fg_fraction', full_name='caffe.V0LayerParameter.det_fg_fraction', index=28, + number=56, type=2, cpp_type=6, label=1, + has_default_value=True, default_value=float(0.25), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='det_context_pad', full_name='caffe.V0LayerParameter.det_context_pad', index=29, + number=58, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='det_crop_mode', full_name='caffe.V0LayerParameter.det_crop_mode', index=30, + number=59, type=9, cpp_type=9, label=1, + has_default_value=True, default_value=_b("warp").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_num', full_name='caffe.V0LayerParameter.new_num', index=31, + number=60, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_channels', full_name='caffe.V0LayerParameter.new_channels', index=32, + number=61, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_height', full_name='caffe.V0LayerParameter.new_height', index=33, + number=62, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_width', full_name='caffe.V0LayerParameter.new_width', index=34, + number=63, type=5, cpp_type=1, label=1, + has_default_value=True, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shuffle_images', full_name='caffe.V0LayerParameter.shuffle_images', index=35, + number=64, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='concat_dim', full_name='caffe.V0LayerParameter.concat_dim', index=36, + number=65, type=13, cpp_type=3, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hdf5_output_param', full_name='caffe.V0LayerParameter.hdf5_output_param', index=37, + number=1001, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _V0LAYERPARAMETER_POOLMETHOD, + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=14291, + serialized_end=15312, +) + + +_PRELUPARAMETER = _descriptor.Descriptor( + name='PReLUParameter', + full_name='caffe.PReLUParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='filler', full_name='caffe.PReLUParameter.filler', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='channel_shared', full_name='caffe.PReLUParameter.channel_shared', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=True, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=15314, + serialized_end=15401, +) + +_BLOBPROTO.fields_by_name['shape'].message_type = _BLOBSHAPE +_BLOBPROTOVECTOR.fields_by_name['blobs'].message_type = _BLOBPROTO +_FILLERPARAMETER.fields_by_name['variance_norm'].enum_type = _FILLERPARAMETER_VARIANCENORM +_FILLERPARAMETER_VARIANCENORM.containing_type = _FILLERPARAMETER +_NETPARAMETER.fields_by_name['input_shape'].message_type = _BLOBSHAPE +_NETPARAMETER.fields_by_name['state'].message_type = _NETSTATE +_NETPARAMETER.fields_by_name['layer'].message_type = _LAYERPARAMETER +_NETPARAMETER.fields_by_name['layers'].message_type = _V1LAYERPARAMETER +_SOLVERPARAMETER.fields_by_name['net_param'].message_type = _NETPARAMETER +_SOLVERPARAMETER.fields_by_name['train_net_param'].message_type = _NETPARAMETER +_SOLVERPARAMETER.fields_by_name['test_net_param'].message_type = _NETPARAMETER +_SOLVERPARAMETER.fields_by_name['train_state'].message_type = _NETSTATE +_SOLVERPARAMETER.fields_by_name['test_state'].message_type = _NETSTATE +_SOLVERPARAMETER.fields_by_name['snapshot_format'].enum_type = _SOLVERPARAMETER_SNAPSHOTFORMAT +_SOLVERPARAMETER.fields_by_name['solver_mode'].enum_type = _SOLVERPARAMETER_SOLVERMODE +_SOLVERPARAMETER.fields_by_name['solver_type'].enum_type = _SOLVERPARAMETER_SOLVERTYPE +_SOLVERPARAMETER_SNAPSHOTFORMAT.containing_type = _SOLVERPARAMETER +_SOLVERPARAMETER_SOLVERMODE.containing_type = _SOLVERPARAMETER +_SOLVERPARAMETER_SOLVERTYPE.containing_type = _SOLVERPARAMETER +_SOLVERSTATE.fields_by_name['history'].message_type = _BLOBPROTO +_NETSTATE.fields_by_name['phase'].enum_type = _PHASE +_NETSTATERULE.fields_by_name['phase'].enum_type = _PHASE +_PARAMSPEC.fields_by_name['share_mode'].enum_type = _PARAMSPEC_DIMCHECKMODE +_PARAMSPEC_DIMCHECKMODE.containing_type = _PARAMSPEC +_LAYERPARAMETER.fields_by_name['phase'].enum_type = _PHASE +_LAYERPARAMETER.fields_by_name['param'].message_type = _PARAMSPEC +_LAYERPARAMETER.fields_by_name['blobs'].message_type = _BLOBPROTO +_LAYERPARAMETER.fields_by_name['include'].message_type = _NETSTATERULE +_LAYERPARAMETER.fields_by_name['exclude'].message_type = _NETSTATERULE +_LAYERPARAMETER.fields_by_name['transform_param'].message_type = _TRANSFORMATIONPARAMETER +_LAYERPARAMETER.fields_by_name['loss_param'].message_type = _LOSSPARAMETER +_LAYERPARAMETER.fields_by_name['accuracy_param'].message_type = _ACCURACYPARAMETER +_LAYERPARAMETER.fields_by_name['argmax_param'].message_type = _ARGMAXPARAMETER +_LAYERPARAMETER.fields_by_name['batch_norm_param'].message_type = _BATCHNORMPARAMETER +_LAYERPARAMETER.fields_by_name['bias_param'].message_type = _BIASPARAMETER +_LAYERPARAMETER.fields_by_name['concat_param'].message_type = _CONCATPARAMETER +_LAYERPARAMETER.fields_by_name['contrastive_loss_param'].message_type = _CONTRASTIVELOSSPARAMETER +_LAYERPARAMETER.fields_by_name['convolution_param'].message_type = _CONVOLUTIONPARAMETER +_LAYERPARAMETER.fields_by_name['crop_param'].message_type = _CROPPARAMETER +_LAYERPARAMETER.fields_by_name['data_param'].message_type = _DATAPARAMETER +_LAYERPARAMETER.fields_by_name['dropout_param'].message_type = _DROPOUTPARAMETER +_LAYERPARAMETER.fields_by_name['dummy_data_param'].message_type = _DUMMYDATAPARAMETER +_LAYERPARAMETER.fields_by_name['eltwise_param'].message_type = _ELTWISEPARAMETER +_LAYERPARAMETER.fields_by_name['elu_param'].message_type = _ELUPARAMETER +_LAYERPARAMETER.fields_by_name['embed_param'].message_type = _EMBEDPARAMETER +_LAYERPARAMETER.fields_by_name['exp_param'].message_type = _EXPPARAMETER +_LAYERPARAMETER.fields_by_name['flatten_param'].message_type = _FLATTENPARAMETER +_LAYERPARAMETER.fields_by_name['hdf5_data_param'].message_type = _HDF5DATAPARAMETER +_LAYERPARAMETER.fields_by_name['hdf5_output_param'].message_type = _HDF5OUTPUTPARAMETER +_LAYERPARAMETER.fields_by_name['hinge_loss_param'].message_type = _HINGELOSSPARAMETER +_LAYERPARAMETER.fields_by_name['image_data_param'].message_type = _IMAGEDATAPARAMETER +_LAYERPARAMETER.fields_by_name['infogain_loss_param'].message_type = _INFOGAINLOSSPARAMETER +_LAYERPARAMETER.fields_by_name['inner_product_param'].message_type = _INNERPRODUCTPARAMETER +_LAYERPARAMETER.fields_by_name['input_param'].message_type = _INPUTPARAMETER +_LAYERPARAMETER.fields_by_name['log_param'].message_type = _LOGPARAMETER +_LAYERPARAMETER.fields_by_name['lrn_param'].message_type = _LRNPARAMETER +_LAYERPARAMETER.fields_by_name['memory_data_param'].message_type = _MEMORYDATAPARAMETER +_LAYERPARAMETER.fields_by_name['mvn_param'].message_type = _MVNPARAMETER +_LAYERPARAMETER.fields_by_name['parameter_param'].message_type = _PARAMETERPARAMETER +_LAYERPARAMETER.fields_by_name['pooling_param'].message_type = _POOLINGPARAMETER +_LAYERPARAMETER.fields_by_name['power_param'].message_type = _POWERPARAMETER +_LAYERPARAMETER.fields_by_name['prelu_param'].message_type = _PRELUPARAMETER +_LAYERPARAMETER.fields_by_name['python_param'].message_type = _PYTHONPARAMETER +_LAYERPARAMETER.fields_by_name['recurrent_param'].message_type = _RECURRENTPARAMETER +_LAYERPARAMETER.fields_by_name['reduction_param'].message_type = _REDUCTIONPARAMETER +_LAYERPARAMETER.fields_by_name['relu_param'].message_type = _RELUPARAMETER +_LAYERPARAMETER.fields_by_name['reshape_param'].message_type = _RESHAPEPARAMETER +_LAYERPARAMETER.fields_by_name['scale_param'].message_type = _SCALEPARAMETER +_LAYERPARAMETER.fields_by_name['sigmoid_param'].message_type = _SIGMOIDPARAMETER +_LAYERPARAMETER.fields_by_name['softmax_param'].message_type = _SOFTMAXPARAMETER +_LAYERPARAMETER.fields_by_name['spp_param'].message_type = _SPPPARAMETER +_LAYERPARAMETER.fields_by_name['slice_param'].message_type = _SLICEPARAMETER +_LAYERPARAMETER.fields_by_name['tanh_param'].message_type = _TANHPARAMETER +_LAYERPARAMETER.fields_by_name['threshold_param'].message_type = _THRESHOLDPARAMETER +_LAYERPARAMETER.fields_by_name['tile_param'].message_type = _TILEPARAMETER +_LAYERPARAMETER.fields_by_name['window_data_param'].message_type = _WINDOWDATAPARAMETER +_LOSSPARAMETER.fields_by_name['normalization'].enum_type = _LOSSPARAMETER_NORMALIZATIONMODE +_LOSSPARAMETER_NORMALIZATIONMODE.containing_type = _LOSSPARAMETER +_BIASPARAMETER.fields_by_name['filler'].message_type = _FILLERPARAMETER +_CONVOLUTIONPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER +_CONVOLUTIONPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER +_CONVOLUTIONPARAMETER.fields_by_name['engine'].enum_type = _CONVOLUTIONPARAMETER_ENGINE +_CONVOLUTIONPARAMETER_ENGINE.containing_type = _CONVOLUTIONPARAMETER +_DATAPARAMETER.fields_by_name['backend'].enum_type = _DATAPARAMETER_DB +_DATAPARAMETER_DB.containing_type = _DATAPARAMETER +_DUMMYDATAPARAMETER.fields_by_name['data_filler'].message_type = _FILLERPARAMETER +_DUMMYDATAPARAMETER.fields_by_name['shape'].message_type = _BLOBSHAPE +_ELTWISEPARAMETER.fields_by_name['operation'].enum_type = _ELTWISEPARAMETER_ELTWISEOP +_ELTWISEPARAMETER_ELTWISEOP.containing_type = _ELTWISEPARAMETER +_EMBEDPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER +_EMBEDPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER +_HINGELOSSPARAMETER.fields_by_name['norm'].enum_type = _HINGELOSSPARAMETER_NORM +_HINGELOSSPARAMETER_NORM.containing_type = _HINGELOSSPARAMETER +_INNERPRODUCTPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER +_INNERPRODUCTPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER +_INPUTPARAMETER.fields_by_name['shape'].message_type = _BLOBSHAPE +_LRNPARAMETER.fields_by_name['norm_region'].enum_type = _LRNPARAMETER_NORMREGION +_LRNPARAMETER.fields_by_name['engine'].enum_type = _LRNPARAMETER_ENGINE +_LRNPARAMETER_NORMREGION.containing_type = _LRNPARAMETER +_LRNPARAMETER_ENGINE.containing_type = _LRNPARAMETER +_PARAMETERPARAMETER.fields_by_name['shape'].message_type = _BLOBSHAPE +_POOLINGPARAMETER.fields_by_name['pool'].enum_type = _POOLINGPARAMETER_POOLMETHOD +_POOLINGPARAMETER.fields_by_name['engine'].enum_type = _POOLINGPARAMETER_ENGINE +_POOLINGPARAMETER_POOLMETHOD.containing_type = _POOLINGPARAMETER +_POOLINGPARAMETER_ENGINE.containing_type = _POOLINGPARAMETER +_RECURRENTPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER +_RECURRENTPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER +_REDUCTIONPARAMETER.fields_by_name['operation'].enum_type = _REDUCTIONPARAMETER_REDUCTIONOP +_REDUCTIONPARAMETER_REDUCTIONOP.containing_type = _REDUCTIONPARAMETER +_RELUPARAMETER.fields_by_name['engine'].enum_type = _RELUPARAMETER_ENGINE +_RELUPARAMETER_ENGINE.containing_type = _RELUPARAMETER +_RESHAPEPARAMETER.fields_by_name['shape'].message_type = _BLOBSHAPE +_SCALEPARAMETER.fields_by_name['filler'].message_type = _FILLERPARAMETER +_SCALEPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER +_SIGMOIDPARAMETER.fields_by_name['engine'].enum_type = _SIGMOIDPARAMETER_ENGINE +_SIGMOIDPARAMETER_ENGINE.containing_type = _SIGMOIDPARAMETER +_SOFTMAXPARAMETER.fields_by_name['engine'].enum_type = _SOFTMAXPARAMETER_ENGINE +_SOFTMAXPARAMETER_ENGINE.containing_type = _SOFTMAXPARAMETER +_TANHPARAMETER.fields_by_name['engine'].enum_type = _TANHPARAMETER_ENGINE +_TANHPARAMETER_ENGINE.containing_type = _TANHPARAMETER +_SPPPARAMETER.fields_by_name['pool'].enum_type = _SPPPARAMETER_POOLMETHOD +_SPPPARAMETER.fields_by_name['engine'].enum_type = _SPPPARAMETER_ENGINE +_SPPPARAMETER_POOLMETHOD.containing_type = _SPPPARAMETER +_SPPPARAMETER_ENGINE.containing_type = _SPPPARAMETER +_V1LAYERPARAMETER.fields_by_name['include'].message_type = _NETSTATERULE +_V1LAYERPARAMETER.fields_by_name['exclude'].message_type = _NETSTATERULE +_V1LAYERPARAMETER.fields_by_name['type'].enum_type = _V1LAYERPARAMETER_LAYERTYPE +_V1LAYERPARAMETER.fields_by_name['blobs'].message_type = _BLOBPROTO +_V1LAYERPARAMETER.fields_by_name['blob_share_mode'].enum_type = _V1LAYERPARAMETER_DIMCHECKMODE +_V1LAYERPARAMETER.fields_by_name['accuracy_param'].message_type = _ACCURACYPARAMETER +_V1LAYERPARAMETER.fields_by_name['argmax_param'].message_type = _ARGMAXPARAMETER +_V1LAYERPARAMETER.fields_by_name['concat_param'].message_type = _CONCATPARAMETER +_V1LAYERPARAMETER.fields_by_name['contrastive_loss_param'].message_type = _CONTRASTIVELOSSPARAMETER +_V1LAYERPARAMETER.fields_by_name['convolution_param'].message_type = _CONVOLUTIONPARAMETER +_V1LAYERPARAMETER.fields_by_name['data_param'].message_type = _DATAPARAMETER +_V1LAYERPARAMETER.fields_by_name['dropout_param'].message_type = _DROPOUTPARAMETER +_V1LAYERPARAMETER.fields_by_name['dummy_data_param'].message_type = _DUMMYDATAPARAMETER +_V1LAYERPARAMETER.fields_by_name['eltwise_param'].message_type = _ELTWISEPARAMETER +_V1LAYERPARAMETER.fields_by_name['exp_param'].message_type = _EXPPARAMETER +_V1LAYERPARAMETER.fields_by_name['hdf5_data_param'].message_type = _HDF5DATAPARAMETER +_V1LAYERPARAMETER.fields_by_name['hdf5_output_param'].message_type = _HDF5OUTPUTPARAMETER +_V1LAYERPARAMETER.fields_by_name['hinge_loss_param'].message_type = _HINGELOSSPARAMETER +_V1LAYERPARAMETER.fields_by_name['image_data_param'].message_type = _IMAGEDATAPARAMETER +_V1LAYERPARAMETER.fields_by_name['infogain_loss_param'].message_type = _INFOGAINLOSSPARAMETER +_V1LAYERPARAMETER.fields_by_name['inner_product_param'].message_type = _INNERPRODUCTPARAMETER +_V1LAYERPARAMETER.fields_by_name['lrn_param'].message_type = _LRNPARAMETER +_V1LAYERPARAMETER.fields_by_name['memory_data_param'].message_type = _MEMORYDATAPARAMETER +_V1LAYERPARAMETER.fields_by_name['mvn_param'].message_type = _MVNPARAMETER +_V1LAYERPARAMETER.fields_by_name['pooling_param'].message_type = _POOLINGPARAMETER +_V1LAYERPARAMETER.fields_by_name['power_param'].message_type = _POWERPARAMETER +_V1LAYERPARAMETER.fields_by_name['relu_param'].message_type = _RELUPARAMETER +_V1LAYERPARAMETER.fields_by_name['sigmoid_param'].message_type = _SIGMOIDPARAMETER +_V1LAYERPARAMETER.fields_by_name['softmax_param'].message_type = _SOFTMAXPARAMETER +_V1LAYERPARAMETER.fields_by_name['slice_param'].message_type = _SLICEPARAMETER +_V1LAYERPARAMETER.fields_by_name['tanh_param'].message_type = _TANHPARAMETER +_V1LAYERPARAMETER.fields_by_name['threshold_param'].message_type = _THRESHOLDPARAMETER +_V1LAYERPARAMETER.fields_by_name['window_data_param'].message_type = _WINDOWDATAPARAMETER +_V1LAYERPARAMETER.fields_by_name['transform_param'].message_type = _TRANSFORMATIONPARAMETER +_V1LAYERPARAMETER.fields_by_name['loss_param'].message_type = _LOSSPARAMETER +_V1LAYERPARAMETER.fields_by_name['layer'].message_type = _V0LAYERPARAMETER +_V1LAYERPARAMETER_LAYERTYPE.containing_type = _V1LAYERPARAMETER +_V1LAYERPARAMETER_DIMCHECKMODE.containing_type = _V1LAYERPARAMETER +_V0LAYERPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER +_V0LAYERPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER +_V0LAYERPARAMETER.fields_by_name['pool'].enum_type = _V0LAYERPARAMETER_POOLMETHOD +_V0LAYERPARAMETER.fields_by_name['blobs'].message_type = _BLOBPROTO +_V0LAYERPARAMETER.fields_by_name['hdf5_output_param'].message_type = _HDF5OUTPUTPARAMETER +_V0LAYERPARAMETER_POOLMETHOD.containing_type = _V0LAYERPARAMETER +_PRELUPARAMETER.fields_by_name['filler'].message_type = _FILLERPARAMETER +DESCRIPTOR.message_types_by_name['BlobShape'] = _BLOBSHAPE +DESCRIPTOR.message_types_by_name['BlobProto'] = _BLOBPROTO +DESCRIPTOR.message_types_by_name['BlobProtoVector'] = _BLOBPROTOVECTOR +DESCRIPTOR.message_types_by_name['Datum'] = _DATUM +DESCRIPTOR.message_types_by_name['FillerParameter'] = _FILLERPARAMETER +DESCRIPTOR.message_types_by_name['NetParameter'] = _NETPARAMETER +DESCRIPTOR.message_types_by_name['SolverParameter'] = _SOLVERPARAMETER +DESCRIPTOR.message_types_by_name['SolverState'] = _SOLVERSTATE +DESCRIPTOR.message_types_by_name['NetState'] = _NETSTATE +DESCRIPTOR.message_types_by_name['NetStateRule'] = _NETSTATERULE +DESCRIPTOR.message_types_by_name['ParamSpec'] = _PARAMSPEC +DESCRIPTOR.message_types_by_name['LayerParameter'] = _LAYERPARAMETER +DESCRIPTOR.message_types_by_name['TransformationParameter'] = _TRANSFORMATIONPARAMETER +DESCRIPTOR.message_types_by_name['LossParameter'] = _LOSSPARAMETER +DESCRIPTOR.message_types_by_name['AccuracyParameter'] = _ACCURACYPARAMETER +DESCRIPTOR.message_types_by_name['ArgMaxParameter'] = _ARGMAXPARAMETER +DESCRIPTOR.message_types_by_name['ConcatParameter'] = _CONCATPARAMETER +DESCRIPTOR.message_types_by_name['BatchNormParameter'] = _BATCHNORMPARAMETER +DESCRIPTOR.message_types_by_name['BiasParameter'] = _BIASPARAMETER +DESCRIPTOR.message_types_by_name['ContrastiveLossParameter'] = _CONTRASTIVELOSSPARAMETER +DESCRIPTOR.message_types_by_name['ConvolutionParameter'] = _CONVOLUTIONPARAMETER +DESCRIPTOR.message_types_by_name['CropParameter'] = _CROPPARAMETER +DESCRIPTOR.message_types_by_name['DataParameter'] = _DATAPARAMETER +DESCRIPTOR.message_types_by_name['DropoutParameter'] = _DROPOUTPARAMETER +DESCRIPTOR.message_types_by_name['DummyDataParameter'] = _DUMMYDATAPARAMETER +DESCRIPTOR.message_types_by_name['EltwiseParameter'] = _ELTWISEPARAMETER +DESCRIPTOR.message_types_by_name['ELUParameter'] = _ELUPARAMETER +DESCRIPTOR.message_types_by_name['EmbedParameter'] = _EMBEDPARAMETER +DESCRIPTOR.message_types_by_name['ExpParameter'] = _EXPPARAMETER +DESCRIPTOR.message_types_by_name['FlattenParameter'] = _FLATTENPARAMETER +DESCRIPTOR.message_types_by_name['HDF5DataParameter'] = _HDF5DATAPARAMETER +DESCRIPTOR.message_types_by_name['HDF5OutputParameter'] = _HDF5OUTPUTPARAMETER +DESCRIPTOR.message_types_by_name['HingeLossParameter'] = _HINGELOSSPARAMETER +DESCRIPTOR.message_types_by_name['ImageDataParameter'] = _IMAGEDATAPARAMETER +DESCRIPTOR.message_types_by_name['InfogainLossParameter'] = _INFOGAINLOSSPARAMETER +DESCRIPTOR.message_types_by_name['InnerProductParameter'] = _INNERPRODUCTPARAMETER +DESCRIPTOR.message_types_by_name['InputParameter'] = _INPUTPARAMETER +DESCRIPTOR.message_types_by_name['LogParameter'] = _LOGPARAMETER +DESCRIPTOR.message_types_by_name['LRNParameter'] = _LRNPARAMETER +DESCRIPTOR.message_types_by_name['MemoryDataParameter'] = _MEMORYDATAPARAMETER +DESCRIPTOR.message_types_by_name['MVNParameter'] = _MVNPARAMETER +DESCRIPTOR.message_types_by_name['ParameterParameter'] = _PARAMETERPARAMETER +DESCRIPTOR.message_types_by_name['PoolingParameter'] = _POOLINGPARAMETER +DESCRIPTOR.message_types_by_name['PowerParameter'] = _POWERPARAMETER +DESCRIPTOR.message_types_by_name['PythonParameter'] = _PYTHONPARAMETER +DESCRIPTOR.message_types_by_name['RecurrentParameter'] = _RECURRENTPARAMETER +DESCRIPTOR.message_types_by_name['ReductionParameter'] = _REDUCTIONPARAMETER +DESCRIPTOR.message_types_by_name['ReLUParameter'] = _RELUPARAMETER +DESCRIPTOR.message_types_by_name['ReshapeParameter'] = _RESHAPEPARAMETER +DESCRIPTOR.message_types_by_name['ScaleParameter'] = _SCALEPARAMETER +DESCRIPTOR.message_types_by_name['SigmoidParameter'] = _SIGMOIDPARAMETER +DESCRIPTOR.message_types_by_name['SliceParameter'] = _SLICEPARAMETER +DESCRIPTOR.message_types_by_name['SoftmaxParameter'] = _SOFTMAXPARAMETER +DESCRIPTOR.message_types_by_name['TanHParameter'] = _TANHPARAMETER +DESCRIPTOR.message_types_by_name['TileParameter'] = _TILEPARAMETER +DESCRIPTOR.message_types_by_name['ThresholdParameter'] = _THRESHOLDPARAMETER +DESCRIPTOR.message_types_by_name['WindowDataParameter'] = _WINDOWDATAPARAMETER +DESCRIPTOR.message_types_by_name['SPPParameter'] = _SPPPARAMETER +DESCRIPTOR.message_types_by_name['V1LayerParameter'] = _V1LAYERPARAMETER +DESCRIPTOR.message_types_by_name['V0LayerParameter'] = _V0LAYERPARAMETER +DESCRIPTOR.message_types_by_name['PReLUParameter'] = _PRELUPARAMETER +DESCRIPTOR.enum_types_by_name['Phase'] = _PHASE + +BlobShape = _reflection.GeneratedProtocolMessageType('BlobShape', (_message.Message,), dict( + DESCRIPTOR = _BLOBSHAPE, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.BlobShape) + )) +_sym_db.RegisterMessage(BlobShape) + +BlobProto = _reflection.GeneratedProtocolMessageType('BlobProto', (_message.Message,), dict( + DESCRIPTOR = _BLOBPROTO, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.BlobProto) + )) +_sym_db.RegisterMessage(BlobProto) + +BlobProtoVector = _reflection.GeneratedProtocolMessageType('BlobProtoVector', (_message.Message,), dict( + DESCRIPTOR = _BLOBPROTOVECTOR, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.BlobProtoVector) + )) +_sym_db.RegisterMessage(BlobProtoVector) + +Datum = _reflection.GeneratedProtocolMessageType('Datum', (_message.Message,), dict( + DESCRIPTOR = _DATUM, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.Datum) + )) +_sym_db.RegisterMessage(Datum) + +FillerParameter = _reflection.GeneratedProtocolMessageType('FillerParameter', (_message.Message,), dict( + DESCRIPTOR = _FILLERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.FillerParameter) + )) +_sym_db.RegisterMessage(FillerParameter) + +NetParameter = _reflection.GeneratedProtocolMessageType('NetParameter', (_message.Message,), dict( + DESCRIPTOR = _NETPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.NetParameter) + )) +_sym_db.RegisterMessage(NetParameter) + +SolverParameter = _reflection.GeneratedProtocolMessageType('SolverParameter', (_message.Message,), dict( + DESCRIPTOR = _SOLVERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.SolverParameter) + )) +_sym_db.RegisterMessage(SolverParameter) + +SolverState = _reflection.GeneratedProtocolMessageType('SolverState', (_message.Message,), dict( + DESCRIPTOR = _SOLVERSTATE, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.SolverState) + )) +_sym_db.RegisterMessage(SolverState) + +NetState = _reflection.GeneratedProtocolMessageType('NetState', (_message.Message,), dict( + DESCRIPTOR = _NETSTATE, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.NetState) + )) +_sym_db.RegisterMessage(NetState) + +NetStateRule = _reflection.GeneratedProtocolMessageType('NetStateRule', (_message.Message,), dict( + DESCRIPTOR = _NETSTATERULE, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.NetStateRule) + )) +_sym_db.RegisterMessage(NetStateRule) + +ParamSpec = _reflection.GeneratedProtocolMessageType('ParamSpec', (_message.Message,), dict( + DESCRIPTOR = _PARAMSPEC, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ParamSpec) + )) +_sym_db.RegisterMessage(ParamSpec) + +LayerParameter = _reflection.GeneratedProtocolMessageType('LayerParameter', (_message.Message,), dict( + DESCRIPTOR = _LAYERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.LayerParameter) + )) +_sym_db.RegisterMessage(LayerParameter) + +TransformationParameter = _reflection.GeneratedProtocolMessageType('TransformationParameter', (_message.Message,), dict( + DESCRIPTOR = _TRANSFORMATIONPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.TransformationParameter) + )) +_sym_db.RegisterMessage(TransformationParameter) + +LossParameter = _reflection.GeneratedProtocolMessageType('LossParameter', (_message.Message,), dict( + DESCRIPTOR = _LOSSPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.LossParameter) + )) +_sym_db.RegisterMessage(LossParameter) + +AccuracyParameter = _reflection.GeneratedProtocolMessageType('AccuracyParameter', (_message.Message,), dict( + DESCRIPTOR = _ACCURACYPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.AccuracyParameter) + )) +_sym_db.RegisterMessage(AccuracyParameter) + +ArgMaxParameter = _reflection.GeneratedProtocolMessageType('ArgMaxParameter', (_message.Message,), dict( + DESCRIPTOR = _ARGMAXPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ArgMaxParameter) + )) +_sym_db.RegisterMessage(ArgMaxParameter) + +ConcatParameter = _reflection.GeneratedProtocolMessageType('ConcatParameter', (_message.Message,), dict( + DESCRIPTOR = _CONCATPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ConcatParameter) + )) +_sym_db.RegisterMessage(ConcatParameter) + +BatchNormParameter = _reflection.GeneratedProtocolMessageType('BatchNormParameter', (_message.Message,), dict( + DESCRIPTOR = _BATCHNORMPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.BatchNormParameter) + )) +_sym_db.RegisterMessage(BatchNormParameter) + +BiasParameter = _reflection.GeneratedProtocolMessageType('BiasParameter', (_message.Message,), dict( + DESCRIPTOR = _BIASPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.BiasParameter) + )) +_sym_db.RegisterMessage(BiasParameter) + +ContrastiveLossParameter = _reflection.GeneratedProtocolMessageType('ContrastiveLossParameter', (_message.Message,), dict( + DESCRIPTOR = _CONTRASTIVELOSSPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ContrastiveLossParameter) + )) +_sym_db.RegisterMessage(ContrastiveLossParameter) + +ConvolutionParameter = _reflection.GeneratedProtocolMessageType('ConvolutionParameter', (_message.Message,), dict( + DESCRIPTOR = _CONVOLUTIONPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ConvolutionParameter) + )) +_sym_db.RegisterMessage(ConvolutionParameter) + +CropParameter = _reflection.GeneratedProtocolMessageType('CropParameter', (_message.Message,), dict( + DESCRIPTOR = _CROPPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.CropParameter) + )) +_sym_db.RegisterMessage(CropParameter) + +DataParameter = _reflection.GeneratedProtocolMessageType('DataParameter', (_message.Message,), dict( + DESCRIPTOR = _DATAPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.DataParameter) + )) +_sym_db.RegisterMessage(DataParameter) + +DropoutParameter = _reflection.GeneratedProtocolMessageType('DropoutParameter', (_message.Message,), dict( + DESCRIPTOR = _DROPOUTPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.DropoutParameter) + )) +_sym_db.RegisterMessage(DropoutParameter) + +DummyDataParameter = _reflection.GeneratedProtocolMessageType('DummyDataParameter', (_message.Message,), dict( + DESCRIPTOR = _DUMMYDATAPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.DummyDataParameter) + )) +_sym_db.RegisterMessage(DummyDataParameter) + +EltwiseParameter = _reflection.GeneratedProtocolMessageType('EltwiseParameter', (_message.Message,), dict( + DESCRIPTOR = _ELTWISEPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.EltwiseParameter) + )) +_sym_db.RegisterMessage(EltwiseParameter) + +ELUParameter = _reflection.GeneratedProtocolMessageType('ELUParameter', (_message.Message,), dict( + DESCRIPTOR = _ELUPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ELUParameter) + )) +_sym_db.RegisterMessage(ELUParameter) + +EmbedParameter = _reflection.GeneratedProtocolMessageType('EmbedParameter', (_message.Message,), dict( + DESCRIPTOR = _EMBEDPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.EmbedParameter) + )) +_sym_db.RegisterMessage(EmbedParameter) + +ExpParameter = _reflection.GeneratedProtocolMessageType('ExpParameter', (_message.Message,), dict( + DESCRIPTOR = _EXPPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ExpParameter) + )) +_sym_db.RegisterMessage(ExpParameter) + +FlattenParameter = _reflection.GeneratedProtocolMessageType('FlattenParameter', (_message.Message,), dict( + DESCRIPTOR = _FLATTENPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.FlattenParameter) + )) +_sym_db.RegisterMessage(FlattenParameter) + +HDF5DataParameter = _reflection.GeneratedProtocolMessageType('HDF5DataParameter', (_message.Message,), dict( + DESCRIPTOR = _HDF5DATAPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.HDF5DataParameter) + )) +_sym_db.RegisterMessage(HDF5DataParameter) + +HDF5OutputParameter = _reflection.GeneratedProtocolMessageType('HDF5OutputParameter', (_message.Message,), dict( + DESCRIPTOR = _HDF5OUTPUTPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.HDF5OutputParameter) + )) +_sym_db.RegisterMessage(HDF5OutputParameter) + +HingeLossParameter = _reflection.GeneratedProtocolMessageType('HingeLossParameter', (_message.Message,), dict( + DESCRIPTOR = _HINGELOSSPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.HingeLossParameter) + )) +_sym_db.RegisterMessage(HingeLossParameter) + +ImageDataParameter = _reflection.GeneratedProtocolMessageType('ImageDataParameter', (_message.Message,), dict( + DESCRIPTOR = _IMAGEDATAPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ImageDataParameter) + )) +_sym_db.RegisterMessage(ImageDataParameter) + +InfogainLossParameter = _reflection.GeneratedProtocolMessageType('InfogainLossParameter', (_message.Message,), dict( + DESCRIPTOR = _INFOGAINLOSSPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.InfogainLossParameter) + )) +_sym_db.RegisterMessage(InfogainLossParameter) + +InnerProductParameter = _reflection.GeneratedProtocolMessageType('InnerProductParameter', (_message.Message,), dict( + DESCRIPTOR = _INNERPRODUCTPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.InnerProductParameter) + )) +_sym_db.RegisterMessage(InnerProductParameter) + +InputParameter = _reflection.GeneratedProtocolMessageType('InputParameter', (_message.Message,), dict( + DESCRIPTOR = _INPUTPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.InputParameter) + )) +_sym_db.RegisterMessage(InputParameter) + +LogParameter = _reflection.GeneratedProtocolMessageType('LogParameter', (_message.Message,), dict( + DESCRIPTOR = _LOGPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.LogParameter) + )) +_sym_db.RegisterMessage(LogParameter) + +LRNParameter = _reflection.GeneratedProtocolMessageType('LRNParameter', (_message.Message,), dict( + DESCRIPTOR = _LRNPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.LRNParameter) + )) +_sym_db.RegisterMessage(LRNParameter) + +MemoryDataParameter = _reflection.GeneratedProtocolMessageType('MemoryDataParameter', (_message.Message,), dict( + DESCRIPTOR = _MEMORYDATAPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.MemoryDataParameter) + )) +_sym_db.RegisterMessage(MemoryDataParameter) + +MVNParameter = _reflection.GeneratedProtocolMessageType('MVNParameter', (_message.Message,), dict( + DESCRIPTOR = _MVNPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.MVNParameter) + )) +_sym_db.RegisterMessage(MVNParameter) + +ParameterParameter = _reflection.GeneratedProtocolMessageType('ParameterParameter', (_message.Message,), dict( + DESCRIPTOR = _PARAMETERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ParameterParameter) + )) +_sym_db.RegisterMessage(ParameterParameter) + +PoolingParameter = _reflection.GeneratedProtocolMessageType('PoolingParameter', (_message.Message,), dict( + DESCRIPTOR = _POOLINGPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.PoolingParameter) + )) +_sym_db.RegisterMessage(PoolingParameter) + +PowerParameter = _reflection.GeneratedProtocolMessageType('PowerParameter', (_message.Message,), dict( + DESCRIPTOR = _POWERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.PowerParameter) + )) +_sym_db.RegisterMessage(PowerParameter) + +PythonParameter = _reflection.GeneratedProtocolMessageType('PythonParameter', (_message.Message,), dict( + DESCRIPTOR = _PYTHONPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.PythonParameter) + )) +_sym_db.RegisterMessage(PythonParameter) + +RecurrentParameter = _reflection.GeneratedProtocolMessageType('RecurrentParameter', (_message.Message,), dict( + DESCRIPTOR = _RECURRENTPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.RecurrentParameter) + )) +_sym_db.RegisterMessage(RecurrentParameter) + +ReductionParameter = _reflection.GeneratedProtocolMessageType('ReductionParameter', (_message.Message,), dict( + DESCRIPTOR = _REDUCTIONPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ReductionParameter) + )) +_sym_db.RegisterMessage(ReductionParameter) + +ReLUParameter = _reflection.GeneratedProtocolMessageType('ReLUParameter', (_message.Message,), dict( + DESCRIPTOR = _RELUPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ReLUParameter) + )) +_sym_db.RegisterMessage(ReLUParameter) + +ReshapeParameter = _reflection.GeneratedProtocolMessageType('ReshapeParameter', (_message.Message,), dict( + DESCRIPTOR = _RESHAPEPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ReshapeParameter) + )) +_sym_db.RegisterMessage(ReshapeParameter) + +ScaleParameter = _reflection.GeneratedProtocolMessageType('ScaleParameter', (_message.Message,), dict( + DESCRIPTOR = _SCALEPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ScaleParameter) + )) +_sym_db.RegisterMessage(ScaleParameter) + +SigmoidParameter = _reflection.GeneratedProtocolMessageType('SigmoidParameter', (_message.Message,), dict( + DESCRIPTOR = _SIGMOIDPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.SigmoidParameter) + )) +_sym_db.RegisterMessage(SigmoidParameter) + +SliceParameter = _reflection.GeneratedProtocolMessageType('SliceParameter', (_message.Message,), dict( + DESCRIPTOR = _SLICEPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.SliceParameter) + )) +_sym_db.RegisterMessage(SliceParameter) + +SoftmaxParameter = _reflection.GeneratedProtocolMessageType('SoftmaxParameter', (_message.Message,), dict( + DESCRIPTOR = _SOFTMAXPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.SoftmaxParameter) + )) +_sym_db.RegisterMessage(SoftmaxParameter) + +TanHParameter = _reflection.GeneratedProtocolMessageType('TanHParameter', (_message.Message,), dict( + DESCRIPTOR = _TANHPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.TanHParameter) + )) +_sym_db.RegisterMessage(TanHParameter) + +TileParameter = _reflection.GeneratedProtocolMessageType('TileParameter', (_message.Message,), dict( + DESCRIPTOR = _TILEPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.TileParameter) + )) +_sym_db.RegisterMessage(TileParameter) + +ThresholdParameter = _reflection.GeneratedProtocolMessageType('ThresholdParameter', (_message.Message,), dict( + DESCRIPTOR = _THRESHOLDPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.ThresholdParameter) + )) +_sym_db.RegisterMessage(ThresholdParameter) + +WindowDataParameter = _reflection.GeneratedProtocolMessageType('WindowDataParameter', (_message.Message,), dict( + DESCRIPTOR = _WINDOWDATAPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.WindowDataParameter) + )) +_sym_db.RegisterMessage(WindowDataParameter) + +SPPParameter = _reflection.GeneratedProtocolMessageType('SPPParameter', (_message.Message,), dict( + DESCRIPTOR = _SPPPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.SPPParameter) + )) +_sym_db.RegisterMessage(SPPParameter) + +V1LayerParameter = _reflection.GeneratedProtocolMessageType('V1LayerParameter', (_message.Message,), dict( + DESCRIPTOR = _V1LAYERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.V1LayerParameter) + )) +_sym_db.RegisterMessage(V1LayerParameter) + +V0LayerParameter = _reflection.GeneratedProtocolMessageType('V0LayerParameter', (_message.Message,), dict( + DESCRIPTOR = _V0LAYERPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.V0LayerParameter) + )) +_sym_db.RegisterMessage(V0LayerParameter) + +PReLUParameter = _reflection.GeneratedProtocolMessageType('PReLUParameter', (_message.Message,), dict( + DESCRIPTOR = _PRELUPARAMETER, + __module__ = 'caffe_pb2' + # @@protoc_insertion_point(class_scope:caffe.PReLUParameter) + )) +_sym_db.RegisterMessage(PReLUParameter) + + +_BLOBSHAPE.fields_by_name['dim'].has_options = True +_BLOBSHAPE.fields_by_name['dim']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_BLOBPROTO.fields_by_name['data'].has_options = True +_BLOBPROTO.fields_by_name['data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_BLOBPROTO.fields_by_name['diff'].has_options = True +_BLOBPROTO.fields_by_name['diff']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_BLOBPROTO.fields_by_name['double_data'].has_options = True +_BLOBPROTO.fields_by_name['double_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_BLOBPROTO.fields_by_name['double_diff'].has_options = True +_BLOBPROTO.fields_by_name['double_diff']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +# @@protoc_insertion_point(module_scope) diff --git a/face_recognition/face_detect/vision/datasets/voc_dataset.py b/face_recognition/face_detect/vision/datasets/voc_dataset.py new file mode 100644 index 0000000000000000000000000000000000000000..87d38e6777eaed2f4ab8cbccbb8f907cfb9f6250 --- /dev/null +++ b/face_recognition/face_detect/vision/datasets/voc_dataset.py @@ -0,0 +1,146 @@ +import logging +import os +import pathlib +import xml.etree.ElementTree as ET +import h5py +import cv2 +import numpy as np +import lmdb +from .caffe_pb2 import * + +class VOCDataset: + + def __init__(self, root, transform=None, target_transform=None, is_test=False, keep_difficult=False, label_file=None): + """Dataset for VOC data. + Args: + root: the root of the VOC2007 or VOC2012 dataset, the directory contains the following sub-directories: + Annotations, ImageSets, JPEGImages, SegmentationClass, SegmentationObject. + """ + self.root = "D:/test" + self.transform = transform + self.target_transform = target_transform + if is_test: + image_sets_file = self.root + '/test.txt' + else: + image_sets_file = self.root + '/test.txt' + self.ids = ['1.hdf5']#VOCDataset._read_image_ids(image_sets_file) + self.keep_difficult = keep_difficult + + # if the labels file exists, read in the class names + label_file_name = self.root + "labels.txt" + + if os.path.isfile(label_file_name): + class_string = "" + with open(label_file_name, 'r') as infile: + for line in infile: + class_string += line.rstrip() + + # classes should be a comma separated list + + classes = class_string.split(',') + # prepend BACKGROUND as first class + classes.insert(0, 'BACKGROUND') + classes = [elem.replace(" ", "") for elem in classes] + self.class_names = tuple(classes) + logging.info("VOC Labels read from file: " + str(self.class_names)) + + else: + logging.info("No labels file, using default VOC classes.") + self.class_names = ('BACKGROUND', + 'face') + + self.class_dict = {class_name: i for i, class_name in enumerate(self.class_names)} + + # def __getitem__(self, index): + # image_id = self.ids[index] + # boxes, labels, is_difficult = self._get_annotation(image_id) + # if not self.keep_difficult: + # boxes = boxes[is_difficult == 0] + # labels = labels[is_difficult == 0] + # image = self._read_image(image_id) + # if self.transform: + # image, boxes, labels = self.transform(image, boxes, labels) + # if self.target_transform: + # boxes, labels = self.target_transform(boxes, labels) + # return image, boxes, labels + + def __getitem__(self, index): + num_per_shared = 3 + file_idx = index // num_per_shared + idx_in_file = index % num_per_shared + hdf_path = os.path.join(self.root, self.ids[file_idx]) + with h5py.File(hdf_path, 'r') as f: + boxes = f[str(idx_in_file) + '_boxes'] + is_difficult = f[str(idx_in_file) + '_difficult'] + image = f[str(idx_in_file) + '_image'] + labels = f[str(idx_in_file) + 'labels'] + + if not self.keep_difficult: + boxes = boxes[is_difficult == 0] + labels = labels[is_difficult == 0] + if self.transform: + image, boxes, labels = self.transform(image, boxes, labels) + if self.target_transform: + boxes, labels = self.target_transform(boxes, labels) + + return image, boxes, labels + + def get_image(self, index): + image_id = self.ids[index] + image = self._read_image(image_id) + if self.transform: + image, _ = self.transform(image) + return image + + def get_annotation(self, index): + image_id = self.ids[index] + return image_id, self._get_annotation(image_id) + + def __len__(self): + total = 0 + # for file in self.ids: + # hdf_path = os.path.join(self.root, file) + # f = h5py.File(hdf_path, 'r') + # total += len(f.keys()) + return total // 4 + + @staticmethod + def _read_image_ids(image_sets_file): + ids = [] + with open(image_sets_file) as f: + for line in f: + ids.append(line.rstrip()) + return ids + + def _get_annotation(self, image_id): + annotation_file = self.root / f"Annotations/{image_id}.xml" + objects = ET.parse(annotation_file).findall("object") + boxes = [] + labels = [] + is_difficult = [] + for object in objects: + class_name = object.find('name').text.lower().strip() + # we're only concerned with clases in our list + if class_name in self.class_dict: + bbox = object.find('bndbox') + + # VOC dataset format follows Matlab, in which indexes start from 0 + x1 = float(bbox.find('xmin').text) - 1 + y1 = float(bbox.find('ymin').text) - 1 + x2 = float(bbox.find('xmax').text) - 1 + y2 = float(bbox.find('ymax').text) - 1 + boxes.append([x1, y1, x2, y2]) + + labels.append(self.class_dict[class_name]) + is_difficult_str = object.find('difficult').text + is_difficult.append(int(is_difficult_str) if is_difficult_str else 0) + + return (np.array(boxes, dtype=np.float32), + np.array(labels, dtype=np.int64), + np.array(is_difficult, dtype=np.uint8)) + + def _read_image(self, image_id): + image_file = self.root / f"JPEGImages/{image_id}.jpg" + image = cv2.imread(str(image_file)) + image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) + return image diff --git a/face_recognition/face_detect/vision/nn/__init__.py b/face_recognition/face_detect/vision/nn/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/face_recognition/face_detect/vision/nn/__pycache__/__init__.cpython-310.pyc b/face_recognition/face_detect/vision/nn/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d61baa8222784b759bd9d63f87778232a7a00734 Binary files /dev/null and b/face_recognition/face_detect/vision/nn/__pycache__/__init__.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/nn/__pycache__/mb_tiny.cpython-310.pyc b/face_recognition/face_detect/vision/nn/__pycache__/mb_tiny.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..73a3d944fec149cb9921af840816f8e1b916a9c2 Binary files /dev/null and b/face_recognition/face_detect/vision/nn/__pycache__/mb_tiny.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/nn/__pycache__/mb_tiny_RFB.cpython-310.pyc b/face_recognition/face_detect/vision/nn/__pycache__/mb_tiny_RFB.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17d1eaf601344763dd828791ed057edad378062c Binary files /dev/null and b/face_recognition/face_detect/vision/nn/__pycache__/mb_tiny_RFB.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/nn/mb_tiny.py b/face_recognition/face_detect/vision/nn/mb_tiny.py new file mode 100644 index 0000000000000000000000000000000000000000..7cade4f2d0ef8db93c21ac9a2afe60d72a652bde --- /dev/null +++ b/face_recognition/face_detect/vision/nn/mb_tiny.py @@ -0,0 +1,51 @@ +import torch.nn as nn +import torch.nn.functional as F + + +class Mb_Tiny(nn.Module): + + def __init__(self, num_classes=2): + super(Mb_Tiny, self).__init__() + self.base_channel = 8 * 2 + + def conv_bn(inp, oup, stride): + return nn.Sequential( + nn.Conv2d(inp, oup, 3, stride, 1, bias=False), + nn.BatchNorm2d(oup), + nn.ReLU(inplace=True) + ) + + def conv_dw(inp, oup, stride): + return nn.Sequential( + nn.Conv2d(inp, inp, 3, stride, 1, groups=inp, bias=False), + nn.BatchNorm2d(inp), + nn.ReLU(inplace=True), + + nn.Conv2d(inp, oup, 1, 1, 0, bias=False), + nn.BatchNorm2d(oup), + nn.ReLU(inplace=True), + ) + + self.model = nn.Sequential( + conv_bn(3, self.base_channel, 2), # 160*120 + conv_dw(self.base_channel, self.base_channel * 2, 1), + conv_dw(self.base_channel * 2, self.base_channel * 2, 2), # 80*60 + conv_dw(self.base_channel * 2, self.base_channel * 2, 1), + conv_dw(self.base_channel * 2, self.base_channel * 4, 2), # 40*30 + conv_dw(self.base_channel * 4, self.base_channel * 4, 1), + conv_dw(self.base_channel * 4, self.base_channel * 4, 1), + conv_dw(self.base_channel * 4, self.base_channel * 4, 1), + conv_dw(self.base_channel * 4, self.base_channel * 8, 2), # 20*15 + conv_dw(self.base_channel * 8, self.base_channel * 8, 1), + conv_dw(self.base_channel * 8, self.base_channel * 8, 1), + conv_dw(self.base_channel * 8, self.base_channel * 16, 2), # 10*8 + conv_dw(self.base_channel * 16, self.base_channel * 16, 1) + ) + self.fc = nn.Linear(1024, num_classes) + + def forward(self, x): + x = self.model(x) + x = F.avg_pool2d(x, 7) + x = x.view(-1, 1024) + x = self.fc(x) + return x diff --git a/face_recognition/face_detect/vision/nn/mb_tiny_RFB.py b/face_recognition/face_detect/vision/nn/mb_tiny_RFB.py new file mode 100644 index 0000000000000000000000000000000000000000..432186d3cabce9582e9cda0fb66f227a3389e21b --- /dev/null +++ b/face_recognition/face_detect/vision/nn/mb_tiny_RFB.py @@ -0,0 +1,118 @@ +import torch +import torch.nn as nn +import torch.nn.functional as F + + +class BasicConv(nn.Module): + + def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=True): + super(BasicConv, self).__init__() + self.out_channels = out_planes + if bn: + self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=False) + self.bn = nn.BatchNorm2d(out_planes, eps=1e-5, momentum=0.01, affine=True) + self.relu = nn.ReLU(inplace=True) if relu else None + else: + self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=True) + self.bn = None + self.relu = nn.ReLU(inplace=True) if relu else None + + def forward(self, x): + x = self.conv(x) + if self.bn is not None: + x = self.bn(x) + if self.relu is not None: + x = self.relu(x) + return x + + +class BasicRFB(nn.Module): + + def __init__(self, in_planes, out_planes, stride=1, scale=0.1, map_reduce=8, vision=1, groups=1): + super(BasicRFB, self).__init__() + self.scale = scale + self.out_channels = out_planes + inter_planes = in_planes // map_reduce + + self.branch0 = nn.Sequential( + BasicConv(in_planes, inter_planes, kernel_size=1, stride=1, groups=groups, relu=False), + BasicConv(inter_planes, 2 * inter_planes, kernel_size=(3, 3), stride=stride, padding=(1, 1), groups=groups), + BasicConv(2 * inter_planes, 2 * inter_planes, kernel_size=3, stride=1, padding=vision + 1, dilation=vision + 1, relu=False, groups=groups) + ) + self.branch1 = nn.Sequential( + BasicConv(in_planes, inter_planes, kernel_size=1, stride=1, groups=groups, relu=False), + BasicConv(inter_planes, 2 * inter_planes, kernel_size=(3, 3), stride=stride, padding=(1, 1), groups=groups), + BasicConv(2 * inter_planes, 2 * inter_planes, kernel_size=3, stride=1, padding=vision + 2, dilation=vision + 2, relu=False, groups=groups) + ) + self.branch2 = nn.Sequential( + BasicConv(in_planes, inter_planes, kernel_size=1, stride=1, groups=groups, relu=False), + BasicConv(inter_planes, (inter_planes // 2) * 3, kernel_size=3, stride=1, padding=1, groups=groups), + BasicConv((inter_planes // 2) * 3, 2 * inter_planes, kernel_size=3, stride=stride, padding=1, groups=groups), + BasicConv(2 * inter_planes, 2 * inter_planes, kernel_size=3, stride=1, padding=vision + 4, dilation=vision + 4, relu=False, groups=groups) + ) + + self.ConvLinear = BasicConv(6 * inter_planes, out_planes, kernel_size=1, stride=1, relu=False) + self.shortcut = BasicConv(in_planes, out_planes, kernel_size=1, stride=stride, relu=False) + self.relu = nn.ReLU(inplace=False) + + def forward(self, x): + x0 = self.branch0(x) + x1 = self.branch1(x) + x2 = self.branch2(x) + + out = torch.cat((x0, x1, x2), 1) + out = self.ConvLinear(out) + short = self.shortcut(x) + out = out * self.scale + short + out = self.relu(out) + + return out + + +class Mb_Tiny_RFB(nn.Module): + + def __init__(self, num_classes=2): + super(Mb_Tiny_RFB, self).__init__() + self.base_channel = 8 * 2 + + def conv_bn(inp, oup, stride): + return nn.Sequential( + nn.Conv2d(inp, oup, 3, stride, 1, bias=False), + nn.BatchNorm2d(oup), + nn.ReLU(inplace=True) + ) + + def conv_dw(inp, oup, stride): + return nn.Sequential( + nn.Conv2d(inp, inp, 3, stride, 1, groups=inp, bias=False), + nn.BatchNorm2d(inp), + nn.ReLU(inplace=True), + + nn.Conv2d(inp, oup, 1, 1, 0, bias=False), + nn.BatchNorm2d(oup), + nn.ReLU(inplace=True), + ) + + self.model = nn.Sequential( + conv_bn(3, self.base_channel, 2), # 160*120 + conv_dw(self.base_channel, self.base_channel * 2, 1), + conv_dw(self.base_channel * 2, self.base_channel * 2, 2), # 80*60 + conv_dw(self.base_channel * 2, self.base_channel * 2, 1), + conv_dw(self.base_channel * 2, self.base_channel * 4, 2), # 40*30 + conv_dw(self.base_channel * 4, self.base_channel * 4, 1), + conv_dw(self.base_channel * 4, self.base_channel * 4, 1), + BasicRFB(self.base_channel * 4, self.base_channel * 4, stride=1, scale=1.0), + conv_dw(self.base_channel * 4, self.base_channel * 8, 2), # 20*15 + conv_dw(self.base_channel * 8, self.base_channel * 8, 1), + conv_dw(self.base_channel * 8, self.base_channel * 8, 1), + conv_dw(self.base_channel * 8, self.base_channel * 16, 2), # 10*8 + conv_dw(self.base_channel * 16, self.base_channel * 16, 1) + ) + self.fc = nn.Linear(1024, num_classes) + + def forward(self, x): + x = self.model(x) + x = F.avg_pool2d(x, 7) + x = x.view(-1, 1024) + x = self.fc(x) + return x diff --git a/face_recognition/face_detect/vision/nn/multibox_loss.py b/face_recognition/face_detect/vision/nn/multibox_loss.py new file mode 100644 index 0000000000000000000000000000000000000000..a3128829b71be5e90b566d0daf4d3f186d687746 --- /dev/null +++ b/face_recognition/face_detect/vision/nn/multibox_loss.py @@ -0,0 +1,46 @@ +import torch +import torch.nn as nn +import torch.nn.functional as F + +from ..utils import box_utils + + +class MultiboxLoss(nn.Module): + def __init__(self, priors, neg_pos_ratio, + center_variance, size_variance, device): + """Implement SSD Multibox Loss. + + Basically, Multibox loss combines classification loss + and Smooth L1 regression loss. + """ + super(MultiboxLoss, self).__init__() + self.neg_pos_ratio = neg_pos_ratio + self.center_variance = center_variance + self.size_variance = size_variance + self.priors = priors + self.priors.to(device) + + def forward(self, confidence, predicted_locations, labels, gt_locations): + """Compute classification loss and smooth l1 loss. + + Args: + confidence (batch_size, num_priors, num_classes): class predictions. + locations (batch_size, num_priors, 4): predicted locations. + labels (batch_size, num_priors): real labels of all the priors. + boxes (batch_size, num_priors, 4): real boxes corresponding all the priors. + """ + num_classes = confidence.size(2) + with torch.no_grad(): + # derived from cross_entropy=sum(log(p)) + loss = -F.log_softmax(confidence, dim=2)[:, :, 0] + mask = box_utils.hard_negative_mining(loss, labels, self.neg_pos_ratio) + + confidence = confidence[mask, :] + classification_loss = F.cross_entropy(confidence.reshape(-1, num_classes), labels[mask], reduction='sum') + pos_mask = labels > 0 + predicted_locations = predicted_locations[pos_mask, :].reshape(-1, 4) + gt_locations = gt_locations[pos_mask, :].reshape(-1, 4) + smooth_l1_loss = F.smooth_l1_loss(predicted_locations, gt_locations, reduction='sum') # smooth_l1_loss + # smooth_l1_loss = F.mse_loss(predicted_locations, gt_locations, reduction='sum') #l2 loss + num_pos = gt_locations.size(0) + return smooth_l1_loss / num_pos, classification_loss / num_pos diff --git a/face_recognition/face_detect/vision/ssd/__init__.py b/face_recognition/face_detect/vision/ssd/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/face_recognition/face_detect/vision/ssd/__pycache__/__init__.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c46159640bc28bb61147bdc4efb5582237ad1037 Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/__pycache__/__init__.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/__pycache__/data_preprocessing.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/__pycache__/data_preprocessing.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..820c2897afe6c588eedf79a7815e99af86d6f3c1 Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/__pycache__/data_preprocessing.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_RFB_fd.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_RFB_fd.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15aeac61e7f42a9e098eaae01f79f497591bed51 Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_RFB_fd.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_fd.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_fd.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c9a04cee7010bb27b071fb12b08fe96d0f5622a Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_fd.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/__pycache__/predictor.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/__pycache__/predictor.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..840be1892ace6dd5fb2aec7dd31e81df5c55616c Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/__pycache__/predictor.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/__pycache__/ssd.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/__pycache__/ssd.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..579b0da468fcf78a44757be0884eecf73cfcba89 Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/__pycache__/ssd.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/config/__init__.py b/face_recognition/face_detect/vision/ssd/config/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/face_recognition/face_detect/vision/ssd/config/__pycache__/__init__.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/config/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aaa061940541019761f55ffea06169cb5c4c1820 Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/config/__pycache__/__init__.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/config/__pycache__/fd_config.cpython-310.pyc b/face_recognition/face_detect/vision/ssd/config/__pycache__/fd_config.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b6f781fc66f806c2cf634b223bb5a786c757c08 Binary files /dev/null and b/face_recognition/face_detect/vision/ssd/config/__pycache__/fd_config.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/ssd/config/fd_config.py b/face_recognition/face_detect/vision/ssd/config/fd_config.py new file mode 100644 index 0000000000000000000000000000000000000000..0d23f2acc091673c07bc9f77e5451be680b7360c --- /dev/null +++ b/face_recognition/face_detect/vision/ssd/config/fd_config.py @@ -0,0 +1,41 @@ +import numpy as np + +from face_detect.vision.utils.box_utils import generate_priors + +image_mean_test = image_mean = np.array([127, 127, 127]) +image_std = 128.0 +iou_threshold = 0.3 +center_variance = 0.1 +size_variance = 0.2 + +min_boxes = [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]] +shrinkage_list = [] +image_size = [320, 240] # default input size 320*240 +feature_map_w_h_list = [[40, 20, 10, 5], [30, 15, 8, 4]] # default feature map size +priors = [] + + +def define_img_size(size): + global image_size, feature_map_w_h_list, priors + img_size_dict = {128: [128, 96], + 160: [160, 120], + 320: [320, 240], + 480: [480, 360], + 640: [640, 480], + 1280: [1280, 960]} + image_size = img_size_dict[size] + + feature_map_w_h_list_dict = {128: [[16, 8, 4, 2], [12, 6, 3, 2]], + 160: [[20, 10, 5, 3], [15, 8, 4, 2]], + 320: [[40, 20, 10, 5], [30, 15, 8, 4]], + 480: [[60, 30, 15, 8], [45, 23, 12, 6]], + 640: [[80, 40, 20, 10], [60, 30, 15, 8]], + 1280: [[160, 80, 40, 20], [120, 60, 30, 15]]} + feature_map_w_h_list = feature_map_w_h_list_dict[size] + + for i in range(0, len(image_size)): + item_list = [] + for k in range(0, len(feature_map_w_h_list[i])): + item_list.append(image_size[i] / feature_map_w_h_list[i][k]) + shrinkage_list.append(item_list) + priors = generate_priors(feature_map_w_h_list, shrinkage_list, image_size, min_boxes) diff --git a/face_recognition/face_detect/vision/ssd/data_preprocessing.py b/face_recognition/face_detect/vision/ssd/data_preprocessing.py new file mode 100644 index 0000000000000000000000000000000000000000..170b1b144c2b52787a351f9e8b1a03ea2062db8e --- /dev/null +++ b/face_recognition/face_detect/vision/ssd/data_preprocessing.py @@ -0,0 +1,61 @@ +from ..transforms.transforms import * + + +class TrainAugmentation: + def __init__(self, size, mean=0, std=1.0): + """ + Args: + size: the size the of final image. + mean: mean pixel value per channel. + """ + self.mean = mean + self.size = size + self.augment = Compose([ + ConvertFromInts(), + PhotometricDistort(), + RandomSampleCrop_v2(), + RandomMirror(), + ToPercentCoords(), + Resize(self.size), + SubtractMeans(self.mean), + lambda img, boxes=None, labels=None: (img / std, boxes, labels), + ToTensor(), + ]) + + def __call__(self, img, boxes, labels): + """ + + Args: + img: the output of cv.imread in RGB layout. + boxes: boundding boxes in the form of (x1, y1, x2, y2). + labels: labels of boxes. + """ + return self.augment(img, boxes, labels) + + +class TestTransform: + def __init__(self, size, mean=0.0, std=1.0): + self.transform = Compose([ + ToPercentCoords(), + Resize(size), + SubtractMeans(mean), + lambda img, boxes=None, labels=None: (img / std, boxes, labels), + ToTensor(), + ]) + + def __call__(self, image, boxes, labels): + return self.transform(image, boxes, labels) + + +class PredictionTransform: + def __init__(self, size, mean=0.0, std=1.0): + self.transform = Compose([ + Resize(size), + SubtractMeans(mean), + lambda img, boxes=None, labels=None: (img / std, boxes, labels), + ToTensor() + ]) + + def __call__(self, image): + image, _, _ = self.transform(image) + return image diff --git a/face_recognition/face_detect/vision/ssd/mb_tiny_RFB_fd.py b/face_recognition/face_detect/vision/ssd/mb_tiny_RFB_fd.py new file mode 100644 index 0000000000000000000000000000000000000000..09327daf711e53be3d21f5bacde4195ccb0c25dd --- /dev/null +++ b/face_recognition/face_detect/vision/ssd/mb_tiny_RFB_fd.py @@ -0,0 +1,64 @@ +from torch.nn import Conv2d, Sequential, ModuleList, ReLU + +from face_detect.vision.nn.mb_tiny_RFB import Mb_Tiny_RFB +from face_detect.vision.ssd.config import fd_config as config +from face_detect.vision.ssd.predictor import Predictor +from face_detect.vision.ssd.ssd import SSD + + +def SeperableConv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0): + """Replace Conv2d with a depthwise Conv2d and Pointwise Conv2d. + """ + return Sequential( + Conv2d(in_channels=in_channels, out_channels=in_channels, kernel_size=kernel_size, + groups=in_channels, stride=stride, padding=padding), + ReLU(), + Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1), + ) + + +def create_Mb_Tiny_RFB_fd(num_classes, is_test=False, device="cuda"): + base_net = Mb_Tiny_RFB(2) + base_net_model = base_net.model # disable dropout layer + + source_layer_indexes = [ + 8, + 11, + 13 + ] + extras = ModuleList([ + Sequential( + Conv2d(in_channels=base_net.base_channel * 16, out_channels=base_net.base_channel * 4, kernel_size=1), + ReLU(), + SeperableConv2d(in_channels=base_net.base_channel * 4, out_channels=base_net.base_channel * 16, kernel_size=3, stride=2, padding=1), + ReLU() + ) + ]) + + regression_headers = ModuleList([ + SeperableConv2d(in_channels=base_net.base_channel * 4, out_channels=3 * 4, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 8, out_channels=2 * 4, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 16, out_channels=2 * 4, kernel_size=3, padding=1), + Conv2d(in_channels=base_net.base_channel * 16, out_channels=3 * 4, kernel_size=3, padding=1) + ]) + + classification_headers = ModuleList([ + SeperableConv2d(in_channels=base_net.base_channel * 4, out_channels=3 * num_classes, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 8, out_channels=2 * num_classes, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 16, out_channels=2 * num_classes, kernel_size=3, padding=1), + Conv2d(in_channels=base_net.base_channel * 16, out_channels=3 * num_classes, kernel_size=3, padding=1) + ]) + + return SSD(num_classes, base_net_model, source_layer_indexes, + extras, classification_headers, regression_headers, is_test=is_test, config=config, device=device) + + +def create_Mb_Tiny_RFB_fd_predictor(net, candidate_size=200, nms_method=None, sigma=0.5, device=None): + predictor = Predictor(net, config.image_size, config.image_mean_test, + config.image_std, + nms_method=nms_method, + iou_threshold=config.iou_threshold, + candidate_size=candidate_size, + sigma=sigma, + device=device) + return predictor diff --git a/face_recognition/face_detect/vision/ssd/mb_tiny_fd.py b/face_recognition/face_detect/vision/ssd/mb_tiny_fd.py new file mode 100644 index 0000000000000000000000000000000000000000..c79880b154ceaa33dd9c4ecba4524c693f37907d --- /dev/null +++ b/face_recognition/face_detect/vision/ssd/mb_tiny_fd.py @@ -0,0 +1,64 @@ +from torch.nn import Conv2d, Sequential, ModuleList, ReLU + +from face_detect.vision.nn.mb_tiny import Mb_Tiny +from face_detect.vision.ssd.config import fd_config as config +from face_detect.vision.ssd.predictor import Predictor +from face_detect.vision.ssd.ssd import SSD + + +def SeperableConv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0): + """Replace Conv2d with a depthwise Conv2d and Pointwise Conv2d. + """ + return Sequential( + Conv2d(in_channels=in_channels, out_channels=in_channels, kernel_size=kernel_size, + groups=in_channels, stride=stride, padding=padding), + ReLU(), + Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1), + ) + + +def create_mb_tiny_fd(num_classes, is_test=False, device="cuda"): + base_net = Mb_Tiny(2) + base_net_model = base_net.model # disable dropout layer + + source_layer_indexes = [ + 8, + 11, + 13 + ] + extras = ModuleList([ + Sequential( + Conv2d(in_channels=base_net.base_channel * 16, out_channels=base_net.base_channel * 4, kernel_size=1), + ReLU(), + SeperableConv2d(in_channels=base_net.base_channel * 4, out_channels=base_net.base_channel * 16, kernel_size=3, stride=2, padding=1), + ReLU() + ) + ]) + + regression_headers = ModuleList([ + SeperableConv2d(in_channels=base_net.base_channel * 4, out_channels=3 * 4, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 8, out_channels=2 * 4, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 16, out_channels=2 * 4, kernel_size=3, padding=1), + Conv2d(in_channels=base_net.base_channel * 16, out_channels=3 * 4, kernel_size=3, padding=1) + ]) + + classification_headers = ModuleList([ + SeperableConv2d(in_channels=base_net.base_channel * 4, out_channels=3 * num_classes, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 8, out_channels=2 * num_classes, kernel_size=3, padding=1), + SeperableConv2d(in_channels=base_net.base_channel * 16, out_channels=2 * num_classes, kernel_size=3, padding=1), + Conv2d(in_channels=base_net.base_channel * 16, out_channels=3 * num_classes, kernel_size=3, padding=1) + ]) + + return SSD(num_classes, base_net_model, source_layer_indexes, + extras, classification_headers, regression_headers, is_test=is_test, config=config, device=device) + + +def create_mb_tiny_fd_predictor(net, candidate_size=200, nms_method=None, sigma=0.5, device=None): + predictor = Predictor(net, config.image_size, config.image_mean_test, + config.image_std, + nms_method=nms_method, + iou_threshold=config.iou_threshold, + candidate_size=candidate_size, + sigma=sigma, + device=device) + return predictor diff --git a/face_recognition/face_detect/vision/ssd/predictor.py b/face_recognition/face_detect/vision/ssd/predictor.py new file mode 100644 index 0000000000000000000000000000000000000000..110b70a118a7102106ad6f662b11925e89ac0c19 --- /dev/null +++ b/face_recognition/face_detect/vision/ssd/predictor.py @@ -0,0 +1,70 @@ +import torch + +from ..utils import box_utils +from .data_preprocessing import PredictionTransform +from ..utils.misc import Timer + + +class Predictor: + def __init__(self, net, size, mean=0.0, std=1.0, nms_method=None, + iou_threshold=0.3, filter_threshold=0.01, candidate_size=200, sigma=0.5, device=None): + self.net = net + self.transform = PredictionTransform(size, mean, std) + self.iou_threshold = iou_threshold + self.filter_threshold = filter_threshold + self.candidate_size = candidate_size + self.nms_method = nms_method + + self.sigma = sigma + if device: + self.device = device + else: + self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") + + self.net.to(self.device) + self.net.eval() + + self.timer = Timer() + + def predict(self, image, top_k=-1, prob_threshold=None): + cpu_device = torch.device("cpu") + height, width, _ = image.shape + image = self.transform(image) + images = image.unsqueeze(0) + images = images.to(self.device) + with torch.no_grad(): + for i in range(1): + scores, boxes = self.net.forward(images) + boxes = boxes[0] + scores = scores[0] + if not prob_threshold: + prob_threshold = self.filter_threshold + # this version of nms is slower on GPU, so we move data to CPU. + boxes = boxes.to(cpu_device) + scores = scores.to(cpu_device) + picked_box_probs = [] + picked_labels = [] + for class_index in range(1, scores.size(1)): + probs = scores[:, class_index] + mask = probs > prob_threshold + probs = probs[mask] + if probs.size(0) == 0: + continue + subset_boxes = boxes[mask, :] + box_probs = torch.cat([subset_boxes, probs.reshape(-1, 1)], dim=1) + box_probs = box_utils.nms(box_probs, self.nms_method, + score_threshold=prob_threshold, + iou_threshold=self.iou_threshold, + sigma=self.sigma, + top_k=top_k, + candidate_size=self.candidate_size) + picked_box_probs.append(box_probs) + picked_labels.extend([class_index] * box_probs.size(0)) + if not picked_box_probs: + return torch.tensor([]), torch.tensor([]), torch.tensor([]) + picked_box_probs = torch.cat(picked_box_probs) + picked_box_probs[:, 0] *= width + picked_box_probs[:, 1] *= height + picked_box_probs[:, 2] *= width + picked_box_probs[:, 3] *= height + return picked_box_probs[:, :4], torch.tensor(picked_labels), picked_box_probs[:, 4] diff --git a/face_recognition/face_detect/vision/ssd/ssd.py b/face_recognition/face_detect/vision/ssd/ssd.py new file mode 100644 index 0000000000000000000000000000000000000000..6704ed743691cbb0225d09bba57d5389f6f5cd79 --- /dev/null +++ b/face_recognition/face_detect/vision/ssd/ssd.py @@ -0,0 +1,166 @@ +from collections import namedtuple +from typing import List, Tuple + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F + +from face_detect.vision.utils import box_utils + +GraphPath = namedtuple("GraphPath", ['s0', 'name', 's1']) + + +class SSD(nn.Module): + def __init__(self, num_classes: int, base_net: nn.ModuleList, source_layer_indexes: List[int], + extras: nn.ModuleList, classification_headers: nn.ModuleList, + regression_headers: nn.ModuleList, is_test=False, config=None, device=None): + """Compose a SSD model using the given components. + """ + super(SSD, self).__init__() + + self.num_classes = num_classes + self.base_net = base_net + self.source_layer_indexes = source_layer_indexes + self.extras = extras + self.classification_headers = classification_headers + self.regression_headers = regression_headers + self.is_test = is_test + self.config = config + + # register layers in source_layer_indexes by adding them to a module list + self.source_layer_add_ons = nn.ModuleList([t[1] for t in source_layer_indexes + if isinstance(t, tuple) and not isinstance(t, GraphPath)]) + if device: + self.device = device + else: + self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") + if is_test: + self.config = config + self.priors = config.priors.to(self.device) + + def forward(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]: + confidences = [] + locations = [] + start_layer_index = 0 + header_index = 0 + end_layer_index = 0 + for end_layer_index in self.source_layer_indexes: + if isinstance(end_layer_index, GraphPath): + path = end_layer_index + end_layer_index = end_layer_index.s0 + added_layer = None + elif isinstance(end_layer_index, tuple): + added_layer = end_layer_index[1] + end_layer_index = end_layer_index[0] + path = None + else: + added_layer = None + path = None + for layer in self.base_net[start_layer_index: end_layer_index]: + x = layer(x) + if added_layer: + y = added_layer(x) + else: + y = x + if path: + sub = getattr(self.base_net[end_layer_index], path.name) + for layer in sub[:path.s1]: + x = layer(x) + y = x + for layer in sub[path.s1:]: + x = layer(x) + end_layer_index += 1 + start_layer_index = end_layer_index + confidence, location = self.compute_header(header_index, y) + header_index += 1 + confidences.append(confidence) + locations.append(location) + + for layer in self.base_net[end_layer_index:]: + x = layer(x) + + for layer in self.extras: + x = layer(x) + confidence, location = self.compute_header(header_index, x) + header_index += 1 + confidences.append(confidence) + locations.append(location) + + confidences = torch.cat(confidences, 1) + locations = torch.cat(locations, 1) + + if self.is_test: + confidences = F.softmax(confidences, dim=2) + boxes = box_utils.convert_locations_to_boxes( + locations, self.priors, self.config.center_variance, self.config.size_variance + ) + boxes = box_utils.center_form_to_corner_form(boxes) + return confidences, boxes + else: + return confidences, locations + + def compute_header(self, i, x): + confidence = self.classification_headers[i](x) + confidence = confidence.permute(0, 2, 3, 1).contiguous() + confidence = confidence.view(confidence.size(0), -1, self.num_classes) + + location = self.regression_headers[i](x) + location = location.permute(0, 2, 3, 1).contiguous() + location = location.view(location.size(0), -1, 4) + + return confidence, location + + def init_from_base_net(self, model): + self.base_net.load_state_dict(torch.load(model, map_location=lambda storage, loc: storage), strict=True) + self.source_layer_add_ons.apply(_xavier_init_) + self.extras.apply(_xavier_init_) + self.classification_headers.apply(_xavier_init_) + self.regression_headers.apply(_xavier_init_) + + def init_from_pretrained_ssd(self, model): + state_dict = torch.load(model, map_location=lambda storage, loc: storage) + state_dict = {k: v for k, v in state_dict.items() if not (k.startswith("classification_headers") or k.startswith("regression_headers"))} + model_dict = self.state_dict() + model_dict.update(state_dict) + self.load_state_dict(model_dict) + self.classification_headers.apply(_xavier_init_) + self.regression_headers.apply(_xavier_init_) + + def init(self): + self.base_net.apply(_xavier_init_) + self.source_layer_add_ons.apply(_xavier_init_) + self.extras.apply(_xavier_init_) + self.classification_headers.apply(_xavier_init_) + self.regression_headers.apply(_xavier_init_) + + def load(self, model): + self.load_state_dict(torch.load(model, map_location=lambda storage, loc: storage)) + + def save(self, model_path): + torch.save(self.state_dict(), model_path) + + +class MatchPrior(object): + def __init__(self, center_form_priors, center_variance, size_variance, iou_threshold): + self.center_form_priors = center_form_priors + self.corner_form_priors = box_utils.center_form_to_corner_form(center_form_priors) + self.center_variance = center_variance + self.size_variance = size_variance + self.iou_threshold = iou_threshold + + def __call__(self, gt_boxes, gt_labels): + if type(gt_boxes) is np.ndarray: + gt_boxes = torch.from_numpy(gt_boxes) + if type(gt_labels) is np.ndarray: + gt_labels = torch.from_numpy(gt_labels) + boxes, labels = box_utils.assign_priors(gt_boxes, gt_labels, + self.corner_form_priors, self.iou_threshold) + boxes = box_utils.corner_form_to_center_form(boxes) + locations = box_utils.convert_boxes_to_locations(boxes, self.center_form_priors, self.center_variance, self.size_variance) + return locations, labels + + +def _xavier_init_(m: nn.Module): + if isinstance(m, nn.Conv2d): + nn.init.xavier_uniform_(m.weight) diff --git a/face_recognition/face_detect/vision/transforms/__init__.py b/face_recognition/face_detect/vision/transforms/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/face_recognition/face_detect/vision/transforms/__pycache__/__init__.cpython-310.pyc b/face_recognition/face_detect/vision/transforms/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51e0245c702694bce3a737957671fd4f87687d28 Binary files /dev/null and b/face_recognition/face_detect/vision/transforms/__pycache__/__init__.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/transforms/__pycache__/transforms.cpython-310.pyc b/face_recognition/face_detect/vision/transforms/__pycache__/transforms.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81b2aaf9ffea99ceb7726655ea2cc2c37f384958 Binary files /dev/null and b/face_recognition/face_detect/vision/transforms/__pycache__/transforms.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/transforms/transforms.py b/face_recognition/face_detect/vision/transforms/transforms.py new file mode 100644 index 0000000000000000000000000000000000000000..c53b38ee495aa3a9d176302c424ffe78d56f5e04 --- /dev/null +++ b/face_recognition/face_detect/vision/transforms/transforms.py @@ -0,0 +1,541 @@ +# from https://github.com/amdegroot/ssd.pytorch + + +import types + +import cv2 +import numpy as np +import torch +from numpy import random +from torchvision import transforms + + +def intersect(box_a, box_b): + max_xy = np.minimum(box_a[:, 2:], box_b[2:]) + min_xy = np.maximum(box_a[:, :2], box_b[:2]) + inter = np.clip((max_xy - min_xy), a_min=0, a_max=np.inf) + return inter[:, 0] * inter[:, 1] + + +def jaccard_numpy(box_a, box_b): + """Compute the jaccard overlap of two sets of boxes. The jaccard overlap + is simply the intersection over union of two boxes. + E.g.: + A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B) + Args: + box_a: Multiple bounding boxes, Shape: [num_boxes,4] + box_b: Single bounding box, Shape: [4] + Return: + jaccard overlap: Shape: [box_a.shape[0], box_a.shape[1]] + """ + inter = intersect(box_a, box_b) + area_a = ((box_a[:, 2] - box_a[:, 0]) * + (box_a[:, 3] - box_a[:, 1])) # [A,B] + area_b = ((box_b[2] - box_b[0]) * + (box_b[3] - box_b[1])) # [A,B] + union = area_a + area_b - inter + return inter / union # [A,B] + + +def object_converage_numpy(box_a, box_b): + """Compute the jaccard overlap of two sets of boxes. The jaccard overlap + is simply the intersection over union of two boxes. + E.g.: + A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B) + Args: + box_a: Multiple bounding boxes, Shape: [num_boxes,4] + box_b: Single bounding box, Shape: [4] + Return: + jaccard overlap: Shape: [box_a.shape[0], box_a.shape[1]] + """ + inter = intersect(box_a, box_b) + area_a = ((box_a[:, 2] - box_a[:, 0]) * + (box_a[:, 3] - box_a[:, 1])) # [A,B] + area_b = ((box_b[2] - box_b[0]) * + (box_b[3] - box_b[1])) # [A,B] + return inter / area_a # [A,B] + + +class Compose(object): + """Composes several augmentations together. + Args: + transforms (List[Transform]): list of transforms to compose. + Example: + >>> augmentations.Compose([ + >>> transforms.CenterCrop(10), + >>> transforms.ToTensor(), + >>> ]) + """ + + def __init__(self, transforms): + self.transforms = transforms + + def __call__(self, img, boxes=None, labels=None): + for t in self.transforms: + img, boxes, labels = t(img, boxes, labels) + return img, boxes, labels + + +class Lambda(object): + """Applies a lambda as a transform.""" + + def __init__(self, lambd): + assert isinstance(lambd, types.LambdaType) + self.lambd = lambd + + def __call__(self, img, boxes=None, labels=None): + return self.lambd(img, boxes, labels) + + +class ConvertFromInts(object): + def __call__(self, image, boxes=None, labels=None): + return image.astype(np.float32), boxes, labels + + +class SubtractMeans(object): + def __init__(self, mean): + self.mean = np.array(mean, dtype=np.float32) + + def __call__(self, image, boxes=None, labels=None): + image = image.astype(np.float32) + image -= self.mean + return image.astype(np.float32), boxes, labels + + +class imgprocess(object): + def __init__(self, std): + self.std = np.array(std, dtype=np.float32) + + def __call__(self, image, boxes=None, labels=None): + image = image.astype(np.float32) + image /= self.std + return image.astype(np.float32), boxes, labels + + +class ToAbsoluteCoords(object): + def __call__(self, image, boxes=None, labels=None): + height, width, channels = image.shape + boxes[:, 0] *= width + boxes[:, 2] *= width + boxes[:, 1] *= height + boxes[:, 3] *= height + + return image, boxes, labels + + +class ToPercentCoords(object): + def __call__(self, image, boxes=None, labels=None): + height, width, channels = image.shape + boxes[:, 0] /= width + boxes[:, 2] /= width + boxes[:, 1] /= height + boxes[:, 3] /= height + + return image, boxes, labels + + +class Resize(object): + def __init__(self, size=(300, 300)): + self.size = size + + def __call__(self, image, boxes=None, labels=None): + image = cv2.resize(image, (self.size[0], + self.size[1])) + return image, boxes, labels + + +class RandomSaturation(object): + def __init__(self, lower=0.5, upper=1.5): + self.lower = lower + self.upper = upper + assert self.upper >= self.lower, "contrast upper must be >= lower." + assert self.lower >= 0, "contrast lower must be non-negative." + + def __call__(self, image, boxes=None, labels=None): + if random.randint(2): + image[:, :, 1] *= random.uniform(self.lower, self.upper) + + return image, boxes, labels + + +class RandomHue(object): + def __init__(self, delta=18.0): + assert delta >= 0.0 and delta <= 360.0 + self.delta = delta + + def __call__(self, image, boxes=None, labels=None): + if random.randint(2): + image[:, :, 0] += random.uniform(-self.delta, self.delta) + image[:, :, 0][image[:, :, 0] > 360.0] -= 360.0 + image[:, :, 0][image[:, :, 0] < 0.0] += 360.0 + return image, boxes, labels + + +class RandomLightingNoise(object): + def __init__(self): + self.perms = ((0, 1, 2), (0, 2, 1), + (1, 0, 2), (1, 2, 0), + (2, 0, 1), (2, 1, 0)) + + def __call__(self, image, boxes=None, labels=None): + if random.randint(2): + swap = self.perms[random.randint(len(self.perms))] + shuffle = SwapChannels(swap) # shuffle channels + image = shuffle(image) + return image, boxes, labels + + +class ConvertColor(object): + def __init__(self, current, transform): + self.transform = transform + self.current = current + + def __call__(self, image, boxes=None, labels=None): + if self.current == 'BGR' and self.transform == 'HSV': + image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) + elif self.current == 'RGB' and self.transform == 'HSV': + image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV) + elif self.current == 'BGR' and self.transform == 'RGB': + image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) + elif self.current == 'HSV' and self.transform == 'BGR': + image = cv2.cvtColor(image, cv2.COLOR_HSV2BGR) + elif self.current == 'HSV' and self.transform == "RGB": + image = cv2.cvtColor(image, cv2.COLOR_HSV2RGB) + else: + raise NotImplementedError + return image, boxes, labels + + +class RandomContrast(object): + def __init__(self, lower=0.5, upper=1.5): + self.lower = lower + self.upper = upper + assert self.upper >= self.lower, "contrast upper must be >= lower." + assert self.lower >= 0, "contrast lower must be non-negative." + + # expects float image + def __call__(self, image, boxes=None, labels=None): + if random.randint(2): + alpha = random.uniform(self.lower, self.upper) + image *= alpha + return image, boxes, labels + + +class RandomBrightness(object): + def __init__(self, delta=32): + assert delta >= 0.0 + assert delta <= 255.0 + self.delta = delta + + def __call__(self, image, boxes=None, labels=None): + if random.randint(2): + delta = random.uniform(-self.delta, self.delta) + image += delta + return image, boxes, labels + + +class ToCV2Image(object): + def __call__(self, tensor, boxes=None, labels=None): + return tensor.cpu().numpy().astype(np.float32).transpose((1, 2, 0)), boxes, labels + + +class ToTensor(object): + def __call__(self, cvimage, boxes=None, labels=None): + return torch.from_numpy(cvimage.astype(np.float32)).permute(2, 0, 1), boxes, labels + + +class RandomSampleCrop(object): + """Crop + Arguments: + img (Image): the image being input during training + boxes (Tensor): the original bounding boxes in pt form + labels (Tensor): the class labels for each bbox + mode (float tuple): the min and max jaccard overlaps + Return: + (img, boxes, classes) + img (Image): the cropped image + boxes (Tensor): the adjusted bounding boxes in pt form + labels (Tensor): the class labels for each bbox + """ + + def __init__(self): + self.sample_options = ( + # using entire original input image + None, + # sample a patch s.t. MIN jaccard w/ obj in .1,.3,.4,.7,.9 + (0.1, None), + (0.3, None), + (0.7, None), + (0.9, None), + # randomly sample a patch + (None, None), + ) + + def __call__(self, image, boxes=None, labels=None): + height, width, _ = image.shape + while True: + # randomly choose a mode + mode = random.choice(self.sample_options) + if mode is None: + return image, boxes, labels + + min_iou, max_iou = mode + if min_iou is None: + min_iou = float('-inf') + if max_iou is None: + max_iou = float('inf') + + # max trails (50) + for _ in range(50): + current_image = image + + w = random.uniform(0.3 * width, width) + h = random.uniform(0.3 * height, height) + + # aspect ratio constraint b/t .5 & 2 + if h / w < 0.5 or h / w > 2: + continue + + left = random.uniform(width - w) + top = random.uniform(height - h) + + # convert to integer rect x1,y1,x2,y2 + rect = np.array([int(left), int(top), int(left + w), int(top + h)]) + + # calculate IoU (jaccard overlap) b/t the cropped and gt boxes + overlap = jaccard_numpy(boxes, rect) + + # is min and max overlap constraint satisfied? if not try again + if overlap.max() < min_iou or overlap.min() > max_iou: + continue + + # cut the crop from the image + current_image = current_image[rect[1]:rect[3], rect[0]:rect[2], + :] + + # keep overlap with gt box IF center in sampled patch + centers = (boxes[:, :2] + boxes[:, 2:]) / 2.0 + + # mask in all gt boxes that above and to the left of centers + m1 = (rect[0] < centers[:, 0]) * (rect[1] < centers[:, 1]) + + # mask in all gt boxes that under and to the right of centers + m2 = (rect[2] > centers[:, 0]) * (rect[3] > centers[:, 1]) + + # mask in that both m1 and m2 are true + mask = m1 * m2 + + # have any valid boxes? try again if not + if not mask.any(): + continue + + # take only matching gt boxes + current_boxes = boxes[mask, :].copy() + + # take only matching gt labels + current_labels = labels[mask] + + # should we use the box left and top corner or the crop's + current_boxes[:, :2] = np.maximum(current_boxes[:, :2], + rect[:2]) + # adjust to crop (by substracting crop's left,top) + current_boxes[:, :2] -= rect[:2] + + current_boxes[:, 2:] = np.minimum(current_boxes[:, 2:], + rect[2:]) + # adjust to crop (by substracting crop's left,top) + current_boxes[:, 2:] -= rect[:2] + + return current_image, current_boxes, current_labels + + +class RandomSampleCrop_v2(object): + """Crop + Arguments: + img (Image): the image being input during training + boxes (Tensor): the original bounding boxes in pt form + labels (Tensor): the class labels for each bbox + mode (float tuple): the min and max jaccard overlaps + Return: + (img, boxes, classes) + img (Image): the cropped image + boxes (Tensor): the adjusted bounding boxes in pt form + labels (Tensor): the class labels for each bbox + """ + + def __init__(self): + self.sample_options = ( + # using entire original input image + None, + # sample a patch s.t. MIN jaccard w/ obj in .1,.3,.4,.7,.9 + + # randomly sample a patch + (1, None), + (1, None), + (1, None), + (1, None), + ) + + def __call__(self, image, boxes=None, labels=None): + height, width, _ = image.shape + while True: + # randomly choose a mode + mode = random.choice(self.sample_options) + if mode is None: + return image, boxes, labels + + min_iou, max_iou = mode + if min_iou is None: + min_iou = float('-inf') + if max_iou is None: + max_iou = float('inf') + + # max trails (50) + for _ in range(50): + current_image = image + + w = random.uniform(0.3 * width, width) + h = random.uniform(0.3 * height, height) + + # aspect ratio constraint b/t .5 & 2 + if h / w != 1: + continue + left = random.uniform(width - w) + top = random.uniform(height - h) + + # convert to integer rect x1,y1,x2,y2 + rect = np.array([int(left), int(top), int(left + w), int(top + h)]) + + # calculate IoU (jaccard overlap) b/t the cropped and gt boxes + overlap = object_converage_numpy(boxes, rect) + + # is min and max overlap constraint satisfied? if not try again + if overlap.max() < min_iou or overlap.min() > max_iou: + continue + + # cut the crop from the image + current_image = current_image[rect[1]:rect[3], rect[0]:rect[2], + :] + + # keep overlap with gt box IF center in sampled patch + centers = (boxes[:, :2] + boxes[:, 2:]) / 2.0 + + # mask in all gt boxes that above and to the left of centers + m1 = (rect[0] < centers[:, 0]) * (rect[1] < centers[:, 1]) + + # mask in all gt boxes that under and to the right of centers + m2 = (rect[2] > centers[:, 0]) * (rect[3] > centers[:, 1]) + + # mask in that both m1 and m2 are true + mask = m1 * m2 + + # have any valid boxes? try again if not + if not mask.any(): + continue + + # take only matching gt boxes + current_boxes = boxes[mask, :].copy() + + # take only matching gt labels + current_labels = labels[mask] + + # should we use the box left and top corner or the crop's + current_boxes[:, :2] = np.maximum(current_boxes[:, :2], + rect[:2]) + # adjust to crop (by substracting crop's left,top) + current_boxes[:, :2] -= rect[:2] + + current_boxes[:, 2:] = np.minimum(current_boxes[:, 2:], + rect[2:]) + # adjust to crop (by substracting crop's left,top) + current_boxes[:, 2:] -= rect[:2] + + return current_image, current_boxes, current_labels + + +class Expand(object): + def __init__(self, mean): + self.mean = mean + + def __call__(self, image, boxes, labels): + if random.randint(2): + return image, boxes, labels + + height, width, depth = image.shape + ratio = random.uniform(1, 4) + left = random.uniform(0, width * ratio - width) + top = random.uniform(0, height * ratio - height) + + expand_image = np.zeros( + (int(height * ratio), int(width * ratio), depth), + dtype=image.dtype) + expand_image[:, :, :] = self.mean + expand_image[int(top):int(top + height), + int(left):int(left + width)] = image + image = expand_image + + boxes = boxes.copy() + boxes[:, :2] += (int(left), int(top)) + boxes[:, 2:] += (int(left), int(top)) + + return image, boxes, labels + + +class RandomMirror(object): + def __call__(self, image, boxes, classes): + _, width, _ = image.shape + if random.randint(2): + image = image[:, ::-1] + boxes = boxes.copy() + boxes[:, 0::2] = width - boxes[:, 2::-2] + return image, boxes, classes + + +class SwapChannels(object): + """Transforms a tensorized image by swapping the channels in the order + specified in the swap tuple. + Args: + swaps (int triple): final order of channels + eg: (2, 1, 0) + """ + + def __init__(self, swaps): + self.swaps = swaps + + def __call__(self, image): + """ + Args: + image (Tensor): image tensor to be transformed + Return: + a tensor with channels swapped according to swap + """ + # if torch.is_tensor(image): + # image = image.data.cpu().numpy() + # else: + # image = np.array(image) + image = image[:, :, self.swaps] + return image + + +class PhotometricDistort(object): + def __init__(self): + self.pd = [ + RandomContrast(), # RGB + ConvertColor(current="RGB", transform='HSV'), # HSV + RandomSaturation(), # HSV + RandomHue(), # HSV + ConvertColor(current='HSV', transform='RGB'), # RGB + RandomContrast() # RGB + ] + self.rand_brightness = RandomBrightness() + self.rand_light_noise = RandomLightingNoise() + + def __call__(self, image, boxes, labels): + im = image.copy() + im, boxes, labels = self.rand_brightness(im, boxes, labels) + if random.randint(2): + distort = Compose(self.pd[:-1]) + else: + distort = Compose(self.pd[1:]) + im, boxes, labels = distort(im, boxes, labels) + return self.rand_light_noise(im, boxes, labels) diff --git a/face_recognition/face_detect/vision/utils/__init__.py b/face_recognition/face_detect/vision/utils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0789bdb3927dcd3ae7392783184d13652b1cc403 --- /dev/null +++ b/face_recognition/face_detect/vision/utils/__init__.py @@ -0,0 +1 @@ +from .misc import * diff --git a/face_recognition/face_detect/vision/utils/__pycache__/__init__.cpython-310.pyc b/face_recognition/face_detect/vision/utils/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e98986b9e6d9c06c9a9729f057cdf97b3470e95 Binary files /dev/null and b/face_recognition/face_detect/vision/utils/__pycache__/__init__.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/utils/__pycache__/box_utils.cpython-310.pyc b/face_recognition/face_detect/vision/utils/__pycache__/box_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62123669ead64ee5a26e0a5ac6534d0d0c2b1340 Binary files /dev/null and b/face_recognition/face_detect/vision/utils/__pycache__/box_utils.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/utils/__pycache__/misc.cpython-310.pyc b/face_recognition/face_detect/vision/utils/__pycache__/misc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2de5a2ff987b3c846ddfc2b947800463a17a5ef8 Binary files /dev/null and b/face_recognition/face_detect/vision/utils/__pycache__/misc.cpython-310.pyc differ diff --git a/face_recognition/face_detect/vision/utils/box_utils.py b/face_recognition/face_detect/vision/utils/box_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..32be008ec0ff3ab84af9cf83d2db7eb0ce1fc816 --- /dev/null +++ b/face_recognition/face_detect/vision/utils/box_utils.py @@ -0,0 +1,241 @@ +import math + +import torch + + +def generate_priors(feature_map_list, shrinkage_list, image_size, min_boxes, clamp=True) -> torch.Tensor: + priors = [] + for index in range(0, len(feature_map_list[0])): + scale_w = image_size[0] / shrinkage_list[0][index] + scale_h = image_size[1] / shrinkage_list[1][index] + for j in range(0, feature_map_list[1][index]): + for i in range(0, feature_map_list[0][index]): + x_center = (i + 0.5) / scale_w + y_center = (j + 0.5) / scale_h + + for min_box in min_boxes[index]: + w = min_box / image_size[0] + h = min_box / image_size[1] + priors.append([ + x_center, + y_center, + w, + h + ]) + print("priors nums:{}".format(len(priors))) + priors = torch.tensor(priors) + if clamp: + torch.clamp(priors, 0.0, 1.0, out=priors) + return priors + + +def convert_locations_to_boxes(locations, priors, center_variance, + size_variance): + """Convert regressional location results of SSD into boxes in the form of (center_x, center_y, h, w). + + The conversion: + $$predicted\_center * center_variance = \frac {real\_center - prior\_center} {prior\_hw}$$ + $$exp(predicted\_hw * size_variance) = \frac {real\_hw} {prior\_hw}$$ + We do it in the inverse direction here. + Args: + locations (batch_size, num_priors, 4): the regression output of SSD. It will contain the outputs as well. + priors (num_priors, 4) or (batch_size/1, num_priors, 4): prior boxes. + center_variance: a float used to change the scale of center. + size_variance: a float used to change of scale of size. + Returns: + boxes: priors: [[center_x, center_y, h, w]]. All the values + are relative to the image size. + """ + # priors can have one dimension less. + if priors.dim() + 1 == locations.dim(): + priors = priors.unsqueeze(0) + return torch.cat([ + locations[..., :2] * center_variance * priors[..., 2:] + priors[..., :2], + torch.exp(locations[..., 2:] * size_variance) * priors[..., 2:] + ], dim=locations.dim() - 1) + + +def convert_boxes_to_locations(center_form_boxes, center_form_priors, center_variance, size_variance): + # priors can have one dimension less + if center_form_priors.dim() + 1 == center_form_boxes.dim(): + center_form_priors = center_form_priors.unsqueeze(0) + return torch.cat([ + (center_form_boxes[..., :2] - center_form_priors[..., :2]) / center_form_priors[..., 2:] / center_variance, + torch.log(center_form_boxes[..., 2:] / center_form_priors[..., 2:]) / size_variance + ], dim=center_form_boxes.dim() - 1) + + +def area_of(left_top, right_bottom) -> torch.Tensor: + """Compute the areas of rectangles given two corners. + + Args: + left_top (N, 2): left top corner. + right_bottom (N, 2): right bottom corner. + + Returns: + area (N): return the area. + """ + hw = torch.clamp(right_bottom - left_top, min=0.0) + return hw[..., 0] * hw[..., 1] + + +def iou_of(boxes0, boxes1, eps=1e-5): + """Return intersection-over-union (Jaccard index) of boxes. + + Args: + boxes0 (N, 4): ground truth boxes. + boxes1 (N or 1, 4): predicted boxes. + eps: a small number to avoid 0 as denominator. + Returns: + iou (N): IoU values. + """ + overlap_left_top = torch.max(boxes0[..., :2], boxes1[..., :2]) + overlap_right_bottom = torch.min(boxes0[..., 2:], boxes1[..., 2:]) + + overlap_area = area_of(overlap_left_top, overlap_right_bottom) + area0 = area_of(boxes0[..., :2], boxes0[..., 2:]) + area1 = area_of(boxes1[..., :2], boxes1[..., 2:]) + return overlap_area / (area0 + area1 - overlap_area + eps) + + +def assign_priors(gt_boxes, gt_labels, corner_form_priors, + iou_threshold): + """Assign ground truth boxes and targets to priors. + + Args: + gt_boxes (num_targets, 4): ground truth boxes. + gt_labels (num_targets): labels of targets. + priors (num_priors, 4): corner form priors + Returns: + boxes (num_priors, 4): real values for priors. + labels (num_priros): labels for priors. + """ + # size: num_priors x num_targets + ious = iou_of(gt_boxes.unsqueeze(0), corner_form_priors.unsqueeze(1)) + # size: num_priors + best_target_per_prior, best_target_per_prior_index = ious.max(1) + # size: num_targets + best_prior_per_target, best_prior_per_target_index = ious.max(0) + + for target_index, prior_index in enumerate(best_prior_per_target_index): + best_target_per_prior_index[prior_index] = target_index + # 2.0 is used to make sure every target has a prior assigned + best_target_per_prior.index_fill_(0, best_prior_per_target_index, 2) + # size: num_priors + labels = gt_labels[best_target_per_prior_index] + labels[best_target_per_prior < iou_threshold] = 0 # the backgournd id + boxes = gt_boxes[best_target_per_prior_index] + return boxes, labels + + +def hard_negative_mining(loss, labels, neg_pos_ratio): + """ + It used to suppress the presence of a large number of negative prediction. + It works on image level not batch level. + For any example/image, it keeps all the positive predictions and + cut the number of negative predictions to make sure the ratio + between the negative examples and positive examples is no more + the given ratio for an image. + + Args: + loss (N, num_priors): the loss for each example. + labels (N, num_priors): the labels. + neg_pos_ratio: the ratio between the negative examples and positive examples. + """ + pos_mask = labels > 0 + num_pos = pos_mask.long().sum(dim=1, keepdim=True) + num_neg = num_pos * neg_pos_ratio + + loss[pos_mask] = -math.inf + _, indexes = loss.sort(dim=1, descending=True) + _, orders = indexes.sort(dim=1) + neg_mask = orders < num_neg + return pos_mask | neg_mask + + +def center_form_to_corner_form(locations): + return torch.cat([locations[..., :2] - locations[..., 2:] / 2, + locations[..., :2] + locations[..., 2:] / 2], locations.dim() - 1) + + +def corner_form_to_center_form(boxes): + return torch.cat([ + (boxes[..., :2] + boxes[..., 2:]) / 2, + boxes[..., 2:] - boxes[..., :2] + ], boxes.dim() - 1) + + +def hard_nms(box_scores, iou_threshold, top_k=-1, candidate_size=200): + """ + + Args: + box_scores (N, 5): boxes in corner-form and probabilities. + iou_threshold: intersection over union threshold. + top_k: keep top_k results. If k <= 0, keep all the results. + candidate_size: only consider the candidates with the highest scores. + Returns: + picked: a list of indexes of the kept boxes + """ + scores = box_scores[:, -1] + boxes = box_scores[:, :-1] + picked = [] + _, indexes = scores.sort(descending=True) + indexes = indexes[:candidate_size] + while len(indexes) > 0: + current = indexes[0] + picked.append(current.item()) + if 0 < top_k == len(picked) or len(indexes) == 1: + break + current_box = boxes[current, :] + indexes = indexes[1:] + rest_boxes = boxes[indexes, :] + iou = iou_of( + rest_boxes, + current_box.unsqueeze(0), + ) + indexes = indexes[iou <= iou_threshold] + + return box_scores[picked, :] + + +def nms(box_scores, nms_method=None, score_threshold=None, iou_threshold=None, + sigma=0.5, top_k=-1, candidate_size=200): + if nms_method == "soft": + return soft_nms(box_scores, score_threshold, sigma, top_k) + else: + return hard_nms(box_scores, iou_threshold, top_k, candidate_size=candidate_size) + + +def soft_nms(box_scores, score_threshold, sigma=0.5, top_k=-1): + """Soft NMS implementation. + + References: + https://arxiv.org/abs/1704.04503 + https://github.com/facebookresearch/Detectron/blob/master/detectron/utils/cython_nms.pyx + + Args: + box_scores (N, 5): boxes in corner-form and probabilities. + score_threshold: boxes with scores less than value are not considered. + sigma: the parameter in score re-computation. + scores[i] = scores[i] * exp(-(iou_i)^2 / simga) + top_k: keep top_k results. If k <= 0, keep all the results. + Returns: + picked_box_scores (K, 5): results of NMS. + """ + picked_box_scores = [] + while box_scores.size(0) > 0: + max_score_index = torch.argmax(box_scores[:, 4]) + cur_box_prob = torch.tensor(box_scores[max_score_index, :]) + picked_box_scores.append(cur_box_prob) + if len(picked_box_scores) == top_k > 0 or box_scores.size(0) == 1: + break + cur_box = cur_box_prob[:-1] + box_scores[max_score_index, :] = box_scores[-1, :] + box_scores = box_scores[:-1, :] + ious = iou_of(cur_box.unsqueeze(0), box_scores[:, :-1]) + box_scores[:, -1] = box_scores[:, -1] * torch.exp(-(ious * ious) / sigma) + box_scores = box_scores[box_scores[:, -1] > score_threshold, :] + if len(picked_box_scores) > 0: + return torch.stack(picked_box_scores) + else: + return torch.tensor([]) diff --git a/face_recognition/face_detect/vision/utils/box_utils_numpy.py b/face_recognition/face_detect/vision/utils/box_utils_numpy.py new file mode 100644 index 0000000000000000000000000000000000000000..a6a6c4ea40a8209bb517f24d95280bf0c5787241 --- /dev/null +++ b/face_recognition/face_detect/vision/utils/box_utils_numpy.py @@ -0,0 +1,119 @@ +import numpy as np + + +def convert_locations_to_boxes(locations, priors, center_variance, + size_variance): + """Convert regressional location results of SSD into boxes in the form of (center_x, center_y, h, w). + + The conversion: + $$predicted\_center * center_variance = \frac {real\_center - prior\_center} {prior\_hw}$$ + $$exp(predicted\_hw * size_variance) = \frac {real\_hw} {prior\_hw}$$ + We do it in the inverse direction here. + Args: + locations (batch_size, num_priors, 4): the regression output of SSD. It will contain the outputs as well. + priors (num_priors, 4) or (batch_size/1, num_priors, 4): prior boxes. + center_variance: a float used to change the scale of center. + size_variance: a float used to change of scale of size. + Returns: + boxes: priors: [[center_x, center_y, h, w]]. All the values + are relative to the image size. + """ + # priors can have one dimension less. + if len(priors.shape) + 1 == len(locations.shape): + priors = np.expand_dims(priors, 0) + return np.concatenate([ + locations[..., :2] * center_variance * priors[..., 2:] + priors[..., :2], + np.exp(locations[..., 2:] * size_variance) * priors[..., 2:] + ], axis=len(locations.shape) - 1) + + +def convert_boxes_to_locations(center_form_boxes, center_form_priors, center_variance, size_variance): + # priors can have one dimension less + if len(center_form_priors.shape) + 1 == len(center_form_boxes.shape): + center_form_priors = np.expand_dims(center_form_priors, 0) + return np.concatenate([ + (center_form_boxes[..., :2] - center_form_priors[..., :2]) / center_form_priors[..., 2:] / center_variance, + np.log(center_form_boxes[..., 2:] / center_form_priors[..., 2:]) / size_variance + ], axis=len(center_form_boxes.shape) - 1) + + +def area_of(left_top, right_bottom): + """Compute the areas of rectangles given two corners. + + Args: + left_top (N, 2): left top corner. + right_bottom (N, 2): right bottom corner. + + Returns: + area (N): return the area. + """ + hw = np.clip(right_bottom - left_top, 0.0, None) + return hw[..., 0] * hw[..., 1] + + +def iou_of(boxes0, boxes1, eps=1e-5): + """Return intersection-over-union (Jaccard index) of boxes. + + Args: + boxes0 (N, 4): ground truth boxes. + boxes1 (N or 1, 4): predicted boxes. + eps: a small number to avoid 0 as denominator. + Returns: + iou (N): IoU values. + """ + overlap_left_top = np.maximum(boxes0[..., :2], boxes1[..., :2]) + overlap_right_bottom = np.minimum(boxes0[..., 2:], boxes1[..., 2:]) + + overlap_area = area_of(overlap_left_top, overlap_right_bottom) + area0 = area_of(boxes0[..., :2], boxes0[..., 2:]) + area1 = area_of(boxes1[..., :2], boxes1[..., 2:]) + return overlap_area / (area0 + area1 - overlap_area + eps) + + +def center_form_to_corner_form(locations): + return np.concatenate([locations[..., :2] - locations[..., 2:] / 2, + locations[..., :2] + locations[..., 2:] / 2], len(locations.shape) - 1) + + +def corner_form_to_center_form(boxes): + return np.concatenate([ + (boxes[..., :2] + boxes[..., 2:]) / 2, + boxes[..., 2:] - boxes[..., :2] + ], len(boxes.shape) - 1) + + +def hard_nms(box_scores, iou_threshold, top_k=-1, candidate_size=200): + """ + + Args: + box_scores (N, 5): boxes in corner-form and probabilities. + iou_threshold: intersection over union threshold. + top_k: keep top_k results. If k <= 0, keep all the results. + candidate_size: only consider the candidates with the highest scores. + Returns: + picked: a list of indexes of the kept boxes + """ + scores = box_scores[:, -1] + boxes = box_scores[:, :-1] + picked = [] + # _, indexes = scores.sort(descending=True) + indexes = np.argsort(scores) + # indexes = indexes[:candidate_size] + indexes = indexes[-candidate_size:] + while len(indexes) > 0: + # current = indexes[0] + current = indexes[-1] + picked.append(current) + if 0 < top_k == len(picked) or len(indexes) == 1: + break + current_box = boxes[current, :] + # indexes = indexes[1:] + indexes = indexes[:-1] + rest_boxes = boxes[indexes, :] + iou = iou_of( + rest_boxes, + np.expand_dims(current_box, axis=0), + ) + indexes = indexes[iou <= iou_threshold] + + return box_scores[picked, :] diff --git a/face_recognition/face_detect/vision/utils/misc.py b/face_recognition/face_detect/vision/utils/misc.py new file mode 100644 index 0000000000000000000000000000000000000000..ea45dff6b745ee3dc976ae5f62387b92001db9d0 --- /dev/null +++ b/face_recognition/face_detect/vision/utils/misc.py @@ -0,0 +1,46 @@ +import datetime + +import torch + + +def str2bool(s): + return s.lower() in ('true', '1') + + +class Timer: + def __init__(self): + self.clock = {} + + def start(self, key="default"): + self.clock[key] = datetime.datetime.now() + + def end(self, key="default"): + if key not in self.clock: + raise Exception(f"{key} is not in the clock.") + interval = datetime.datetime.now() - self.clock[key] + del self.clock[key] + return interval.total_seconds() + + +def save_checkpoint(epoch, net_state_dict, optimizer_state_dict, best_score, checkpoint_path, model_path): + torch.save({ + 'epoch': epoch, + 'model': net_state_dict, + 'optimizer': optimizer_state_dict, + 'best_score': best_score + }, checkpoint_path) + torch.save(net_state_dict, model_path) + + +def load_checkpoint(checkpoint_path): + return torch.load(checkpoint_path) + + +def freeze_net_layers(net): + for param in net.parameters(): + param.requires_grad = False + + +def store_labels(path, labels): + with open(path, "w") as f: + f.write("\n".join(labels)) diff --git a/face_recognition/face_detect/widerface_evaluate/box_overlaps.pyx b/face_recognition/face_detect/widerface_evaluate/box_overlaps.pyx new file mode 100644 index 0000000000000000000000000000000000000000..ad326ba1df99100255b9c2c1812f7d351d8fdb4c --- /dev/null +++ b/face_recognition/face_detect/widerface_evaluate/box_overlaps.pyx @@ -0,0 +1,55 @@ +# -------------------------------------------------------- +# Fast R-CNN +# Copyright (c) 2015 Microsoft +# Licensed under The MIT License [see LICENSE for details] +# Written by Sergey Karayev +# -------------------------------------------------------- + +cimport cython +import numpy as np +cimport numpy as np + +DTYPE = np.float +ctypedef np.float_t DTYPE_t + +def bbox_overlaps( + np.ndarray[DTYPE_t, ndim=2] boxes, + np.ndarray[DTYPE_t, ndim=2] query_boxes): + """ + Parameters + ---------- + boxes: (N, 4) ndarray of float + query_boxes: (K, 4) ndarray of float + Returns + ------- + overlaps: (N, K) ndarray of overlap between boxes and query_boxes + """ + cdef unsigned int N = boxes.shape[0] + cdef unsigned int K = query_boxes.shape[0] + cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE) + cdef DTYPE_t iw, ih, box_area + cdef DTYPE_t ua + cdef unsigned int k, n + for k in range(K): + box_area = ( + (query_boxes[k, 2] - query_boxes[k, 0] + 1) * + (query_boxes[k, 3] - query_boxes[k, 1] + 1) + ) + for n in range(N): + iw = ( + min(boxes[n, 2], query_boxes[k, 2]) - + max(boxes[n, 0], query_boxes[k, 0]) + 1 + ) + if iw > 0: + ih = ( + min(boxes[n, 3], query_boxes[k, 3]) - + max(boxes[n, 1], query_boxes[k, 1]) + 1 + ) + if ih > 0: + ua = float( + (boxes[n, 2] - boxes[n, 0] + 1) * + (boxes[n, 3] - boxes[n, 1] + 1) + + box_area - iw * ih + ) + overlaps[n, k] = iw * ih / ua + return overlaps \ No newline at end of file diff --git a/face_recognition/face_detect/widerface_evaluate/evaluation.py b/face_recognition/face_detect/widerface_evaluate/evaluation.py new file mode 100644 index 0000000000000000000000000000000000000000..4bc2f3c9d3e24a0a1da78884e17caff612f42823 --- /dev/null +++ b/face_recognition/face_detect/widerface_evaluate/evaluation.py @@ -0,0 +1,302 @@ +""" +WiderFace evaluation code +author: wondervictor +mail: tianhengcheng@gmail.com +copyright@wondervictor +""" + +import os +import tqdm +import pickle +import argparse +import numpy as np +from scipy.io import loadmat +from bbox import bbox_overlaps + + +def get_gt_boxes(gt_dir): + """ gt dir: (wider_face_val.mat, wider_easy_val.mat, wider_medium_val.mat, wider_hard_val.mat)""" + + gt_mat = loadmat(os.path.join(gt_dir, 'wider_face_val.mat')) + hard_mat = loadmat(os.path.join(gt_dir, 'wider_hard_val.mat')) + medium_mat = loadmat(os.path.join(gt_dir, 'wider_medium_val.mat')) + easy_mat = loadmat(os.path.join(gt_dir, 'wider_easy_val.mat')) + + facebox_list = gt_mat['face_bbx_list'] + event_list = gt_mat['event_list'] + file_list = gt_mat['file_list'] + + hard_gt_list = hard_mat['gt_list'] + medium_gt_list = medium_mat['gt_list'] + easy_gt_list = easy_mat['gt_list'] + + return facebox_list, event_list, file_list, hard_gt_list, medium_gt_list, easy_gt_list + + +def get_gt_boxes_from_txt(gt_path, cache_dir): + + cache_file = os.path.join(cache_dir, 'gt_cache.pkl') + if os.path.exists(cache_file): + f = open(cache_file, 'rb') + boxes = pickle.load(f) + f.close() + return boxes + + f = open(gt_path, 'r') + state = 0 + lines = f.readlines() + lines = list(map(lambda x: x.rstrip('\r\n'), lines)) + boxes = {} + print(len(lines)) + f.close() + current_boxes = [] + current_name = None + for line in lines: + if state == 0 and '--' in line: + state = 1 + current_name = line + continue + if state == 1: + state = 2 + continue + + if state == 2 and '--' in line: + state = 1 + boxes[current_name] = np.array(current_boxes).astype('float32') + current_name = line + current_boxes = [] + continue + + if state == 2: + box = [float(x) for x in line.split(' ')[:4]] + current_boxes.append(box) + continue + + f = open(cache_file, 'wb') + pickle.dump(boxes, f) + f.close() + return boxes + + +def read_pred_file(filepath): + + with open(filepath, 'r') as f: + lines = f.readlines() + img_file = lines[0].rstrip('\n\r') + lines = lines[2:] + + # b = lines[0].rstrip('\r\n').split(' ')[:-1] + # c = float(b) + # a = map(lambda x: [[float(a[0]), float(a[1]), float(a[2]), float(a[3]), float(a[4])] for a in x.rstrip('\r\n').split(' ')], lines) + boxes = [] + for line in lines: + line = line.rstrip('\r\n').split(' ') + if line[0] == '': + continue + # a = float(line[4]) + boxes.append([float(line[0]), float(line[1]), float(line[2]), float(line[3]), float(line[4])]) + boxes = np.array(boxes) + # boxes = np.array(list(map(lambda x: [float(a) for a in x.rstrip('\r\n').split(' ')], lines))).astype('float') + return img_file.split('/')[-1], boxes + + +def get_preds(pred_dir): + events = os.listdir(pred_dir) + boxes = dict() + pbar = tqdm.tqdm(events) + + for event in pbar: + pbar.set_description('Reading Predictions ') + event_dir = os.path.join(pred_dir, event) + event_images = os.listdir(event_dir) + current_event = dict() + for imgtxt in event_images: + imgname, _boxes = read_pred_file(os.path.join(event_dir, imgtxt)) + current_event[imgname.rstrip('.jpg')] = _boxes + boxes[event] = current_event + return boxes + + +def norm_score(pred): + """ norm score + pred {key: [[x1,y1,x2,y2,s]]} + """ + + max_score = 0 + min_score = 1 + + for _, k in pred.items(): + for _, v in k.items(): + if len(v) == 0: + continue + _min = np.min(v[:, -1]) + _max = np.max(v[:, -1]) + max_score = max(_max, max_score) + min_score = min(_min, min_score) + + diff = max_score - min_score + for _, k in pred.items(): + for _, v in k.items(): + if len(v) == 0: + continue + v[:, -1] = (v[:, -1] - min_score)/diff + + +def image_eval(pred, gt, ignore, iou_thresh): + """ single image evaluation + pred: Nx5 + gt: Nx4 + ignore: + """ + + _pred = pred.copy() + _gt = gt.copy() + pred_recall = np.zeros(_pred.shape[0]) + recall_list = np.zeros(_gt.shape[0]) + proposal_list = np.ones(_pred.shape[0]) + + _pred[:, 2] = _pred[:, 2] + _pred[:, 0] + _pred[:, 3] = _pred[:, 3] + _pred[:, 1] + _gt[:, 2] = _gt[:, 2] + _gt[:, 0] + _gt[:, 3] = _gt[:, 3] + _gt[:, 1] + + overlaps = bbox_overlaps(_pred[:, :4], _gt) + + for h in range(_pred.shape[0]): + + gt_overlap = overlaps[h] + max_overlap, max_idx = gt_overlap.max(), gt_overlap.argmax() + if max_overlap >= iou_thresh: + if ignore[max_idx] == 0: + recall_list[max_idx] = -1 + proposal_list[h] = -1 + elif recall_list[max_idx] == 0: + recall_list[max_idx] = 1 + + r_keep_index = np.where(recall_list == 1)[0] + pred_recall[h] = len(r_keep_index) + return pred_recall, proposal_list + + +def img_pr_info(thresh_num, pred_info, proposal_list, pred_recall): + pr_info = np.zeros((thresh_num, 2)).astype('float') + for t in range(thresh_num): + + thresh = 1 - (t+1)/thresh_num + r_index = np.where(pred_info[:, 4] >= thresh)[0] + if len(r_index) == 0: + pr_info[t, 0] = 0 + pr_info[t, 1] = 0 + else: + r_index = r_index[-1] + p_index = np.where(proposal_list[:r_index+1] == 1)[0] + pr_info[t, 0] = len(p_index) + pr_info[t, 1] = pred_recall[r_index] + return pr_info + + +def dataset_pr_info(thresh_num, pr_curve, count_face): + _pr_curve = np.zeros((thresh_num, 2)) + for i in range(thresh_num): + _pr_curve[i, 0] = pr_curve[i, 1] / pr_curve[i, 0] + _pr_curve[i, 1] = pr_curve[i, 1] / count_face + return _pr_curve + + +def voc_ap(rec, prec): + + # correct AP calculation + # first append sentinel values at the end + mrec = np.concatenate(([0.], rec, [1.])) + mpre = np.concatenate(([0.], prec, [0.])) + + # compute the precision envelope + for i in range(mpre.size - 1, 0, -1): + mpre[i - 1] = np.maximum(mpre[i - 1], mpre[i]) + + # to calculate area under PR curve, look for points + # where X axis (recall) changes value + i = np.where(mrec[1:] != mrec[:-1])[0] + + # and sum (\Delta recall) * prec + ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1]) + return ap + + +def evaluation(pred, gt_path, iou_thresh=0.5): + pred = get_preds(pred) + norm_score(pred) + facebox_list, event_list, file_list, hard_gt_list, medium_gt_list, easy_gt_list = get_gt_boxes(gt_path) + event_num = len(event_list) + thresh_num = 1000 + settings = ['easy', 'medium', 'hard'] + setting_gts = [easy_gt_list, medium_gt_list, hard_gt_list] + aps = [] + for setting_id in range(3): + # different setting + gt_list = setting_gts[setting_id] + count_face = 0 + pr_curve = np.zeros((thresh_num, 2)).astype('float') + # [hard, medium, easy] + pbar = tqdm.tqdm(range(event_num)) + for i in pbar: + pbar.set_description('Processing {}'.format(settings[setting_id])) + event_name = str(event_list[i][0][0]) + img_list = file_list[i][0] + pred_list = pred[event_name] + sub_gt_list = gt_list[i][0] + # img_pr_info_list = np.zeros((len(img_list), thresh_num, 2)) + gt_bbx_list = facebox_list[i][0] + + for j in range(len(img_list)): + pred_info = pred_list[str(img_list[j][0][0])] + + gt_boxes = gt_bbx_list[j][0].astype('float') + keep_index = sub_gt_list[j][0] + count_face += len(keep_index) + + if len(gt_boxes) == 0 or len(pred_info) == 0: + continue + ignore = np.zeros(gt_boxes.shape[0]) + if len(keep_index) != 0: + ignore[keep_index-1] = 1 + pred_recall, proposal_list = image_eval(pred_info, gt_boxes, ignore, iou_thresh) + + _img_pr_info = img_pr_info(thresh_num, pred_info, proposal_list, pred_recall) + + pr_curve += _img_pr_info + pr_curve = dataset_pr_info(thresh_num, pr_curve, count_face) + + propose = pr_curve[:, 0] + recall = pr_curve[:, 1] + + ap = voc_ap(recall, propose) + aps.append(ap) + + print("==================== Results ====================") + print("Easy Val AP: {}".format(aps[0])) + print("Medium Val AP: {}".format(aps[1])) + print("Hard Val AP: {}".format(aps[2])) + print("=================================================") + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('-p', '--pred', default="./widerface_txt/") + parser.add_argument('-g', '--gt', default='./ground_truth/') + + args = parser.parse_args() + evaluation(args.pred, args.gt) + + + + + + + + + + + + diff --git a/face_recognition/face_detect/widerface_evaluate/evaluation_on_widerface.py b/face_recognition/face_detect/widerface_evaluate/evaluation_on_widerface.py new file mode 100644 index 0000000000000000000000000000000000000000..8081011ee29e1886fb0b17cf583ee20472ec939c --- /dev/null +++ b/face_recognition/face_detect/widerface_evaluate/evaluation_on_widerface.py @@ -0,0 +1,73 @@ +#!/usr/bin/ python3 +# -*- coding: utf-8 -*- +# @Time : 2019-10-17 +# @Author : vealocia +# @FileName: evaluation_on_widerface.py + +import math +import os +import sys + +import cv2 +sys.path.append('../') +from vision.ssd.config.fd_config import define_img_size + +input_img_size = 320 # define input size ,default optional(128/160/320/480/640/1280) +define_img_size(input_img_size) # must put define_img_size() before 'import create_mb_tiny_fd, create_mb_tiny_fd_predictor' + +from vision.ssd.mb_tiny_fd import create_mb_tiny_fd, create_mb_tiny_fd_predictor +from vision.ssd.mb_tiny_RFB_fd import create_Mb_Tiny_RFB_fd, create_Mb_Tiny_RFB_fd_predictor + +label_path = "../models/voc-model-labels.txt" + +# net_type = "slim" # inference faster,lower precision +net_type = "RFB" # inference lower,higher precision + +class_names = [name.strip() for name in open(label_path).readlines()] +num_classes = len(class_names) +test_device = "cuda:0" +# test_device = "cpu" +candidate_size = 800 +threshold = 0.1 + +val_image_root = "/pic/linzai/1080Ti/home_linzai/PycharmProjects/insightface/RetinaFace/data/retinaface/val" # path to widerface valuation image root +val_result_txt_save_root = "./widerface_evaluation/" # result directory + +if net_type == 'slim': + model_path = "../models/pretrained/version-slim-320.pth" + # model_path = "../models/pretrained/version-slim-640.pth" + net = create_mb_tiny_fd(len(class_names), is_test=True, device=test_device) + predictor = create_mb_tiny_fd_predictor(net, candidate_size=candidate_size, device=test_device) +elif net_type == 'RFB': + model_path = "../models/pretrained/version-RFB-320.pth" + # model_path = "../models/pretrained/version-RFB-640.pth" + net = create_Mb_Tiny_RFB_fd(len(class_names), is_test=True, device=test_device) + predictor = create_Mb_Tiny_RFB_fd_predictor(net, candidate_size=candidate_size, device=test_device) +else: + print("The net type is wrong!") + sys.exit(1) +net.load(model_path) + +counter = 0 +for parent, dir_names, file_names in os.walk(val_image_root): + for file_name in file_names: + if not file_name.lower().endswith('jpg'): + continue + im = cv2.imread(os.path.join(parent, file_name), cv2.IMREAD_COLOR) + im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) + boxes, labels, probs = predictor.predict(im, candidate_size / 2, threshold) + + event_name = parent.split('/')[-1] + if not os.path.exists(os.path.join(val_result_txt_save_root, event_name)): + os.makedirs(os.path.join(val_result_txt_save_root, event_name)) + fout = open(os.path.join(val_result_txt_save_root, event_name, file_name.split('.')[0] + '.txt'), 'w') + fout.write(file_name.split('.')[0] + '\n') + fout.write(str(boxes.size(0)) + '\n') + for i in range(boxes.size(0)): + bbox = boxes[i, :] + fout.write('%d %d %d %d %.03f' % (math.floor(bbox[0]), math.floor(bbox[1]), math.ceil(bbox[2] - bbox[0]), math.ceil(bbox[3] - bbox[1]), probs[i] if probs[i] <= 1 else 1) + '\n') + fout.close() + counter += 1 + print('[%d] %s is processed.' % (counter, file_name)) + +# note: with score_threshold = 0.11 and hard_nms, MAP of 320-input model on widerface val set is: 0.785/0.695/0.431 diff --git a/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_easy_val.mat b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_easy_val.mat new file mode 100644 index 0000000000000000000000000000000000000000..5b78df7c006982ab1a2038149f1f5168b2237f07 Binary files /dev/null and b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_easy_val.mat differ diff --git a/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_face_val.mat b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_face_val.mat new file mode 100644 index 0000000000000000000000000000000000000000..7ac47e55b72d04c5fa237321509b2d2319f8ded2 Binary files /dev/null and b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_face_val.mat differ diff --git a/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_hard_val.mat b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_hard_val.mat new file mode 100644 index 0000000000000000000000000000000000000000..061fcab0761d4fb6a0574756ae5c3d4591aecfc7 Binary files /dev/null and b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_hard_val.mat differ diff --git a/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_medium_val.mat b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_medium_val.mat new file mode 100644 index 0000000000000000000000000000000000000000..9670c7a96d8af29c59d6b08cab7765b8bc427182 Binary files /dev/null and b/face_recognition/face_detect/widerface_evaluate/ground_truth/wider_medium_val.mat differ diff --git a/face_recognition/face_detect/widerface_evaluate/setup.py b/face_recognition/face_detect/widerface_evaluate/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..74dba05b3809f76de0db678342d5c94520c5066c --- /dev/null +++ b/face_recognition/face_detect/widerface_evaluate/setup.py @@ -0,0 +1,13 @@ +""" +WiderFace evaluation code +author: wondervictor +mail: tianhengcheng@gmail.com +copyright@wondervictor +""" + +from distutils.core import setup, Extension +from Cython.Build import cythonize +import numpy + +package = Extension('bbox', ['box_overlaps.pyx'], include_dirs=[numpy.get_include()]) +setup(ext_modules=cythonize([package])) diff --git a/face_recognition/face_feature/GetFeature.py b/face_recognition/face_feature/GetFeature.py new file mode 100644 index 0000000000000000000000000000000000000000..6eacbcb7a22a3ef2c0c900f0fa71d1ace0917ee4 --- /dev/null +++ b/face_recognition/face_feature/GetFeature.py @@ -0,0 +1,24 @@ + +import cv2 +import numpy as np +import torch +from face_feature.irn50_pytorch import irn50_pytorch +from face_util.faceutil import align_vertical + +import ctypes + +model_feature = irn50_pytorch("./face_recognition/face_feature/irn50_pytorch.npy") +model_feature.eval() +feature_align_image = np.zeros([128, 128, 3], dtype=np.uint8) + +def get_face_feature(image, landmark): + landmark_vec = (ctypes.c_float * len(landmark))(*landmark) + align_vertical(image, image.shape[1], image.shape[0], feature_align_image, 128, 128, 3, landmark_vec, 48, 64, 40) + # cv2.imwrite("D:/align.png", feature_align_image) + feature_align_image_proc = feature_align_image / 256 + feature_align_image_proc = torch.from_numpy(feature_align_image_proc.astype(np.float32)) + feature_align_image_proc = feature_align_image_proc.permute(2, 0, 1) + feature_align_image_proc = feature_align_image_proc.unsqueeze(0) + feature_out = model_feature(feature_align_image_proc) + feature_out = torch.nn.functional.normalize(feature_out)[0, :] + return feature_align_image, feature_out.data.numpy() diff --git a/face_recognition/face_feature/__pycache__/GetFeature.cpython-310.pyc b/face_recognition/face_feature/__pycache__/GetFeature.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aa84020394c27f9172db768f387ac4915a181f6a Binary files /dev/null and b/face_recognition/face_feature/__pycache__/GetFeature.cpython-310.pyc differ diff --git a/face_recognition/face_feature/__pycache__/irn50_pytorch.cpython-310.pyc b/face_recognition/face_feature/__pycache__/irn50_pytorch.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47b7614c18c175fc9dd3bb248a5261c826ed72b2 Binary files /dev/null and b/face_recognition/face_feature/__pycache__/irn50_pytorch.cpython-310.pyc differ diff --git a/face_recognition/face_feature/irn50_pytorch.npy b/face_recognition/face_feature/irn50_pytorch.npy new file mode 100644 index 0000000000000000000000000000000000000000..07e875e57243445905cd581cf7cc4e4ca334964d --- /dev/null +++ b/face_recognition/face_feature/irn50_pytorch.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56a68eb98fe85c1db44947d0ee1715659a7b9b9decce7e3b7d0a819e07b68511 +size 56273641 diff --git a/face_recognition/face_feature/irn50_pytorch.py b/face_recognition/face_feature/irn50_pytorch.py new file mode 100644 index 0000000000000000000000000000000000000000..78b43b216ef10e74cefe2a0f3bd704679b74d35a --- /dev/null +++ b/face_recognition/face_feature/irn50_pytorch.py @@ -0,0 +1,288 @@ +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F +import math + +_weights_dict = dict() + +def load_weights(weight_file): + if weight_file == None: + return + + try: + weights_dict = np.load(weight_file, allow_pickle=True).item() + except: + weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item() + + return weights_dict + +class irn50_pytorch(nn.Module): + def __init__(self, weight_file): + super(irn50_pytorch, self).__init__() + global _weights_dict + _weights_dict = load_weights(weight_file) + + self.Convolution1 = self.__conv(2, name='Convolution1', in_channels=3, out_channels=32, kernel_size=(3, 3), stride=(2, 2), groups=1, bias=False) + self.BatchNorm1 = self.__batch_normalization(2, 'BatchNorm1', num_features=32, eps=9.999999747378752e-06, momentum=0.0) + self.Convolution2 = self.__conv(2, name='Convolution2', in_channels=32, out_channels=32, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.BatchNorm2 = self.__batch_normalization(2, 'BatchNorm2', num_features=32, eps=9.999999747378752e-06, momentum=0.0) + self.Convolution3 = self.__conv(2, name='Convolution3', in_channels=32, out_channels=64, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.BatchNorm3 = self.__batch_normalization(2, 'BatchNorm3', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.Convolution4 = self.__conv(2, name='Convolution4', in_channels=64, out_channels=80, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.BatchNorm4 = self.__batch_normalization(2, 'BatchNorm4', num_features=80, eps=9.999999747378752e-06, momentum=0.0) + self.Convolution5 = self.__conv(2, name='Convolution5', in_channels=80, out_channels=192, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.BatchNorm5 = self.__batch_normalization(2, 'BatchNorm5', num_features=192, eps=9.999999747378752e-06, momentum=0.0) + self.Convolution6 = self.__conv(2, name='Convolution6', in_channels=192, out_channels=256, kernel_size=(3, 3), stride=(2, 2), groups=1, bias=False) + self.BatchNorm6 = self.__batch_normalization(2, 'BatchNorm6', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res1_proj = self.__conv(2, name='conv2_res1_proj', in_channels=256, out_channels=256, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv2_res1_conv1 = self.__conv(2, name='conv2_res1_conv1', in_channels=256, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv2_res1_conv1_bn = self.__batch_normalization(2, 'conv2_res1_conv1_bn', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res1_conv2 = self.__conv(2, name='conv2_res1_conv2', in_channels=64, out_channels=64, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv2_res1_conv2_bn = self.__batch_normalization(2, 'conv2_res1_conv2_bn', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res1_conv3 = self.__conv(2, name='conv2_res1_conv3', in_channels=64, out_channels=256, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv2_res2_pre_bn = self.__batch_normalization(2, 'conv2_res2_pre_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res2_conv1 = self.__conv(2, name='conv2_res2_conv1', in_channels=256, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv2_res2_conv1_bn = self.__batch_normalization(2, 'conv2_res2_conv1_bn', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res2_conv2 = self.__conv(2, name='conv2_res2_conv2', in_channels=64, out_channels=64, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv2_res2_conv2_bn = self.__batch_normalization(2, 'conv2_res2_conv2_bn', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res2_conv3 = self.__conv(2, name='conv2_res2_conv3', in_channels=64, out_channels=256, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv2_res3_pre_bn = self.__batch_normalization(2, 'conv2_res3_pre_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res3_conv1 = self.__conv(2, name='conv2_res3_conv1', in_channels=256, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv2_res3_conv1_bn = self.__batch_normalization(2, 'conv2_res3_conv1_bn', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res3_conv2 = self.__conv(2, name='conv2_res3_conv2', in_channels=64, out_channels=64, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv2_res3_conv2_bn = self.__batch_normalization(2, 'conv2_res3_conv2_bn', num_features=64, eps=9.999999747378752e-06, momentum=0.0) + self.conv2_res3_conv3 = self.__conv(2, name='conv2_res3_conv3', in_channels=64, out_channels=256, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res1_pre_bn = self.__batch_normalization(2, 'conv3_res1_pre_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res1_proj = self.__conv(2, name='conv3_res1_proj', in_channels=256, out_channels=512, kernel_size=(1, 1), stride=(2, 2), groups=1, bias=False) + self.conv3_res1_conv1 = self.__conv(2, name='conv3_res1_conv1', in_channels=256, out_channels=128, kernel_size=(1, 1), stride=(2, 2), groups=1, bias=False) + self.conv3_res1_conv1_bn = self.__batch_normalization(2, 'conv3_res1_conv1_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res1_conv2 = self.__conv(2, name='conv3_res1_conv2', in_channels=128, out_channels=128, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv3_res1_conv2_bn = self.__batch_normalization(2, 'conv3_res1_conv2_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res1_conv3 = self.__conv(2, name='conv3_res1_conv3', in_channels=128, out_channels=512, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res2_pre_bn = self.__batch_normalization(2, 'conv3_res2_pre_bn', num_features=512, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res2_conv1 = self.__conv(2, name='conv3_res2_conv1', in_channels=512, out_channels=128, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res2_conv1_bn = self.__batch_normalization(2, 'conv3_res2_conv1_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res2_conv2 = self.__conv(2, name='conv3_res2_conv2', in_channels=128, out_channels=128, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv3_res2_conv2_bn = self.__batch_normalization(2, 'conv3_res2_conv2_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res2_conv3 = self.__conv(2, name='conv3_res2_conv3', in_channels=128, out_channels=512, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res3_pre_bn = self.__batch_normalization(2, 'conv3_res3_pre_bn', num_features=512, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res3_conv1 = self.__conv(2, name='conv3_res3_conv1', in_channels=512, out_channels=128, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res3_conv1_bn = self.__batch_normalization(2, 'conv3_res3_conv1_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res3_conv2 = self.__conv(2, name='conv3_res3_conv2', in_channels=128, out_channels=128, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv3_res3_conv2_bn = self.__batch_normalization(2, 'conv3_res3_conv2_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res3_conv3 = self.__conv(2, name='conv3_res3_conv3', in_channels=128, out_channels=512, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res4_pre_bn = self.__batch_normalization(2, 'conv3_res4_pre_bn', num_features=512, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res4_conv1 = self.__conv(2, name='conv3_res4_conv1', in_channels=512, out_channels=128, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv3_res4_conv1_bn = self.__batch_normalization(2, 'conv3_res4_conv1_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res4_conv2 = self.__conv(2, name='conv3_res4_conv2', in_channels=128, out_channels=128, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv3_res4_conv2_bn = self.__batch_normalization(2, 'conv3_res4_conv2_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv3_res4_conv3 = self.__conv(2, name='conv3_res4_conv3', in_channels=128, out_channels=512, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res1_pre_bn = self.__batch_normalization(2, 'conv4_res1_pre_bn', num_features=512, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res1_proj = self.__conv(2, name='conv4_res1_proj', in_channels=512, out_channels=512, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res1_conv1 = self.__conv(2, name='conv4_res1_conv1', in_channels=512, out_channels=128, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv4_res1_conv1_bn = self.__batch_normalization(2, 'conv4_res1_conv1_bn', num_features=128, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res1_conv2 = self.__conv(2, name='conv4_res1_conv2', in_channels=128, out_channels=512, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res2_pre_bn = self.__batch_normalization(2, 'conv4_res2_pre_bn', num_features=512, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res2_conv1_proj = self.__conv(2, name='conv4_res2_conv1_proj', in_channels=512, out_channels=1024, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res2_conv1 = self.__conv(2, name='conv4_res2_conv1', in_channels=512, out_channels=256, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res2_conv1_bn = self.__batch_normalization(2, 'conv4_res2_conv1_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res2_conv2 = self.__conv(2, name='conv4_res2_conv2', in_channels=256, out_channels=256, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv4_res2_conv2_bn = self.__batch_normalization(2, 'conv4_res2_conv2_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res2_conv3 = self.__conv(2, name='conv4_res2_conv3', in_channels=256, out_channels=1024, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res3_pre_bn = self.__batch_normalization(2, 'conv4_res3_pre_bn', num_features=1024, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res3_conv1 = self.__conv(2, name='conv4_res3_conv1', in_channels=1024, out_channels=256, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv4_res3_conv1_bn = self.__batch_normalization(2, 'conv4_res3_conv1_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res3_conv2 = self.__conv(2, name='conv4_res3_conv2', in_channels=256, out_channels=256, kernel_size=(3, 3), stride=(1, 1), groups=1, bias=False) + self.conv4_res3_conv2_bn = self.__batch_normalization(2, 'conv4_res3_conv2_bn', num_features=256, eps=9.999999747378752e-06, momentum=0.0) + self.conv4_res3_conv3 = self.__conv(2, name='conv4_res3_conv3', in_channels=256, out_channels=1024, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=False) + self.conv5_bn = self.__batch_normalization(2, 'conv5_bn', num_features=1024, eps=9.999999747378752e-06, momentum=0.0) + self.fc1_1 = self.__dense(name = 'fc1_1', in_features = 16384, out_features = 512, bias = False) + self.bn_fc1 = self.__batch_normalization(1, 'bn_fc1', num_features=512, eps=9.999999747378752e-06, momentum=0.0) + + def forward(self, x): + Convolution1 = self.Convolution1(x) + BatchNorm1 = self.BatchNorm1(Convolution1) + ReLU1 = F.relu(BatchNorm1) + Convolution2 = self.Convolution2(ReLU1) + BatchNorm2 = self.BatchNorm2(Convolution2) + ReLU2 = F.relu(BatchNorm2) + Convolution3_pad = F.pad(ReLU2, (1, 1, 1, 1)) + Convolution3 = self.Convolution3(Convolution3_pad) + BatchNorm3 = self.BatchNorm3(Convolution3) + ReLU3 = F.relu(BatchNorm3) + Pooling1_pad = F.pad(ReLU3, (0, 1, 0, 1), value=float('-inf')) + Pooling1, Pooling1_idx = F.max_pool2d(Pooling1_pad, kernel_size=(3, 3), stride=(2, 2), padding=0, ceil_mode=False, return_indices=True) + Convolution4 = self.Convolution4(Pooling1) + BatchNorm4 = self.BatchNorm4(Convolution4) + ReLU4 = F.relu(BatchNorm4) + Convolution5 = self.Convolution5(ReLU4) + BatchNorm5 = self.BatchNorm5(Convolution5) + ReLU5 = F.relu(BatchNorm5) + Convolution6_pad = F.pad(ReLU5, (1, 1, 1, 1)) + Convolution6 = self.Convolution6(Convolution6_pad) + BatchNorm6 = self.BatchNorm6(Convolution6) + ReLU6 = F.relu(BatchNorm6) + conv2_res1_proj = self.conv2_res1_proj(ReLU6) + conv2_res1_conv1 = self.conv2_res1_conv1(ReLU6) + conv2_res1_conv1_bn = self.conv2_res1_conv1_bn(conv2_res1_conv1) + conv2_res1_conv1_relu = F.relu(conv2_res1_conv1_bn) + conv2_res1_conv2_pad = F.pad(conv2_res1_conv1_relu, (1, 1, 1, 1)) + conv2_res1_conv2 = self.conv2_res1_conv2(conv2_res1_conv2_pad) + conv2_res1_conv2_bn = self.conv2_res1_conv2_bn(conv2_res1_conv2) + conv2_res1_conv2_relu = F.relu(conv2_res1_conv2_bn) + conv2_res1_conv3 = self.conv2_res1_conv3(conv2_res1_conv2_relu) + conv2_res1 = conv2_res1_proj + conv2_res1_conv3 + conv2_res2_pre_bn = self.conv2_res2_pre_bn(conv2_res1) + conv2_res2_pre_relu = F.relu(conv2_res2_pre_bn) + conv2_res2_conv1 = self.conv2_res2_conv1(conv2_res2_pre_relu) + conv2_res2_conv1_bn = self.conv2_res2_conv1_bn(conv2_res2_conv1) + conv2_res2_conv1_relu = F.relu(conv2_res2_conv1_bn) + conv2_res2_conv2_pad = F.pad(conv2_res2_conv1_relu, (1, 1, 1, 1)) + conv2_res2_conv2 = self.conv2_res2_conv2(conv2_res2_conv2_pad) + conv2_res2_conv2_bn = self.conv2_res2_conv2_bn(conv2_res2_conv2) + conv2_res2_conv2_relu = F.relu(conv2_res2_conv2_bn) + conv2_res2_conv3 = self.conv2_res2_conv3(conv2_res2_conv2_relu) + conv2_res2 = conv2_res1 + conv2_res2_conv3 + conv2_res3_pre_bn = self.conv2_res3_pre_bn(conv2_res2) + conv2_res3_pre_relu = F.relu(conv2_res3_pre_bn) + conv2_res3_conv1 = self.conv2_res3_conv1(conv2_res3_pre_relu) + conv2_res3_conv1_bn = self.conv2_res3_conv1_bn(conv2_res3_conv1) + conv2_res3_conv1_relu = F.relu(conv2_res3_conv1_bn) + conv2_res3_conv2_pad = F.pad(conv2_res3_conv1_relu, (1, 1, 1, 1)) + conv2_res3_conv2 = self.conv2_res3_conv2(conv2_res3_conv2_pad) + conv2_res3_conv2_bn = self.conv2_res3_conv2_bn(conv2_res3_conv2) + conv2_res3_conv2_relu = F.relu(conv2_res3_conv2_bn) + conv2_res3_conv3 = self.conv2_res3_conv3(conv2_res3_conv2_relu) + conv2_res3 = conv2_res2 + conv2_res3_conv3 + conv3_res1_pre_bn = self.conv3_res1_pre_bn(conv2_res3) + conv3_res1_pre_relu = F.relu(conv3_res1_pre_bn) + conv3_res1_proj = self.conv3_res1_proj(conv3_res1_pre_relu) + conv3_res1_conv1 = self.conv3_res1_conv1(conv3_res1_pre_relu) + conv3_res1_conv1_bn = self.conv3_res1_conv1_bn(conv3_res1_conv1) + conv3_res1_conv1_relu = F.relu(conv3_res1_conv1_bn) + conv3_res1_conv2_pad = F.pad(conv3_res1_conv1_relu, (1, 1, 1, 1)) + conv3_res1_conv2 = self.conv3_res1_conv2(conv3_res1_conv2_pad) + conv3_res1_conv2_bn = self.conv3_res1_conv2_bn(conv3_res1_conv2) + conv3_res1_conv2_relu = F.relu(conv3_res1_conv2_bn) + conv3_res1_conv3 = self.conv3_res1_conv3(conv3_res1_conv2_relu) + conv3_res1 = conv3_res1_proj + conv3_res1_conv3 + conv3_res2_pre_bn = self.conv3_res2_pre_bn(conv3_res1) + conv3_res2_pre_relu = F.relu(conv3_res2_pre_bn) + conv3_res2_conv1 = self.conv3_res2_conv1(conv3_res2_pre_relu) + conv3_res2_conv1_bn = self.conv3_res2_conv1_bn(conv3_res2_conv1) + conv3_res2_conv1_relu = F.relu(conv3_res2_conv1_bn) + conv3_res2_conv2_pad = F.pad(conv3_res2_conv1_relu, (1, 1, 1, 1)) + conv3_res2_conv2 = self.conv3_res2_conv2(conv3_res2_conv2_pad) + conv3_res2_conv2_bn = self.conv3_res2_conv2_bn(conv3_res2_conv2) + conv3_res2_conv2_relu = F.relu(conv3_res2_conv2_bn) + conv3_res2_conv3 = self.conv3_res2_conv3(conv3_res2_conv2_relu) + conv3_res2 = conv3_res1 + conv3_res2_conv3 + conv3_res3_pre_bn = self.conv3_res3_pre_bn(conv3_res2) + conv3_res3_pre_relu = F.relu(conv3_res3_pre_bn) + conv3_res3_conv1 = self.conv3_res3_conv1(conv3_res3_pre_relu) + conv3_res3_conv1_bn = self.conv3_res3_conv1_bn(conv3_res3_conv1) + conv3_res3_conv1_relu = F.relu(conv3_res3_conv1_bn) + conv3_res3_conv2_pad = F.pad(conv3_res3_conv1_relu, (1, 1, 1, 1)) + conv3_res3_conv2 = self.conv3_res3_conv2(conv3_res3_conv2_pad) + conv3_res3_conv2_bn = self.conv3_res3_conv2_bn(conv3_res3_conv2) + conv3_res3_conv2_relu = F.relu(conv3_res3_conv2_bn) + conv3_res3_conv3 = self.conv3_res3_conv3(conv3_res3_conv2_relu) + conv3_res3 = conv3_res2 + conv3_res3_conv3 + conv3_res4_pre_bn = self.conv3_res4_pre_bn(conv3_res3) + conv3_res4_pre_relu = F.relu(conv3_res4_pre_bn) + conv3_res4_conv1 = self.conv3_res4_conv1(conv3_res4_pre_relu) + conv3_res4_conv1_bn = self.conv3_res4_conv1_bn(conv3_res4_conv1) + conv3_res4_conv1_relu = F.relu(conv3_res4_conv1_bn) + conv3_res4_conv2_pad = F.pad(conv3_res4_conv1_relu, (1, 1, 1, 1)) + conv3_res4_conv2 = self.conv3_res4_conv2(conv3_res4_conv2_pad) + conv3_res4_conv2_bn = self.conv3_res4_conv2_bn(conv3_res4_conv2) + conv3_res4_conv2_relu = F.relu(conv3_res4_conv2_bn) + conv3_res4_conv3 = self.conv3_res4_conv3(conv3_res4_conv2_relu) + conv3_res4 = conv3_res3 + conv3_res4_conv3 + conv4_res1_pre_bn = self.conv4_res1_pre_bn(conv3_res4) + conv4_res1_pre_relu = F.relu(conv4_res1_pre_bn) + conv4_res1_proj = self.conv4_res1_proj(conv4_res1_pre_relu) + conv4_res1_conv1_pad = F.pad(conv4_res1_pre_relu, (1, 1, 1, 1)) + conv4_res1_conv1 = self.conv4_res1_conv1(conv4_res1_conv1_pad) + conv4_res1_conv1_bn = self.conv4_res1_conv1_bn(conv4_res1_conv1) + conv4_res1_conv1_relu = F.relu(conv4_res1_conv1_bn) + conv4_res1_conv2 = self.conv4_res1_conv2(conv4_res1_conv1_relu) + conv4_res1 = conv4_res1_proj + conv4_res1_conv2 + conv4_res2_pre_bn = self.conv4_res2_pre_bn(conv4_res1) + conv4_res2_pre_relu = F.relu(conv4_res2_pre_bn) + conv4_res2_conv1_proj = self.conv4_res2_conv1_proj(conv4_res2_pre_relu) + conv4_res2_conv1 = self.conv4_res2_conv1(conv4_res2_pre_relu) + conv4_res2_conv1_bn = self.conv4_res2_conv1_bn(conv4_res2_conv1) + conv4_res2_conv1_relu = F.relu(conv4_res2_conv1_bn) + conv4_res2_conv2_pad = F.pad(conv4_res2_conv1_relu, (1, 1, 1, 1)) + conv4_res2_conv2 = self.conv4_res2_conv2(conv4_res2_conv2_pad) + conv4_res2_conv2_bn = self.conv4_res2_conv2_bn(conv4_res2_conv2) + conv4_res2_conv2_relu = F.relu(conv4_res2_conv2_bn) + conv4_res2_conv3 = self.conv4_res2_conv3(conv4_res2_conv2_relu) + conv4_res2 = conv4_res2_conv1_proj + conv4_res2_conv3 + conv4_res3_pre_bn = self.conv4_res3_pre_bn(conv4_res2) + conv4_res3_pre_relu = F.relu(conv4_res3_pre_bn) + conv4_res3_conv1 = self.conv4_res3_conv1(conv4_res3_pre_relu) + conv4_res3_conv1_bn = self.conv4_res3_conv1_bn(conv4_res3_conv1) + conv4_res3_conv1_relu = F.relu(conv4_res3_conv1_bn) + conv4_res3_conv2_pad = F.pad(conv4_res3_conv1_relu, (1, 1, 1, 1)) + conv4_res3_conv2 = self.conv4_res3_conv2(conv4_res3_conv2_pad) + conv4_res3_conv2_bn = self.conv4_res3_conv2_bn(conv4_res3_conv2) + conv4_res3_conv2_relu = F.relu(conv4_res3_conv2_bn) + conv4_res3_conv3 = self.conv4_res3_conv3(conv4_res3_conv2_relu) + conv4_res3 = conv4_res2 + conv4_res3_conv3 + conv5_bn = self.conv5_bn(conv4_res3) + conv5_relu = F.relu(conv5_bn) + pool5 = F.avg_pool2d(conv5_relu, kernel_size=(4, 4), stride=(1, 1), padding=(0,), ceil_mode=False, count_include_pad=False) + fc1_0 = pool5.view(pool5.size(0), -1) + fc1_1 = self.fc1_1(fc1_0) + bn_fc1 = self.bn_fc1(fc1_1) + #return bn_fc1 + bn_fc1 = bn_fc1.reshape(bn_fc1.size()[0], bn_fc1.size()[1]) + slice_fc1, slice_fc2 = bn_fc1[:, :256], bn_fc1[:, 256:] + eltwise_fc1 = torch.max(slice_fc1, slice_fc2) + + return eltwise_fc1 + + @staticmethod + def __conv(dim, name, **kwargs): + if dim == 1: layer = nn.Conv1d(**kwargs) + elif dim == 2: layer = nn.Conv2d(**kwargs) + elif dim == 3: layer = nn.Conv3d(**kwargs) + else: raise NotImplementedError() + + layer.state_dict()['weight'].copy_(torch.from_numpy(_weights_dict[name]['weights'])) + if 'bias' in _weights_dict[name]: + layer.state_dict()['bias'].copy_(torch.from_numpy(_weights_dict[name]['bias'])) + return layer + + @staticmethod + def __batch_normalization(dim, name, **kwargs): + if dim == 0 or dim == 1: layer = nn.BatchNorm1d(**kwargs) + elif dim == 2: layer = nn.BatchNorm2d(**kwargs) + elif dim == 3: layer = nn.BatchNorm3d(**kwargs) + else: raise NotImplementedError() + + if 'scale' in _weights_dict[name]: + layer.state_dict()['weight'].copy_(torch.from_numpy(_weights_dict[name]['scale'])) + else: + layer.weight.data.fill_(1) + + if 'bias' in _weights_dict[name]: + layer.state_dict()['bias'].copy_(torch.from_numpy(_weights_dict[name]['bias'])) + else: + layer.bias.data.fill_(0) + + layer.state_dict()['running_mean'].copy_(torch.from_numpy(_weights_dict[name]['mean'])) + layer.state_dict()['running_var'].copy_(torch.from_numpy(_weights_dict[name]['var'])) + return layer + + @staticmethod + def __dense(name, **kwargs): + layer = nn.Linear(**kwargs) + layer.state_dict()['weight'].copy_(torch.from_numpy(_weights_dict[name]['weights'])) + if 'bias' in _weights_dict[name]: + layer.state_dict()['bias'].copy_(torch.from_numpy(_weights_dict[name]['bias'])) + return layer + diff --git a/face_recognition/face_landmark/GetLandmark.py b/face_recognition/face_landmark/GetLandmark.py new file mode 100644 index 0000000000000000000000000000000000000000..2f253b95a95b694bc53b05c94f9afce2f3551f01 --- /dev/null +++ b/face_recognition/face_landmark/GetLandmark.py @@ -0,0 +1,62 @@ + +import cv2 +import numpy as np +import torch +from face_landmark.MobileFaceNet import MobileFaceNet + +model_landmark = MobileFaceNet(input_size=64, embedding_size=136) +model_landmark.load_state_dict(torch.load("./face_recognition/face_landmark/vfl_1.02_578_6.734591484069824.pth.tar", map_location=torch.device('cpu'))['state_dict']) +model_landmark.eval() + +def get_face_landmark(gray_img, bounding_box): + image = gray_img + box = bounding_box + + nHeight, nWidth = image.shape + + rLeftMargin = 0.05 + rTopMargin = 0.00 + rRightMargin = 0.05 + rBottomMargin = 0.10 + + rW = box[2] - box[0] + rH = box[3] - box[1] + cx = (box[0] + box[2]) / 2 + cy = (box[1] + box[3]) / 2 + sz = pow(rW * rH, 0.5) + rX = cx - sz / 2 + rY = cy - sz / 2 + rW = sz + rH = sz + + #get image range to get face landmark from face rect + iExFaceX = int(rX - rLeftMargin * rW) + iExFaceY = int(rY - rTopMargin * rH) + iExFaceW = int((1 + (rLeftMargin + rRightMargin)) * rW) + iExFaceH = int((1 + (rTopMargin + rBottomMargin)) * rH) + + iExFaceX = np.clip(iExFaceX, 0, nWidth - 1) + iExFaceY = np.clip(iExFaceY, 0, nHeight - 1) + iExFaceW = np.clip(iExFaceX + iExFaceW, 0, nWidth - 1) - iExFaceX + iExFaceH = np.clip(iExFaceY + iExFaceH, 0, nHeight - 1) - iExFaceY + + #crop face image in range to face landmark + image = image[iExFaceY:iExFaceY+iExFaceH, iExFaceX:iExFaceX+iExFaceW] + #normalize croped face image + image = cv2.resize(image, (64, 64), cv2.INTER_LINEAR) + # cv2.imwrite("D:/crop.png", image) + image = image / 256 + image = torch.from_numpy(image.astype(np.float32)) + #convert mask_align_image from type [n,n] to [1,1,n,n] + image = image.unsqueeze(0).unsqueeze(0) + + #get landmark fron croped face image + landmark = model_landmark(image) + #reshape face landmark and convert to image coordinates + landmark = landmark.reshape(68, 2) + landmark[:,0] = landmark[:,0] * iExFaceW + iExFaceX + landmark[:,1] = landmark[:,1] * iExFaceH + iExFaceY + + landmark = landmark.reshape(-1) + + return landmark \ No newline at end of file diff --git a/face_recognition/face_landmark/MobileFaceNet.py b/face_recognition/face_landmark/MobileFaceNet.py new file mode 100644 index 0000000000000000000000000000000000000000..76ddee284f2f4b1a836ea3a45205951f74dc4098 --- /dev/null +++ b/face_recognition/face_landmark/MobileFaceNet.py @@ -0,0 +1,123 @@ +from torch.nn import Linear, Conv2d, BatchNorm1d, BatchNorm2d, PReLU, ReLU, Sigmoid, Dropout2d, Dropout, AvgPool2d, MaxPool2d, AdaptiveAvgPool2d, Sequential, Module, Parameter +import torch.nn.functional as F +import torch +import torch.nn as nn +from collections import namedtuple +import math +import pdb + +################################## Original Arcface Model ############################################################# + +class Flatten(Module): + def forward(self, input): + return input.view(input.size(0), -1) + +################################## MobileFaceNet ############################################################# + +class Conv_block(Module): + def __init__(self, in_c, out_c, kernel=(1, 1), stride=(1, 1), padding=(0, 0), groups=1): + super(Conv_block, self).__init__() + self.conv = Conv2d(in_c, out_channels=out_c, kernel_size=kernel, groups=groups, stride=stride, padding=padding, bias=False) + self.bn = BatchNorm2d(out_c) + self.relu = ReLU(out_c) + def forward(self, x): + x = self.conv(x) + x = self.bn(x) + x = self.relu(x) + return x + +class Linear_block(Module): + def __init__(self, in_c, out_c, kernel=(1, 1), stride=(1, 1), padding=(0, 0), groups=1): + super(Linear_block, self).__init__() + self.conv = Conv2d(in_c, out_channels=out_c, kernel_size=kernel, groups=groups, stride=stride, padding=padding, bias=False) + self.bn = BatchNorm2d(out_c) + def forward(self, x): + x = self.conv(x) + x = self.bn(x) + return x + +class Depth_Wise(Module): + def __init__(self, in_c, out_c, residual = False, kernel=(3, 3), stride=(2, 2), padding=(1, 1), groups=1): + super(Depth_Wise, self).__init__() + self.conv = Conv_block(in_c, out_c=groups, kernel=(1, 1), padding=(0, 0), stride=(1, 1)) + self.conv_dw = Conv_block(groups, groups, groups=groups, kernel=kernel, padding=padding, stride=stride) + self.project = Linear_block(groups, out_c, kernel=(1, 1), padding=(0, 0), stride=(1, 1)) + self.residual = residual + def forward(self, x): + if self.residual: + short_cut = x + x = self.conv(x) + x = self.conv_dw(x) + x = self.project(x) + if self.residual: + output = short_cut + x + else: + output = x + return output + +class Residual(Module): + def __init__(self, c, num_block, groups, kernel=(3, 3), stride=(1, 1), padding=(1, 1)): + super(Residual, self).__init__() + modules = [] + for _ in range(num_block): + modules.append(Depth_Wise(c, c, residual=True, kernel=kernel, padding=padding, stride=stride, groups=groups)) + self.model = Sequential(*modules) + def forward(self, x): + return self.model(x) + +class GDC(Module): + def __init__(self, embedding_size): + super(GDC, self).__init__() + self.conv_6_dw = Linear_block(512, 512, groups=512, kernel=(4,4), stride=(1, 1), padding=(0, 0)) + self.linear = Linear(512, embedding_size, bias=True) + self.bn = BatchNorm1d(embedding_size) + + def forward(self, x): + x = self.conv_6_dw(x) + x = torch.flatten(x, 1) + x = self.linear(x) + x = self.bn(x) + return x + +class MobileFaceNet(Module): + def __init__(self, input_size, embedding_size = 512): + super(MobileFaceNet, self).__init__() + self.conv1 = Conv_block(1, 32, kernel=(3, 3), stride=(2, 2), padding=(1, 1)) + self.conv2_dw = Conv_block(32, 32, kernel=(3, 3), stride=(1, 1), padding=(1, 1), groups=32) + self.conv_23 = Depth_Wise(32, 32, kernel=(3, 3), stride=(2, 2), padding=(1, 1), groups=64) + self.conv_3 = Residual(32, num_block=3, groups=64, kernel=(3, 3), stride=(1, 1), padding=(1, 1)) + self.conv_34 = Depth_Wise(32, 64, kernel=(3, 3), stride=(2, 2), padding=(1, 1), groups=128) + self.conv_4 = Residual(64, num_block=4, groups=128, kernel=(3, 3), stride=(1, 1), padding=(1, 1)) + self.conv_45 = Depth_Wise(64, 64, kernel=(3, 3), stride=(2, 2), padding=(1, 1), groups=256) + self.conv_5 = Residual(64, num_block=2, groups=128, kernel=(3, 3), stride=(1, 1), padding=(1, 1)) + self.conv_6_sep = Conv_block(64, 512, kernel=(1, 1), stride=(1, 1), padding=(0, 0)) + self.output_layer = GDC(embedding_size) + self._initialize_weights() + + def _initialize_weights(self): + for m in self.modules(): + if isinstance(m, nn.Conv2d): + nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') + if m.bias is not None: + m.bias.data.zero_() + elif isinstance(m, nn.BatchNorm2d): + m.weight.data.fill_(1) + m.bias.data.zero_() + elif isinstance(m, nn.Linear): + nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') + if m.bias is not None: + m.bias.data.zero_() + + + def forward(self, x): + out = self.conv1(x) + out = self.conv2_dw(out) + out = self.conv_23(out) + out = self.conv_3(out) + out = self.conv_34(out) + out = self.conv_4(out) + out = self.conv_45(out) + out = self.conv_5(out) + conv_features = self.conv_6_sep(out) + out = self.output_layer(conv_features) + return out diff --git a/face_recognition/face_landmark/__pycache__/GetLandmark.cpython-310.pyc b/face_recognition/face_landmark/__pycache__/GetLandmark.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52a118dbb756ad4f7f952d5a8e48d1654dcad5df Binary files /dev/null and b/face_recognition/face_landmark/__pycache__/GetLandmark.cpython-310.pyc differ diff --git a/face_recognition/face_landmark/__pycache__/MobileFaceNet.cpython-310.pyc b/face_recognition/face_landmark/__pycache__/MobileFaceNet.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1fd8147d16e63bd11388ebe669bea9b9afbe98cd Binary files /dev/null and b/face_recognition/face_landmark/__pycache__/MobileFaceNet.cpython-310.pyc differ diff --git a/face_recognition/face_landmark/vfl_1.02_578_6.734591484069824.pth.tar b/face_recognition/face_landmark/vfl_1.02_578_6.734591484069824.pth.tar new file mode 100644 index 0000000000000000000000000000000000000000..fa2f95c7845779a63e5c86cfdaa0eae406903338 --- /dev/null +++ b/face_recognition/face_landmark/vfl_1.02_578_6.734591484069824.pth.tar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:956d0864c51166f1e02cfc1e24c2b9426340a7bcbcfcad789b0a3317f0b2470d +size 3723879 diff --git a/face_recognition/face_manage/__pycache__/manage.cpython-310.pyc b/face_recognition/face_manage/__pycache__/manage.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb2eefdeaf38c73a9c47b72715f78760de2e37d3 Binary files /dev/null and b/face_recognition/face_manage/__pycache__/manage.cpython-310.pyc differ diff --git a/face_recognition/face_manage/manage.py b/face_recognition/face_manage/manage.py new file mode 100644 index 0000000000000000000000000000000000000000..e610fa19d6df3ff0a47573daf785bf6244a7803f --- /dev/null +++ b/face_recognition/face_manage/manage.py @@ -0,0 +1,161 @@ +import sqlite3 +import sys +import os +import os.path +import numpy as np + +database_base_name = os.path.abspath(os.path.dirname(__file__)) + '\\person' +table_name = "feature" +sqlite_insert_blob_query = "INSERT INTO " + table_name + " (id, filename, count, boxes, landmarks, alignimgs, features) VALUES (?, ?, ?, ?, ?, ?, ?)" +sqlite_create_table_query = "CREATE TABLE " + table_name + " ( id INTEGER PRIMARY KEY, filename TEXT, count INTEGER, boxes BLOB NOT NULL, landmarks BLOB NOT NULL, alignimgs BLOB NOT NULL, features BLOB NOT NULL)" + +sqlite_update_all_query = "UPDATE " + table_name + " set filename = ?, count = ?, boxes = ?, landmarks = ?, alignimgs = ?, features = ? where id = ?" +sqlite_search_query = "SELECT * FROM " + table_name +sqlite_delete_all = "DELETE FROM " + table_name + +data_all = [] +threshold = 68 +max_feat_count = 8 +max_id = -1 +feature_update = False + +face_database = None + +#open databse +def open_database(db_no): + + global max_id + global face_database + + db_name = database_base_name + str(db_no) + ".db" + face_database = sqlite3.connect(db_name) + cursor = face_database.execute("SELECT name FROM sqlite_master WHERE type='table';") + #check tables exist in database + tables = [ + v[0] for v in cursor.fetchall() + if v[0] != "sqlite_sequence" + ] + cursor.close() + + if not "feature" in tables: + face_database.execute(sqlite_create_table_query) + + cursor = face_database.execute(sqlite_search_query) + + #load index and feature in "feature table" + for row in cursor.fetchall(): + id = row[0] + filename = row[1] + count = row[2] + boxes = np.fromstring(row[3], dtype=np.float32) + landmarks = np.fromstring(row[4], dtype=np.float32) + alignimgs = np.fromstring(row[5], dtype=np.uint8) + features = np.fromstring(row[6], dtype=np.float32) + + if not boxes.shape[0] == count * 4: + continue + if not landmarks.shape[0] == count * 136: + continue + if not alignimgs.shape[0] == count * 49152: + continue + if not features.shape[0] == count * 256: + continue + + boxes = boxes.reshape(count, 4) + landmarks = landmarks.reshape(count, 136) + alignimgs = alignimgs.reshape(count, 49152) + features = features.reshape(count, 256) + + data_all.append({'id':id, 'filename':filename, 'count':count, 'boxes':boxes, 'landmarks':landmarks, 'alignimgs':alignimgs, 'features':features}) + if id > max_id: + max_id = id + cursor.close() + +#create database +def create_database(): + db_no = 0 + db_name = "" + while True: + db_name = database_base_name + str(db_no) + ".db" + if not os.path.isfile(db_name): + break + db_no += 1 + open_database(db_no) + +def clear_database(): + global face_database + + data_all.clear() + cursor = face_database.cursor() + cursor.execute(sqlite_delete_all) + face_database.commit() + cursor.close() + return + +def register_face(filename, count, boxes, landmarks, alignimgs, features): + + # boxes = boxes.reshape(count, 4) + # landmarks = landmarks.reshape(count, 136) + # alignimgs = alignimgs.reshape(count, 49152) + # features = features.reshape(count, 256) + + global face_database + global max_id + max_id = max_id + 1 + id = max_id + cursor = face_database.cursor() + cursor.execute(sqlite_insert_blob_query, (id, filename, count, boxes.tostring(), landmarks.tostring(), alignimgs.tostring(), features.tostring())) + face_database.commit() + cursor.close() + data_all.append({'id':id, 'filename':filename, 'count':count, 'boxes':boxes, 'landmarks':landmarks, 'alignimgs':alignimgs, 'features':features}) + print('id = ', id) + return id + +def update_face(id = None, filename = None, count = None, boxes = None, landmarks = None, alignimgs = None, features = None): + global face_database + cursor = face_database.cursor() + cursor.execute(sqlite_update_all_query, (filename, count, boxes.tostring(), landmarks.tostring(), alignimgs.tostring(), features.tostring(), id)) + face_database.commit() + cursor.close() + +def get_similarity(feat1, feat2): + return (np.sum(feat1 * feat2) + 1) * 50 + +def verify_face(feat): + + global max_id + max_score = 0 + + for data in data_all: + id = data['id'] + sub_id = data['count'] + features = data['features'] + + # for sub_id in range(count): + score = get_similarity(feat, features) + if score >= max_score: + max_score = score + + if score >= threshold: + print("score = ", score) + return id, data['filename'], sub_id + + return -1, None, None + +def get_info(id, sub_id): + for data in data_all: + nid = data['id'] + if nid == id: + count = data['count'] + if count < sub_id: + return data['filename'], data['boxes'][sub_id], data['landmarsk'][sub_id], data['alignimgs'][sub_id], data['features'][sub_id] + else: + return None, None, None, None, None + + return None, None, None, None, None + +def set_threshold(th): + threshold = th + +def get_threshold(): + return threshold diff --git a/face_recognition/face_manage/person0.db b/face_recognition/face_manage/person0.db new file mode 100644 index 0000000000000000000000000000000000000000..fba449a4174344975c0d048877eb0f2daee03138 Binary files /dev/null and b/face_recognition/face_manage/person0.db differ diff --git a/face_recognition/face_pose/GetPose.py b/face_recognition/face_pose/GetPose.py new file mode 100644 index 0000000000000000000000000000000000000000..b8c2ee333287f0ef8e1ee058d64126cc8346393e --- /dev/null +++ b/face_recognition/face_pose/GetPose.py @@ -0,0 +1,21 @@ +import numpy as np +from numpy.ctypeslib import as_ctypes_type +from face_util.faceutil import getPose68 +import ctypes + +def get_face_pose(box, landmark): + fw = box[2] - box[0] + fh = box[3] - box[1] + sz = pow(fw * fh, 0.5) + cx = (box[2] + box[0]) / 2 + cy = (box[3] + box[1]) / 2 + x1 = cx - sz / 2 + y1 = cy - sz / 2 + + rx = ctypes.c_float(0) + ry = ctypes.c_float(0) + rz = ctypes.c_float(0) + + landmark_vec = (ctypes.c_float * len(landmark))(*landmark) + getPose68(x1, y1, sz, landmark_vec, 68, ctypes.pointer(rx), ctypes.pointer(ry), ctypes.pointer(rz)) + return np.array([rx.value, ry.value, rz.value], dtype=np.float32) diff --git a/face_recognition/face_util/C/FaceUtil.dll b/face_recognition/face_util/C/FaceUtil.dll new file mode 100644 index 0000000000000000000000000000000000000000..1b164cc37f48f45b96da23d7ff9e7de1977c9e00 Binary files /dev/null and b/face_recognition/face_util/C/FaceUtil.dll differ diff --git a/face_recognition/face_util/C/libFaceUtil.so b/face_recognition/face_util/C/libFaceUtil.so new file mode 100644 index 0000000000000000000000000000000000000000..f9cbbaf5d099b132c88706afb169add9b9d1e662 Binary files /dev/null and b/face_recognition/face_util/C/libFaceUtil.so differ diff --git a/face_recognition/face_util/__pycache__/faceutil.cpython-310.pyc b/face_recognition/face_util/__pycache__/faceutil.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5d1cfb4f9c4a91fe8513081e3515ec57ac7373c Binary files /dev/null and b/face_recognition/face_util/__pycache__/faceutil.cpython-310.pyc differ diff --git a/face_recognition/face_util/faceutil.py b/face_recognition/face_util/faceutil.py new file mode 100644 index 0000000000000000000000000000000000000000..d6119ff620ac0acf2aace4c5c988447c15e93e1b --- /dev/null +++ b/face_recognition/face_util/faceutil.py @@ -0,0 +1,28 @@ +import platform +import ctypes, ctypes.util +from ctypes import * +from numpy.ctypeslib import ndpointer +import sys +import os + +if platform.uname()[0] == 'Windows': + dll_path = os.path.abspath(os.path.dirname(__file__)) + '/C/face_util.dll' +elif platform.uname()[0] == 'Linux': + dll_path = os.path.abspath(os.path.dirname(__file__)) + '/C/libFaceUtil.so' +else: + print("Invalid OS") + sys.exit(1) + +face_util_engine = cdll.LoadLibrary(dll_path) + +align_vertical = face_util_engine.align_vertical +align_vertical.argtypes = [ndpointer(ctypes.c_ubyte, flags='C_CONTIGUOUS'), ctypes.c_int32, ctypes.c_int32, ndpointer(ctypes.c_ubyte, flags='C_CONTIGUOUS'), ctypes.c_int32, ctypes.c_int32, ctypes.c_int32, ctypes.POINTER(ctypes.c_float), ctypes.c_float, ctypes.c_float, ctypes.c_float] +align_vertical.restype = ctypes.c_int32 + +getPose = face_util_engine.getPose +getPose.argtypes = [ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.POINTER(ctypes.c_float), ctypes.c_int32, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)] +getPose.restype = ctypes.c_int32 + +getPose68 = face_util_engine.getPose68 +getPose68.argtypes = [ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.POINTER(ctypes.c_float), ctypes.c_int32, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)] +getPose68.restype = ctypes.c_int32 diff --git a/face_recognition/match.py b/face_recognition/match.py new file mode 100644 index 0000000000000000000000000000000000000000..1b71f6e8fd9d025e4a50478f5de513093366b008 --- /dev/null +++ b/face_recognition/match.py @@ -0,0 +1,24 @@ +import face_manage.manage as db_manage +from extract import GetImageInfo + + +def match_1_1(image1, image2): + + count1, boxes1, scores1, landmarks1, alignimgs1, features1 = GetImageInfo(image1, 1) + count2, boxes2, scores2, landmarks2, alignimgs2, features2 = GetImageInfo(image2, 1) + + result = False + sim = 0 + if count1 != 0 and count2 != 0: + sim = db_manage.get_similarity(features1[0], features2[0]) + if sim > db_manage.threshold: + result = True + else: + result = False + + response = { + "confidence": sim, + "threshold": db_manage.threshold, + "result": "Same Person" if result else "Different Person" + } + return response diff --git a/face_recognition/test/1.png b/face_recognition/test/1.png new file mode 100644 index 0000000000000000000000000000000000000000..600eb825c99cccee3c9eafcc8c765dbf3953150f --- /dev/null +++ b/face_recognition/test/1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94f615fb6bbdae9759bb12c04b5d88199ae98d71137a6edeead8f92ffd0148b3 +size 302565 diff --git a/face_recognition/test/2.png b/face_recognition/test/2.png new file mode 100644 index 0000000000000000000000000000000000000000..8719c16987a0a6ccef9c2ce3e0fe0bc816e2092e --- /dev/null +++ b/face_recognition/test/2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acd9078cb43ec061816dc3dac80159258d31f60acc181e89ebfeb064a8e4adac +size 246587 diff --git a/face_recognition/test/3.png b/face_recognition/test/3.png new file mode 100644 index 0000000000000000000000000000000000000000..bbd9c02028d80ce2758c8730f7e78645894ff5e5 --- /dev/null +++ b/face_recognition/test/3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9b319cce9e189cf52c870a90aec0b853f70f3953a58a06a59229ce5780e9b03 +size 273669 diff --git a/images/1.png b/images/1.png new file mode 100644 index 0000000000000000000000000000000000000000..118a1b17ff8c2b21fa403e1731b4f1c95de3991d --- /dev/null +++ b/images/1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9aea20cf89d7d25d2a722104b8dee1eda046e6d3076f6ff3268508415f392698 +size 402230 diff --git a/images/10.jpg b/images/10.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d3936e653c3cd6b484416b08ba8656886d3893e7 --- /dev/null +++ b/images/10.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81efee85b1277efe4746837dd888ef2d5be2e98f0842802bac17c5fc3c1123b6 +size 30655 diff --git a/images/11.jpg b/images/11.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e950384ddf70aefd21543f54ce4687868efb18fb --- /dev/null +++ b/images/11.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a91edd016cc3b3f2b8781f40127b064358d62db2971218731117f2a81d01cd28 +size 349995 diff --git a/images/12.jpg b/images/12.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9cd7f5f58893a79a8c8ba7c9592b8f40707a4a46 --- /dev/null +++ b/images/12.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39309174fcc94f32854fe5a79a2eff9a2e237d58ccc4f08a9ebde650b4809670 +size 74573 diff --git a/images/2.png b/images/2.png new file mode 100644 index 0000000000000000000000000000000000000000..f2f680b66dff0bc5d2b1530d3bd8651eccbfc449 --- /dev/null +++ b/images/2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91666fc3a1ef068ea05cb8eaae2c1f437c3a2025c31f4220ceaac729809209e0 +size 732812 diff --git a/images/3.png b/images/3.png new file mode 100644 index 0000000000000000000000000000000000000000..c314028c00e4345fd73f6a7585c9aac2797046e8 --- /dev/null +++ b/images/3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a372bb933355929645ad1f1ef1842d84571261167bc4361f6e92413309b3a528 +size 1707274 diff --git a/images/4.jpg b/images/4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4bfda0bd988f229f0c95fc415023b53b830ae407 --- /dev/null +++ b/images/4.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c8b5d6afdcc3657e9c684edcf17f30c19fa4812398e864c6d4d5c5a380b3655 +size 1285421 diff --git a/images/4.png b/images/4.png new file mode 100644 index 0000000000000000000000000000000000000000..f2f680b66dff0bc5d2b1530d3bd8651eccbfc449 --- /dev/null +++ b/images/4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91666fc3a1ef068ea05cb8eaae2c1f437c3a2025c31f4220ceaac729809209e0 +size 732812 diff --git a/images/5.jpg b/images/5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ae8c1ada4b14c3051c2352d0a2cf2227d891ea0d --- /dev/null +++ b/images/5.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83d943be1e6759e2ca277526213dcd7d87417dea6aaa2188c2457cbff888c1a4 +size 116460 diff --git a/images/6.jpg b/images/6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..62524eccdc367aebab7aa41e4289272387c49f90 --- /dev/null +++ b/images/6.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:832f3a87f237d5d1418367fdb9d46bee6f8e12aca2e28d3f62190fdf21231e8c +size 254461 diff --git a/images/7.png b/images/7.png new file mode 100644 index 0000000000000000000000000000000000000000..99bd89319afd765a90518df14b71b55d57603b7e --- /dev/null +++ b/images/7.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a22e8df31fe3dd72aeea71dcef9215740580a7184a86f6413612a89ff61a14c +size 352688 diff --git a/images/8.png b/images/8.png new file mode 100644 index 0000000000000000000000000000000000000000..baf66de2da7a80ef821b57b0ccace2b77278c3a1 --- /dev/null +++ b/images/8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d54aa95bf020d93b12f9638c911867dcd2391034dfcd64364d0d655b5afc870 +size 114295 diff --git a/images/9.png b/images/9.png new file mode 100644 index 0000000000000000000000000000000000000000..6bb66ab1325362dc709bc6c73df75a099333fa07 --- /dev/null +++ b/images/9.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd39c7a6869f51d08d24a846c81bc2d27e17a6282e0f0a86edba39714d1bffb6 +size 7842588 diff --git a/images/mrz_1.jpg b/images/mrz_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..55f34b9a6e3c1c1f5e3e8b4f85f47afebbd5db8d --- /dev/null +++ b/images/mrz_1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df3f7355d7fb9a85e4c880c10ceeb906d95bda22df59e47d896698013e270da3 +size 90157 diff --git a/images/mrz_2.png b/images/mrz_2.png new file mode 100644 index 0000000000000000000000000000000000000000..fe589b747437aae52b16939ce5249f38f121a0c8 --- /dev/null +++ b/images/mrz_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5fb41d62a739421e5dfd52e4c509c087d2d41705b4f128839b94e3701c8cc62 +size 389885 diff --git a/images/mrz_3.jpeg b/images/mrz_3.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..9822612509b639b47de4ded3625702d756256a27 Binary files /dev/null and b/images/mrz_3.jpeg differ diff --git a/images/mrz_4.jpg b/images/mrz_4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b927062093f07c6e212acf5921df1c14ea6687d9 --- /dev/null +++ b/images/mrz_4.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ff09ed13e93904dceb2b0f5627a494d87a210d16135b01fff2e95e46c1f9c5d +size 150954 diff --git a/images/rec_1.jpg b/images/rec_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7f0e05ddfded2d6725d7b3416802584391f348d4 --- /dev/null +++ b/images/rec_1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9218cdc295f42437d7c8f37fc8e2c6b765e5a04c4307d7925d8cd1b529315c1 +size 68111 diff --git a/images/rec_2.jpg b/images/rec_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5e6760156ce0c4c02f796ba5c98e762dd04d2082 --- /dev/null +++ b/images/rec_2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0682ae51dc063dca237342cfa7205fecd2fe861d01ce1596ce566a02b86813ac +size 3237032 diff --git a/images/rec_3.jpg b/images/rec_3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..27e090fd892dbca9cd507094346af8bd89913853 --- /dev/null +++ b/images/rec_3.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b26dd04bd1571705f0baeecd49e4360886ac99b8eca53793e03c6eb41f33fb5d +size 416469 diff --git a/images/rec_4.jpg b/images/rec_4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3c3517791acd5f85fda588c7cddf9434364eb444 --- /dev/null +++ b/images/rec_4.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdddf7763527522f6e7b270028e65f5aae2a7a21ec9539b4ec8547f283908a59 +size 90718 diff --git a/images/rec_5.jpg b/images/rec_5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..245df17a6b1b1103e88af30e4f42f6470cb23678 --- /dev/null +++ b/images/rec_5.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9870a087c55331ef9bb7720edeab139f6871e7e7ec6d23d110c75ce96b45d9f0 +size 116723 diff --git a/images/rec_6.jpg b/images/rec_6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..033c0f524705c9cbcb35bb06223af5f17dd3de55 --- /dev/null +++ b/images/rec_6.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8917563082a7d1bf49693f05a15e96dd1a9968e2afda7f01213d45f78b569e4c +size 114836 diff --git a/main.py b/main.py new file mode 100644 index 0000000000000000000000000000000000000000..5596b44786f04e4810aefe9f8d712f08ed310f71 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Shift+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fab254d41c2a30ed3909058c9af997326093c3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +opencv-python==4.9.0.80 +torch==2.2.2 +torchaudio==2.2.2 +torchvision==0.17.2 \ No newline at end of file