Commit bbc0557a authored by 任婷婷's avatar 任婷婷

age gender dist

parents
Metadata-Version: 1.1
Name: AgeGenderDist
Version: 0.1.0
Summary: A short description of the project
Home-page: https://github.com/rentingting/AgeGenderDist
Author: rentingting
Author-email: Your address email (eq. you@example.com)
License: BSD
Download-URL: https://github.com/rentingting/AgeGenderDist/tarball/0.1.0
Description: AgeGenderDist
===============================
version number: 0.1.0
author: rentingting
Overview
--------
A short description of the project
Installation / Usage
--------------------
To install use pip:
$ pip install AgeGenderDist
Or clone the repo:
$ git clone https://github.com/rentingting/AgeGenderDist.git
$ python setup.py install
Contributing
------------
TBD
Example
-------
TBD
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
MANIFEST.in
README.md
requirements.txt
setup.cfg
setup.py
AgeGenderDist/__init__.py
AgeGenderDist/face_image.py
AgeGenderDist/face_model.py
AgeGenderDist/face_preprocess.py
AgeGenderDist/gender.py
AgeGenderDist/helper.py
AgeGenderDist/mtcnn_detector.py
AgeGenderDist/noise_sgd.py
AgeGenderDist.egg-info/PKG-INFO
AgeGenderDist.egg-info/SOURCES.txt
AgeGenderDist.egg-info/dependency_links.txt
AgeGenderDist.egg-info/requires.txt
AgeGenderDist.egg-info/top_level.txt
AgeGenderDist/model/model-0000.params
AgeGenderDist/model/model-symbol.json
AgeGenderDist/mtcnn-model/det1-0001.params
AgeGenderDist/mtcnn-model/det1-symbol.json
AgeGenderDist/mtcnn-model/det1.caffemodel
AgeGenderDist/mtcnn-model/det1.prototxt
AgeGenderDist/mtcnn-model/det2-0001.params
AgeGenderDist/mtcnn-model/det2-symbol.json
AgeGenderDist/mtcnn-model/det2.caffemodel
AgeGenderDist/mtcnn-model/det2.prototxt
AgeGenderDist/mtcnn-model/det3-0001.params
AgeGenderDist/mtcnn-model/det3-symbol.json
AgeGenderDist/mtcnn-model/det3.caffemodel
AgeGenderDist/mtcnn-model/det3.prototxt
AgeGenderDist/mtcnn-model/det4-0001.params
AgeGenderDist/mtcnn-model/det4-symbol.json
AgeGenderDist/mtcnn-model/det4.caffemodel
AgeGenderDist/mtcnn-model/det4.prototxt
\ No newline at end of file
mxnet-cu100==1.4.1
scipy==1.2.2
scikit-learn==0.20.3
opencv-python==4.1.0.25
easydict==1.9
scikit-image==0.14.3
import AgeGenderDist.face_model
import argparse
import cv2
import sys
import numpy as np
import datetime
from AgeGenderDist.mtcnn_detector import MtcnnDetector
import os
import mxnet as mx
import math
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'src', 'common'))
parser = argparse.ArgumentParser(description='face model test')
# general
parser.add_argument('--image-size', default='112,112', help='')
parser.add_argument('--image', default='Tom_Hanks_54745.png', help='')
parser.add_argument('--model', default='model/model,0', help='path to load model.')
parser.add_argument('--gpu', default=0, type=int, help='gpu id')
parser.add_argument('--det', default=0, type=int, help='mtcnn option, 1 means using R+O, 0 means detect from begining')
args = parser.parse_args()
def get_age_gender_dist(img_src):
if args.gpu>=0:
ctx = mx.gpu(args.gpu)
else:
ctx = mx.cpu()
det_threshold = [0.6,0.7,0.8]
mtcnn_path = os.path.join(os.path.dirname(__file__), 'mtcnn-model')
if args.det==0:
detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=det_threshold)
else:
detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=[0.0,0.0,0.2])
ret = detector.detect_face(img_src, det_type = args.det)
if ret is None:
print('ret is none')
bbox, points = ret
points = points[0,:].reshape((2,5)).T
im=img_src.copy()
lf_eye=points[0]
rt_eye=points[1]
tmp=rt_eye-lf_eye
dist=math.hypot(tmp[0],tmp[1])
model=face_model.FaceModel(args)
img=model.get_input(img_src)
gender,age=model.get_ga(img)
return age,gender,dist
def get_gender_age(img):
model=face_model.FaceModel(args)
img=model.get_input(img)
gender,age=model.get_ga(img)
return gender,age
if __name__=='__main__':
dirs= os.listdir(args.image)
for file in dirs:
print('file',file)
imgdir=os.path.join('testimg',file)
img_src = cv2.imread(imgdir)
gender,age=get_gender_age(img_src)
age,gender,dist=get_age_gender_dist(img_src)
print(age,gender,dist)
#print('gender:',gender)
from easydict import EasyDict as edict
import os
import json
import numpy as np
def load_property(data_dir):
prop = edict()
for line in open(os.path.join(data_dir, 'property')):
vec = line.strip().split(',')
assert len(vec)==3
prop.num_classes = int(vec[0])
prop.image_size = [int(vec[1]), int(vec[2])]
return prop
def get_dataset_webface(input_dir):
clean_list_file = input_dir+"_clean_list.txt"
ret = []
for line in open(clean_list_file, 'r'):
vec = line.strip().split()
assert len(vec)==2
fimage = edict()
fimage.id = vec[0].replace("\\", '/')
fimage.classname = vec[1]
fimage.image_path = os.path.join(input_dir, fimage.id)
ret.append(fimage)
return ret
def get_dataset_celeb(input_dir):
clean_list_file = input_dir+"_clean_list.txt"
ret = []
dir2label = {}
for line in open(clean_list_file, 'r'):
line = line.strip()
if not line.startswith('./m.'):
continue
line = line[2:]
vec = line.split('/')
assert len(vec)==2
if vec[0] in dir2label:
label = dir2label[vec[0]]
else:
label = len(dir2label)
dir2label[vec[0]] = label
fimage = edict()
fimage.id = line
fimage.classname = str(label)
fimage.image_path = os.path.join(input_dir, fimage.id)
ret.append(fimage)
return ret
def _get_dataset_celeb(input_dir):
list_file = input_dir+"_original_list.txt"
ret = []
for line in open(list_file, 'r'):
vec = line.strip().split()
assert len(vec)==2
fimage = edict()
fimage.id = vec[0]
fimage.classname = vec[1]
fimage.image_path = os.path.join(input_dir, fimage.id)
ret.append(fimage)
return ret
def get_dataset_facescrub(input_dir):
ret = []
label = 0
person_names = []
for person_name in os.listdir(input_dir):
person_names.append(person_name)
person_names = sorted(person_names)
for person_name in person_names:
subdir = os.path.join(input_dir, person_name)
if not os.path.isdir(subdir):
continue
for _img in os.listdir(subdir):
fimage = edict()
fimage.id = os.path.join(person_name, _img)
fimage.classname = str(label)
fimage.image_path = os.path.join(subdir, _img)
fimage.landmark = None
fimage.bbox = None
ret.append(fimage)
label += 1
return ret
def get_dataset_megaface(input_dir):
ret = []
label = 0
for prefixdir in os.listdir(input_dir):
_prefixdir = os.path.join(input_dir, prefixdir)
for subdir in os.listdir(_prefixdir):
_subdir = os.path.join(_prefixdir, subdir)
if not os.path.isdir(_subdir):
continue
for img in os.listdir(_subdir):
if not img.endswith('.jpg.jpg') and img.endswith('.jpg'):
fimage = edict()
fimage.id = os.path.join(prefixdir, subdir, img)
fimage.classname = str(label)
fimage.image_path = os.path.join(_subdir, img)
json_file = fimage.image_path+".json"
data = None
fimage.bbox = None
fimage.landmark = None
if os.path.exists(json_file):
with open(json_file, 'r') as f:
data = f.read()
data = json.loads(data)
assert data is not None
if 'bounding_box' in data:
fimage.bbox = np.zeros( (4,), dtype=np.float32 )
bb = data['bounding_box']
fimage.bbox[0] = bb['x']
fimage.bbox[1] = bb['y']
fimage.bbox[2] = bb['x']+bb['width']
fimage.bbox[3] = bb['y']+bb['height']
#print('bb')
if 'landmarks' in data:
landmarks = data['landmarks']
if '1' in landmarks and '0' in landmarks and '2' in landmarks:
fimage.landmark = np.zeros( (3,2), dtype=np.float32 )
fimage.landmark[0][0] = landmarks['1']['x']
fimage.landmark[0][1] = landmarks['1']['y']
fimage.landmark[1][0] = landmarks['0']['x']
fimage.landmark[1][1] = landmarks['0']['y']
fimage.landmark[2][0] = landmarks['2']['x']
fimage.landmark[2][1] = landmarks['2']['y']
#print('lm')
ret.append(fimage)
label+=1
return ret
def get_dataset_fgnet(input_dir):
ret = []
label = 0
for subdir in os.listdir(input_dir):
_subdir = os.path.join(input_dir, subdir)
if not os.path.isdir(_subdir):
continue
for img in os.listdir(_subdir):
if img.endswith('.JPG'):
fimage = edict()
fimage.id = os.path.join(_subdir, img)
fimage.classname = str(label)
fimage.image_path = os.path.join(_subdir, img)
json_file = fimage.image_path+".json"
data = None
fimage.bbox = None
fimage.landmark = None
if os.path.exists(json_file):
with open(json_file, 'r') as f:
data = f.read()
data = json.loads(data)
assert data is not None
if 'bounding_box' in data:
fimage.bbox = np.zeros( (4,), dtype=np.float32 )
bb = data['bounding_box']
fimage.bbox[0] = bb['x']
fimage.bbox[1] = bb['y']
fimage.bbox[2] = bb['x']+bb['width']
fimage.bbox[3] = bb['y']+bb['height']
#print('bb')
if 'landmarks' in data:
landmarks = data['landmarks']
if '1' in landmarks and '0' in landmarks and '2' in landmarks:
fimage.landmark = np.zeros( (3,2), dtype=np.float32 )
fimage.landmark[0][0] = landmarks['1']['x']
fimage.landmark[0][1] = landmarks['1']['y']
fimage.landmark[1][0] = landmarks['0']['x']
fimage.landmark[1][1] = landmarks['0']['y']
fimage.landmark[2][0] = landmarks['2']['x']
fimage.landmark[2][1] = landmarks['2']['y']
#print('lm')
#fimage.landmark = None
ret.append(fimage)
label+=1
return ret
def get_dataset_ytf(input_dir):
ret = []
label = 0
person_names = []
for person_name in os.listdir(input_dir):
person_names.append(person_name)
person_names = sorted(person_names)
for person_name in person_names:
_subdir = os.path.join(input_dir, person_name)
if not os.path.isdir(_subdir):
continue
for _subdir2 in os.listdir(_subdir):
_subdir2 = os.path.join(_subdir, _subdir2)
if not os.path.isdir(_subdir2):
continue
_ret = []
for img in os.listdir(_subdir2):
fimage = edict()
fimage.id = os.path.join(_subdir2, img)
fimage.classname = str(label)
fimage.image_path = os.path.join(_subdir2, img)
fimage.bbox = None
fimage.landmark = None
_ret.append(fimage)
ret += _ret
label+=1
return ret
def get_dataset_clfw(input_dir):
ret = []
label = 0
for img in os.listdir(input_dir):
fimage = edict()
fimage.id = img
fimage.classname = str(0)
fimage.image_path = os.path.join(input_dir, img)
fimage.bbox = None
fimage.landmark = None
ret.append(fimage)
return ret
def get_dataset_common(input_dir, min_images = 1):
ret = []
label = 0
person_names = []
for person_name in os.listdir(input_dir):
person_names.append(person_name)
person_names = sorted(person_names)
for person_name in person_names:
_subdir = os.path.join(input_dir, person_name)
if not os.path.isdir(_subdir):
continue
_ret = []
for img in os.listdir(_subdir):
fimage = edict()
fimage.id = os.path.join(person_name, img)
fimage.classname = str(label)
fimage.image_path = os.path.join(_subdir, img)
fimage.bbox = None
fimage.landmark = None
_ret.append(fimage)
if len(_ret)>=min_images:
ret += _ret
label+=1
return ret
def get_dataset(name, input_dir):
if name=='webface' or name=='lfw' or name=='vgg':
return get_dataset_common(input_dir)
if name=='celeb':
return get_dataset_celeb(input_dir)
if name=='facescrub':
return get_dataset_facescrub(input_dir)
if name=='megaface':
return get_dataset_megaface(input_dir)
if name=='fgnet':
return get_dataset_fgnet(input_dir)
if name=='ytf':
return get_dataset_ytf(input_dir)
if name=='clfw':
return get_dataset_clfw(input_dir)
return None
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from scipy import misc
import sys
import os
import argparse
#import tensorflow as tf
import numpy as np
import mxnet as mx
import random
import cv2
import sklearn
from sklearn.decomposition import PCA
from time import sleep
from easydict import EasyDict as edict
from AgeGenderDist.mtcnn_detector import MtcnnDetector
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'src', 'common'))
import AgeGenderDist.face_image
import AgeGenderDist.face_preprocess
def do_flip(data):
for idx in range(data.shape[0]):
data[idx,:,:] = np.fliplr(data[idx,:,:])
def get_model(ctx, image_size, model_str, layer):
_vec = model_str.split(',')
assert len(_vec)==2
prefix = _vec[0]
epoch = int(_vec[1])
print('loading',prefix, epoch)
sym, arg_params, aux_params = mx.model.load_checkpoint(prefix, epoch)
all_layers = sym.get_internals()
sym = all_layers[layer+'_output']
model = mx.mod.Module(symbol=sym, context=ctx, label_names = None)
#model.bind(data_shapes=[('data', (args.batch_size, 3, image_size[0], image_size[1]))], label_shapes=[('softmax_label', (args.batch_size,))])
model.bind(data_shapes=[('data', (1, 3, image_size[0], image_size[1]))])
model.set_params(arg_params, aux_params)
return model
class FaceModel:
def __init__(self, args):
self.args = args
if args.gpu>=0:
ctx = mx.gpu(args.gpu)
else:
ctx = mx.cpu()
_vec = args.image_size.split(',')
assert len(_vec)==2
image_size = (int(_vec[0]), int(_vec[1]))
self.model = None
if len(args.model)>0:
self.model = get_model(ctx, image_size, args.model, 'fc1')
self.det_minsize = 50
self.det_threshold = [0.6,0.7,0.8]
#self.det_factor = 0.9
self.image_size = image_size
mtcnn_path = os.path.join(os.path.dirname(__file__), 'mtcnn-model')
if args.det==0:
detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=self.det_threshold)
else:
detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=[0.0,0.0,0.2])
self.detector = detector
def get_input(self, face_img):
ret = self.detector.detect_face(face_img, det_type = self.args.det)
#print('ret',ret)
if ret is None:
return None
bbox, points = ret
if bbox.shape[0]==0:
return None
bbox = bbox[0,0:4]
points = points[0,:].reshape((2,5)).T
#print(bbox)
#print(points)
nimg = face_preprocess.preprocess(face_img, bbox, points, image_size='112,112')
nimg = cv2.cvtColor(nimg, cv2.COLOR_BGR2RGB)
aligned = np.transpose(nimg, (2,0,1))
input_blob = np.expand_dims(aligned, axis=0)
data = mx.nd.array(input_blob)
db = mx.io.DataBatch(data=(data,))
return db
def get_ga(self, data):
self.model.forward(data, is_train=False)
ret = self.model.get_outputs()[0].asnumpy()
g = ret[:,0:2].flatten()
gender = np.argmax(g)
a = ret[:,2:202].reshape( (100,2) )
a = np.argmax(a, axis=1)
age = int(sum(a))
return gender, age
import cv2
import numpy as np
from skimage import transform as trans
def parse_lst_line(line):
vec = line.strip().split("\t")
assert len(vec)>=3
aligned = int(vec[0])
image_path = vec[1]
label = int(vec[2])
bbox = None
landmark = None
#print(vec)
if len(vec)>3:
bbox = np.zeros( (4,), dtype=np.int32)
for i in xrange(3,7):
bbox[i-3] = int(vec[i])
landmark = None
if len(vec)>7:
_l = []
for i in xrange(7,17):
_l.append(float(vec[i]))
landmark = np.array(_l).reshape( (2,5) ).T
#print(aligned)
return image_path, label, bbox, landmark, aligned
def read_image(img_path, **kwargs):
mode = kwargs.get('mode', 'rgb')
layout = kwargs.get('layout', 'HWC')
if mode=='gray':
img = cv2.imread(img_path, cv2.CV_LOAD_IMAGE_GRAYSCALE)
else:
img = cv2.imread(img_path, cv2.CV_LOAD_IMAGE_COLOR)
if mode=='rgb':
#print('to rgb')
img = img[...,::-1]
if layout=='CHW':
img = np.transpose(img, (2,0,1))
return img
def preprocess(img, bbox=None, landmark=None, **kwargs):
if isinstance(img, str):
img = read_image(img, **kwargs)
M = None
image_size = []
str_image_size = kwargs.get('image_size', '')
if len(str_image_size)>0:
image_size = [int(x) for x in str_image_size.split(',')]
if len(image_size)==1:
image_size = [image_size[0], image_size[0]]
assert len(image_size)==2
assert image_size[0]==112
assert image_size[0]==112 or image_size[1]==96
if landmark is not None:
assert len(image_size)==2
src = np.array([
[30.2946, 51.6963],
[65.5318, 51.5014],
[48.0252, 71.7366],
[33.5493, 92.3655],
[62.7299, 92.2041] ], dtype=np.float32 )
if image_size[1]==112:
src[:,0] += 8.0
dst = landmark.astype(np.float32)
tform = trans.SimilarityTransform()
tform.estimate(dst, src)
M = tform.params[0:2,:]
#M = cv2.estimateRigidTransform( dst.reshape(1,5,2), src.reshape(1,5,2), False)
if M is None:
if bbox is None: #use center crop
det = np.zeros(4, dtype=np.int32)
det[0] = int(img.shape[1]*0.0625)
det[1] = int(img.shape[0]*0.0625)
det[2] = img.shape[1] - det[0]
det[3] = img.shape[0] - det[1]
else:
det = bbox
margin = kwargs.get('margin', 44)
bb = np.zeros(4, dtype=np.int32)
bb[0] = np.maximum(det[0]-margin/2, 0)
bb[1] = np.maximum(det[1]-margin/2, 0)
bb[2] = np.minimum(det[2]+margin/2, img.shape[1])
bb[3] = np.minimum(det[3]+margin/2, img.shape[0])
ret = img[bb[1]:bb[3],bb[0]:bb[2],:]
if len(image_size)>0:
ret = cv2.resize(ret, (image_size[1], image_size[0]))
return ret
else: #do align using landmark
assert len(image_size)==2
#src = src[0:3,:]
#dst = dst[0:3,:]
#print(src.shape, dst.shape)
#print(src)
#print(dst)
#print(M)
warped = cv2.warpAffine(img,M,(image_size[1],image_size[0]), borderValue = 0.0)
#tform3 = trans.ProjectiveTransform()
#tform3.estimate(src, dst)
#warped = trans.warp(img, tform3, output_shape=_shape)
return warped
import AgeGenderDist.face_model
import argparse
import cv2
import sys
import numpy as np
import datetime
from AgeGenderDist.mtcnn_detector import MtcnnDetector
import os
import mxnet as mx
import math
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'src', 'common'))
parser = argparse.ArgumentParser(description='face model test')
# general
parser.add_argument('--image-size', default='112,112', help='')
parser.add_argument('--image', default='Tom_Hanks_54745.png', help='')
parser.add_argument('--model', default='model/model,0', help='path to load model.')
parser.add_argument('--gpu', default=0, type=int, help='gpu id')
parser.add_argument('--det', default=0, type=int, help='mtcnn option, 1 means using R+O, 0 means detect from begining')
args = parser.parse_args()
def get_age_gender_dist(img_src):
if args.gpu>=0:
ctx = mx.gpu(args.gpu)
else:
ctx = mx.cpu()
det_threshold = [0.6,0.7,0.8]
mtcnn_path = os.path.join(os.path.dirname(__file__), 'mtcnn-model')
if args.det==0:
detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=det_threshold)
else:
detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=[0.0,0.0,0.2])
ret = detector.detect_face(img_src, det_type = args.det)
if ret is None:
print('ret is none')
bbox, points = ret
points = points[0,:].reshape((2,5)).T
im=img_src.copy()
lf_eye=points[0]
rt_eye=points[1]
tmp=rt_eye-lf_eye
dist=math.hypot(tmp[0],tmp[1])
model=face_model.FaceModel(args)
img=model.get_input(img_src)
gender,age=model.get_ga(img)
return age,gender,dist
def get_gender_age(img):
model=face_model.FaceModel(args)
img=model.get_input(img)
gender,age=model.get_ga(img)
return gender,age
if __name__=='__main__':
dirs= os.listdir(args.image)
for file in dirs:
print('file',file)
imgdir=os.path.join('testimg',file)
img_src = cv2.imread(imgdir)
gender,age=get_gender_age(img_src)
age,gender,dist=get_age_gender_dist(img_src)
print(age,gender,dist)
#print('gender:',gender)
# coding: utf-8
# YuanYang
import math
import cv2
import numpy as np
def nms(boxes, overlap_threshold, mode='Union'):
"""
non max suppression
Parameters:
----------
box: numpy array n x 5
input bbox array
overlap_threshold: float number
threshold of overlap
mode: float number
how to compute overlap ratio, 'Union' or 'Min'
Returns:
-------
index array of the selected bbox
"""
# if there are no boxes, return an empty list
if len(boxes) == 0:
return []
# if the bounding boxes integers, convert them to floats
if boxes.dtype.kind == "i":
boxes = boxes.astype("float")
# initialize the list of picked indexes
pick = []
# grab the coordinates of the bounding boxes
x1, y1, x2, y2, score = [boxes[:, i] for i in range(5)]
area = (x2 - x1 + 1) * (y2 - y1 + 1)
idxs = np.argsort(score)
# keep looping while some indexes still remain in the indexes list
while len(idxs) > 0:
# grab the last index in the indexes list and add the index value to the list of picked indexes
last = len(idxs) - 1
i = idxs[last]
pick.append(i)
xx1 = np.maximum(x1[i], x1[idxs[:last]])
yy1 = np.maximum(y1[i], y1[idxs[:last]])
xx2 = np.minimum(x2[i], x2[idxs[:last]])
yy2 = np.minimum(y2[i], y2[idxs[:last]])
# compute the width and height of the bounding box
w = np.maximum(0, xx2 - xx1 + 1)
h = np.maximum(0, yy2 - yy1 + 1)
inter = w * h
if mode == 'Min':
overlap = inter / np.minimum(area[i], area[idxs[:last]])
else:
overlap = inter / (area[i] + area[idxs[:last]] - inter)
# delete all indexes from the index list that have
idxs = np.delete(idxs, np.concatenate(([last],
np.where(overlap > overlap_threshold)[0])))
return pick
def adjust_input(in_data):
"""
adjust the input from (h, w, c) to ( 1, c, h, w) for network input
Parameters:
----------
in_data: numpy array of shape (h, w, c)
input data
Returns:
-------
out_data: numpy array of shape (1, c, h, w)
reshaped array
"""
if in_data.dtype is not np.dtype('float32'):
out_data = in_data.astype(np.float32)
else:
out_data = in_data
out_data = out_data.transpose((2,0,1))
out_data = np.expand_dims(out_data, 0)
out_data = (out_data - 127.5)*0.0078125
return out_data
def generate_bbox(map, reg, scale, threshold):
"""
generate bbox from feature map
Parameters:
----------
map: numpy array , n x m x 1
detect score for each position
reg: numpy array , n x m x 4
bbox
scale: float number
scale of this detection
threshold: float number
detect threshold
Returns:
-------
bbox array
"""
stride = 2
cellsize = 12
t_index = np.where(map>threshold)
# find nothing
if t_index[0].size == 0:
return np.array([])
dx1, dy1, dx2, dy2 = [reg[0, i, t_index[0], t_index[1]] for i in range(4)]
reg = np.array([dx1, dy1, dx2, dy2])
score = map[t_index[0], t_index[1]]
boundingbox = np.vstack([np.round((stride*t_index[1]+1)/scale),
np.round((stride*t_index[0]+1)/scale),
np.round((stride*t_index[1]+1+cellsize)/scale),
np.round((stride*t_index[0]+1+cellsize)/scale),
score,
reg])
return boundingbox.T
def detect_first_stage(img, net, scale, threshold):
"""
run PNet for first stage
Parameters:
----------
img: numpy array, bgr order
input image
scale: float number
how much should the input image scale
net: PNet
worker
Returns:
-------
total_boxes : bboxes
"""
height, width, _ = img.shape
hs = int(math.ceil(height * scale))
ws = int(math.ceil(width * scale))
im_data = cv2.resize(img, (ws,hs))
# adjust for the network input
input_buf = adjust_input(im_data)
output = net.predict(input_buf)
boxes = generate_bbox(output[1][0,1,:,:], output[0], scale, threshold)
if boxes.size == 0:
return None
# nms
pick = nms(boxes[:,0:5], 0.5, mode='Union')
boxes = boxes[pick]
return boxes
def detect_first_stage_warpper( args ):
return detect_first_stage(*args)
{
"nodes": [
{
"op": "null",
"name": "data",
"inputs": []
},
{
"op": "_minus_scalar",
"name": "_minusscalar0",
"attrs": {"scalar": "127.5"},
"inputs": [[0, 0, 0]]
},
{
"op": "_mul_scalar",
"name": "_mulscalar0",
"attrs": {"scalar": "0.0078125"},
"inputs": [[1, 0, 0]]
},
{
"op": "null",
"name": "conv_1_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "8",
"num_group": "1",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_1_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "8",
"num_group": "1",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[2, 0, 0], [3, 0, 0]]
},
{
"op": "null",
"name": "conv_1_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_1_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_1_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_1_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_1_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[4, 0, 0], [5, 0, 0], [6, 0, 0], [7, 0, 1], [8, 0, 1]]
},
{
"op": "Activation",
"name": "conv_1_relu",
"attrs": {"act_type": "relu"},
"inputs": [[9, 0, 0]]
},
{
"op": "null",
"name": "conv_2_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "8",
"num_group": "8",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_2_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "8",
"num_group": "8",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[10, 0, 0], [11, 0, 0]]
},
{
"op": "null",
"name": "conv_2_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_2_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_2_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_2_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_2_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[12, 0, 0], [13, 0, 0], [14, 0, 0], [15, 0, 1], [16, 0, 1]]
},
{
"op": "Activation",
"name": "conv_2_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[17, 0, 0]]
},
{
"op": "null",
"name": "conv_2_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "16",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_2_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "16",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[18, 0, 0], [19, 0, 0]]
},
{
"op": "null",
"name": "conv_2_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_2_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_2_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_2_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_2_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[20, 0, 0], [21, 0, 0], [22, 0, 0], [23, 0, 1], [24, 0, 1]]
},
{
"op": "Activation",
"name": "conv_2_relu",
"attrs": {"act_type": "relu"},
"inputs": [[25, 0, 0]]
},
{
"op": "null",
"name": "conv_3_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "16",
"num_group": "16",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_3_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "16",
"num_group": "16",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": [[26, 0, 0], [27, 0, 0]]
},
{
"op": "null",
"name": "conv_3_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_3_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_3_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_3_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_3_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[28, 0, 0], [29, 0, 0], [30, 0, 0], [31, 0, 1], [32, 0, 1]]
},
{
"op": "Activation",
"name": "conv_3_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[33, 0, 0]]
},
{
"op": "null",
"name": "conv_3_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "32",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_3_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "32",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[34, 0, 0], [35, 0, 0]]
},
{
"op": "null",
"name": "conv_3_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_3_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_3_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_3_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_3_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[36, 0, 0], [37, 0, 0], [38, 0, 0], [39, 0, 1], [40, 0, 1]]
},
{
"op": "Activation",
"name": "conv_3_relu",
"attrs": {"act_type": "relu"},
"inputs": [[41, 0, 0]]
},
{
"op": "null",
"name": "conv_4_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "32",
"num_group": "32",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_4_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "32",
"num_group": "32",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[42, 0, 0], [43, 0, 0]]
},
{
"op": "null",
"name": "conv_4_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_4_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_4_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_4_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_4_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[44, 0, 0], [45, 0, 0], [46, 0, 0], [47, 0, 1], [48, 0, 1]]
},
{
"op": "Activation",
"name": "conv_4_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[49, 0, 0]]
},
{
"op": "null",
"name": "conv_4_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "32",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_4_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "32",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[50, 0, 0], [51, 0, 0]]
},
{
"op": "null",
"name": "conv_4_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_4_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_4_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_4_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_4_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[52, 0, 0], [53, 0, 0], [54, 0, 0], [55, 0, 1], [56, 0, 1]]
},
{
"op": "Activation",
"name": "conv_4_relu",
"attrs": {"act_type": "relu"},
"inputs": [[57, 0, 0]]
},
{
"op": "null",
"name": "conv_5_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "32",
"num_group": "32",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_5_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "32",
"num_group": "32",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": [[58, 0, 0], [59, 0, 0]]
},
{
"op": "null",
"name": "conv_5_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_5_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_5_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_5_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_5_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[60, 0, 0], [61, 0, 0], [62, 0, 0], [63, 0, 1], [64, 0, 1]]
},
{
"op": "Activation",
"name": "conv_5_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[65, 0, 0]]
},
{
"op": "null",
"name": "conv_5_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "64",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_5_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "64",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[66, 0, 0], [67, 0, 0]]
},
{
"op": "null",
"name": "conv_5_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_5_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_5_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_5_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_5_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[68, 0, 0], [69, 0, 0], [70, 0, 0], [71, 0, 1], [72, 0, 1]]
},
{
"op": "Activation",
"name": "conv_5_relu",
"attrs": {"act_type": "relu"},
"inputs": [[73, 0, 0]]
},
{
"op": "null",
"name": "conv_6_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "64",
"num_group": "64",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_6_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "64",
"num_group": "64",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[74, 0, 0], [75, 0, 0]]
},
{
"op": "null",
"name": "conv_6_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_6_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_6_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_6_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_6_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[76, 0, 0], [77, 0, 0], [78, 0, 0], [79, 0, 1], [80, 0, 1]]
},
{
"op": "Activation",
"name": "conv_6_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[81, 0, 0]]
},
{
"op": "null",
"name": "conv_6_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "64",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_6_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "64",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[82, 0, 0], [83, 0, 0]]
},
{
"op": "null",
"name": "conv_6_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_6_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_6_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_6_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_6_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[84, 0, 0], [85, 0, 0], [86, 0, 0], [87, 0, 1], [88, 0, 1]]
},
{
"op": "Activation",
"name": "conv_6_relu",
"attrs": {"act_type": "relu"},
"inputs": [[89, 0, 0]]
},
{
"op": "null",
"name": "conv_7_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "64",
"num_group": "64",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_7_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "64",
"num_group": "64",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": [[90, 0, 0], [91, 0, 0]]
},
{
"op": "null",
"name": "conv_7_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_7_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_7_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_7_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_7_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[92, 0, 0], [93, 0, 0], [94, 0, 0], [95, 0, 1], [96, 0, 1]]
},
{
"op": "Activation",
"name": "conv_7_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[97, 0, 0]]
},
{
"op": "null",
"name": "conv_7_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_7_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[98, 0, 0], [99, 0, 0]]
},
{
"op": "null",
"name": "conv_7_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_7_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_7_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_7_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_7_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[100, 0, 0], [101, 0, 0], [102, 0, 0], [103, 0, 1], [104, 0, 1]]
},
{
"op": "Activation",
"name": "conv_7_relu",
"attrs": {"act_type": "relu"},
"inputs": [[105, 0, 0]]
},
{
"op": "null",
"name": "conv_8_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_8_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[106, 0, 0], [107, 0, 0]]
},
{
"op": "null",
"name": "conv_8_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_8_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_8_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_8_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_8_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[108, 0, 0], [109, 0, 0], [110, 0, 0], [111, 0, 1], [112, 0, 1]]
},
{
"op": "Activation",
"name": "conv_8_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[113, 0, 0]]
},
{
"op": "null",
"name": "conv_8_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_8_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[114, 0, 0], [115, 0, 0]]
},
{
"op": "null",
"name": "conv_8_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_8_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_8_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_8_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_8_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[116, 0, 0], [117, 0, 0], [118, 0, 0], [119, 0, 1], [120, 0, 1]]
},
{
"op": "Activation",
"name": "conv_8_relu",
"attrs": {"act_type": "relu"},
"inputs": [[121, 0, 0]]
},
{
"op": "null",
"name": "conv_9_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_9_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[122, 0, 0], [123, 0, 0]]
},
{
"op": "null",
"name": "conv_9_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_9_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_9_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_9_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_9_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[124, 0, 0], [125, 0, 0], [126, 0, 0], [127, 0, 1], [128, 0, 1]]
},
{
"op": "Activation",
"name": "conv_9_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[129, 0, 0]]
},
{
"op": "null",
"name": "conv_9_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_9_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[130, 0, 0], [131, 0, 0]]
},
{
"op": "null",
"name": "conv_9_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_9_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_9_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_9_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_9_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[132, 0, 0], [133, 0, 0], [134, 0, 0], [135, 0, 1], [136, 0, 1]]
},
{
"op": "Activation",
"name": "conv_9_relu",
"attrs": {"act_type": "relu"},
"inputs": [[137, 0, 0]]
},
{
"op": "null",
"name": "conv_10_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_10_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[138, 0, 0], [139, 0, 0]]
},
{
"op": "null",
"name": "conv_10_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_10_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_10_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_10_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_10_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[140, 0, 0], [141, 0, 0], [142, 0, 0], [143, 0, 1], [144, 0, 1]]
},
{
"op": "Activation",
"name": "conv_10_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[145, 0, 0]]
},
{
"op": "null",
"name": "conv_10_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_10_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[146, 0, 0], [147, 0, 0]]
},
{
"op": "null",
"name": "conv_10_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_10_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_10_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_10_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_10_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[148, 0, 0], [149, 0, 0], [150, 0, 0], [151, 0, 1], [152, 0, 1]]
},
{
"op": "Activation",
"name": "conv_10_relu",
"attrs": {"act_type": "relu"},
"inputs": [[153, 0, 0]]
},
{
"op": "null",
"name": "conv_11_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_11_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[154, 0, 0], [155, 0, 0]]
},
{
"op": "null",
"name": "conv_11_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_11_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_11_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_11_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_11_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[156, 0, 0], [157, 0, 0], [158, 0, 0], [159, 0, 1], [160, 0, 1]]
},
{
"op": "Activation",
"name": "conv_11_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[161, 0, 0]]
},
{
"op": "null",
"name": "conv_11_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_11_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[162, 0, 0], [163, 0, 0]]
},
{
"op": "null",
"name": "conv_11_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_11_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_11_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_11_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_11_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[164, 0, 0], [165, 0, 0], [166, 0, 0], [167, 0, 1], [168, 0, 1]]
},
{
"op": "Activation",
"name": "conv_11_relu",
"attrs": {"act_type": "relu"},
"inputs": [[169, 0, 0]]
},
{
"op": "null",
"name": "conv_12_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_12_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[170, 0, 0], [171, 0, 0]]
},
{
"op": "null",
"name": "conv_12_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_12_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_12_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_12_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_12_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[172, 0, 0], [173, 0, 0], [174, 0, 0], [175, 0, 1], [176, 0, 1]]
},
{
"op": "Activation",
"name": "conv_12_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[177, 0, 0]]
},
{
"op": "null",
"name": "conv_12_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_12_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "128",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[178, 0, 0], [179, 0, 0]]
},
{
"op": "null",
"name": "conv_12_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_12_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_12_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_12_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_12_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[180, 0, 0], [181, 0, 0], [182, 0, 0], [183, 0, 1], [184, 0, 1]]
},
{
"op": "Activation",
"name": "conv_12_relu",
"attrs": {"act_type": "relu"},
"inputs": [[185, 0, 0]]
},
{
"op": "null",
"name": "conv_13_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_13_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "128",
"num_group": "128",
"pad": "(1, 1)",
"stride": "(2, 2)"
},
"inputs": [[186, 0, 0], [187, 0, 0]]
},
{
"op": "null",
"name": "conv_13_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_13_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_13_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_13_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_13_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[188, 0, 0], [189, 0, 0], [190, 0, 0], [191, 0, 1], [192, 0, 1]]
},
{
"op": "Activation",
"name": "conv_13_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[193, 0, 0]]
},
{
"op": "null",
"name": "conv_13_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "256",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_13_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "256",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[194, 0, 0], [195, 0, 0]]
},
{
"op": "null",
"name": "conv_13_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_13_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_13_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_13_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_13_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[196, 0, 0], [197, 0, 0], [198, 0, 0], [199, 0, 1], [200, 0, 1]]
},
{
"op": "Activation",
"name": "conv_13_relu",
"attrs": {"act_type": "relu"},
"inputs": [[201, 0, 0]]
},
{
"op": "null",
"name": "conv_14_dw_conv2d_weight",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "256",
"num_group": "256",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_14_dw_conv2d",
"attrs": {
"kernel": "(3, 3)",
"no_bias": "True",
"num_filter": "256",
"num_group": "256",
"pad": "(1, 1)",
"stride": "(1, 1)"
},
"inputs": [[202, 0, 0], [203, 0, 0]]
},
{
"op": "null",
"name": "conv_14_dw_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_14_dw_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_14_dw_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_14_dw_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_14_dw_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[204, 0, 0], [205, 0, 0], [206, 0, 0], [207, 0, 1], [208, 0, 1]]
},
{
"op": "Activation",
"name": "conv_14_dw_relu",
"attrs": {"act_type": "relu"},
"inputs": [[209, 0, 0]]
},
{
"op": "null",
"name": "conv_14_conv2d_weight",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "256",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": []
},
{
"op": "Convolution",
"name": "conv_14_conv2d",
"attrs": {
"kernel": "(1, 1)",
"no_bias": "True",
"num_filter": "256",
"num_group": "1",
"pad": "(0, 0)",
"stride": "(1, 1)"
},
"inputs": [[210, 0, 0], [211, 0, 0]]
},
{
"op": "null",
"name": "conv_14_batchnorm_gamma",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_14_batchnorm_beta",
"attrs": {"fix_gamma": "True"},
"inputs": []
},
{
"op": "null",
"name": "conv_14_batchnorm_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "null",
"name": "conv_14_batchnorm_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"fix_gamma": "True"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "conv_14_batchnorm",
"attrs": {"fix_gamma": "True"},
"inputs": [[212, 0, 0], [213, 0, 0], [214, 0, 0], [215, 0, 1], [216, 0, 1]]
},
{
"op": "Activation",
"name": "conv_14_relu",
"attrs": {"act_type": "relu"},
"inputs": [[217, 0, 0]]
},
{
"op": "null",
"name": "bn1_gamma",
"attrs": {
"eps": "2e-05",
"fix_gamma": "False",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "null",
"name": "bn1_beta",
"attrs": {
"eps": "2e-05",
"fix_gamma": "False",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "null",
"name": "bn1_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"eps": "2e-05",
"fix_gamma": "False",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "null",
"name": "bn1_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"eps": "2e-05",
"fix_gamma": "False",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "bn1",
"attrs": {
"eps": "2e-05",
"fix_gamma": "False",
"momentum": "0.9"
},
"inputs": [[218, 0, 0], [219, 0, 0], [220, 0, 0], [221, 0, 1], [222, 0, 1]]
},
{
"op": "null",
"name": "relu1_gamma",
"attrs": {
"__init__": "[\"Constant\", {\"value\": 0.25}]",
"act_type": "prelu"
},
"inputs": []
},
{
"op": "LeakyReLU",
"name": "relu1",
"attrs": {"act_type": "prelu"},
"inputs": [[223, 0, 0], [224, 0, 0]]
},
{
"op": "Pooling",
"name": "pool1",
"attrs": {
"global_pool": "True",
"kernel": "(7, 7)",
"pool_type": "avg"
},
"inputs": [[225, 0, 0]]
},
{
"op": "Flatten",
"name": "flatten0",
"inputs": [[226, 0, 0]]
},
{
"op": "null",
"name": "pre_fc1_weight",
"attrs": {"num_hidden": "202"},
"inputs": []
},
{
"op": "null",
"name": "pre_fc1_bias",
"attrs": {"num_hidden": "202"},
"inputs": []
},
{
"op": "FullyConnected",
"name": "pre_fc1",
"attrs": {"num_hidden": "202"},
"inputs": [[227, 0, 0], [228, 0, 0], [229, 0, 0]]
},
{
"op": "null",
"name": "fc1_gamma",
"attrs": {
"eps": "2e-05",
"fix_gamma": "True",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "null",
"name": "fc1_beta",
"attrs": {
"eps": "2e-05",
"fix_gamma": "True",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "null",
"name": "fc1_moving_mean",
"attrs": {
"__init__": "[\"zero\", {}]",
"eps": "2e-05",
"fix_gamma": "True",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "null",
"name": "fc1_moving_var",
"attrs": {
"__init__": "[\"one\", {}]",
"eps": "2e-05",
"fix_gamma": "True",
"momentum": "0.9"
},
"inputs": []
},
{
"op": "BatchNorm",
"name": "fc1",
"attrs": {
"eps": "2e-05",
"fix_gamma": "True",
"momentum": "0.9"
},
"inputs": [[230, 0, 0], [231, 0, 0], [232, 0, 0], [233, 0, 1], [234, 0, 1]]
}
],
"arg_nodes": [
0,
3,
5,
6,
7,
8,
11,
13,
14,
15,
16,
19,
21,
22,
23,
24,
27,
29,
30,
31,
32,
35,
37,
38,
39,
40,
43,
45,
46,
47,
48,
51,
53,
54,
55,
56,
59,
61,
62,
63,
64,
67,
69,
70,
71,
72,
75,
77,
78,
79,
80,
83,
85,
86,
87,
88,
91,
93,
94,
95,
96,
99,
101,
102,
103,
104,
107,
109,
110,
111,
112,
115,
117,
118,
119,
120,
123,
125,
126,
127,
128,
131,
133,
134,
135,
136,
139,
141,
142,
143,
144,
147,
149,
150,
151,
152,
155,
157,
158,
159,
160,
163,
165,
166,
167,
168,
171,
173,
174,
175,
176,
179,
181,
182,
183,
184,
187,
189,
190,
191,
192,
195,
197,
198,
199,
200,
203,
205,
206,
207,
208,
211,
213,
214,
215,
216,
219,
220,
221,
222,
224,
228,
229,
231,
232,
233,
234
],
"node_row_ptr": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
12,
13,
14,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
28,
29,
32,
33,
34,
35,
36,
37,
38,
39,
42,
43,
44,
45,
46,
47,
48,
49,
52,
53,
54,
55,
56,
57,
58,
59,
62,
63,
64,
65,
66,
67,
68,
69,
72,
73,
74,
75,
76,
77,
78,
79,
82,
83,
84,
85,
86,
87,
88,
89,
92,
93,
94,
95,
96,
97,
98,
99,
102,
103,
104,
105,
106,
107,
108,
109,
112,
113,
114,
115,
116,
117,
118,
119,
122,
123,
124,
125,
126,
127,
128,
129,
132,
133,
134,
135,
136,
137,
138,
139,
142,
143,
144,
145,
146,
147,
148,
149,
152,
153,
154,
155,
156,
157,
158,
159,
162,
163,
164,
165,
166,
167,
168,
169,
172,
173,
174,
175,
176,
177,
178,
179,
182,
183,
184,
185,
186,
187,
188,
189,
192,
193,
194,
195,
196,
197,
198,
199,
202,
203,
204,
205,
206,
207,
208,
209,
212,
213,
214,
215,
216,
217,
218,
219,
222,
223,
224,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
237,
238,
239,
242,
243,
244,
245,
246,
247,
248,
249,
252,
253,
254,
255,
256,
257,
258,
259,
262,
263,
264,
265,
266,
267,
268,
269,
272,
273,
274,
275,
276,
277,
280,
281,
282,
283,
284,
285,
286,
287,
288,
289,
290,
291,
294
],
"heads": [[235, 0, 0]],
"attrs": {"mxnet_version": ["int", 10300]}
}
\ No newline at end of file
{
"nodes": [
{
"op": "null",
"param": {},
"name": "data",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "10",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1",
"inputs": [[0, 0], [1, 0], [2, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1",
"inputs": [[3, 0], [4, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(2,2)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1",
"inputs": [[5, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "16",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2",
"inputs": [[6, 0], [7, 0], [8, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2",
"inputs": [[9, 0], [10, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "32",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3",
"inputs": [[11, 0], [12, 0], [13, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3",
"inputs": [[14, 0], [15, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(1,1)",
"no_bias": "False",
"num_filter": "4",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv4_2",
"inputs": [[16, 0], [17, 0], [18, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(1,1)",
"no_bias": "False",
"num_filter": "2",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv4_1",
"inputs": [[16, 0], [20, 0], [21, 0]],
"backward_source_id": -1
},
{
"op": "SoftmaxActivation",
"param": {"mode": "channel"},
"name": "prob1",
"inputs": [[22, 0]],
"backward_source_id": -1
}
],
"arg_nodes": [
0,
1,
2,
4,
7,
8,
10,
12,
13,
15,
17,
18,
20,
21
],
"heads": [[19, 0], [23, 0]]
}
\ No newline at end of file
name: "PNet"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 12
input_dim: 12
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 10
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "PReLU1"
type: "PReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 16
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "PReLU2"
type: "PReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "conv3"
type: "Convolution"
bottom: "conv2"
top: "conv3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 32
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "PReLU3"
type: "PReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4-1"
type: "Convolution"
bottom: "conv3"
top: "conv4-1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 2
kernel_size: 1
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "conv4-2"
type: "Convolution"
bottom: "conv3"
top: "conv4-2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 4
kernel_size: 1
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prob1"
type: "Softmax"
bottom: "conv4-1"
top: "prob1"
}
{
"nodes": [
{
"op": "null",
"param": {},
"name": "data",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "28",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1",
"inputs": [[0, 0], [1, 0], [2, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1",
"inputs": [[3, 0], [4, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1",
"inputs": [[5, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "48",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2",
"inputs": [[6, 0], [7, 0], [8, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2",
"inputs": [[9, 0], [10, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2",
"inputs": [[11, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3",
"inputs": [[12, 0], [13, 0], [14, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3",
"inputs": [[15, 0], [16, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "128"
},
"name": "conv4",
"inputs": [[17, 0], [18, 0], [19, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4",
"inputs": [[20, 0], [21, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv5_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv5_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "4"
},
"name": "conv5_2",
"inputs": [[22, 0], [23, 0], [24, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv5_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv5_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "conv5_1",
"inputs": [[22, 0], [26, 0], [27, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prob1_label",
"inputs": [],
"backward_source_id": -1
},
{
"op": "SoftmaxOutput",
"param": {
"grad_scale": "1",
"ignore_label": "-1",
"multi_output": "False",
"normalization": "null",
"use_ignore": "False"
},
"name": "prob1",
"inputs": [[28, 0], [29, 0]],
"backward_source_id": -1
}
],
"arg_nodes": [
0,
1,
2,
4,
7,
8,
10,
13,
14,
16,
18,
19,
21,
23,
24,
26,
27,
29
],
"heads": [[25, 0], [30, 0]]
}
\ No newline at end of file
name: "RNet"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 24
input_dim: 24
##########################
######################
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 28
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1"
type: "PReLU"
bottom: "conv1"
top: "conv1"
propagate_down: true
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 48
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2"
type: "PReLU"
bottom: "conv2"
top: "conv2"
propagate_down: true
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
####################################
##################################
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 64
kernel_size: 2
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3"
type: "PReLU"
bottom: "conv3"
top: "conv3"
propagate_down: true
}
###############################
###############################
layer {
name: "conv4"
type: "InnerProduct"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
inner_product_param {
num_output: 128
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4"
type: "PReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5-1"
type: "InnerProduct"
bottom: "conv4"
top: "conv5-1"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
inner_product_param {
num_output: 2
#kernel_size: 1
#stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "conv5-2"
type: "InnerProduct"
bottom: "conv4"
top: "conv5-2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 4
#kernel_size: 1
#stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prob1"
type: "Softmax"
bottom: "conv5-1"
top: "prob1"
}
\ No newline at end of file
{
"nodes": [
{
"op": "null",
"param": {},
"name": "data",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "32",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1",
"inputs": [[0, 0], [1, 0], [2, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1",
"inputs": [[3, 0], [4, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1",
"inputs": [[5, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2",
"inputs": [[6, 0], [7, 0], [8, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2",
"inputs": [[9, 0], [10, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2",
"inputs": [[11, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3",
"inputs": [[12, 0], [13, 0], [14, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3",
"inputs": [[15, 0], [16, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(2,2)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool3",
"inputs": [[17, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "128",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv4",
"inputs": [[18, 0], [19, 0], [20, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4",
"inputs": [[21, 0], [22, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv5_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv5_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "256"
},
"name": "conv5",
"inputs": [[23, 0], [24, 0], [25, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu5_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu5",
"inputs": [[26, 0], [27, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv6_3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv6_3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "10"
},
"name": "conv6_3",
"inputs": [[28, 0], [29, 0], [30, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv6_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv6_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "4"
},
"name": "conv6_2",
"inputs": [[28, 0], [32, 0], [33, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv6_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv6_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "conv6_1",
"inputs": [[28, 0], [35, 0], [36, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prob1_label",
"inputs": [],
"backward_source_id": -1
},
{
"op": "SoftmaxOutput",
"param": {
"grad_scale": "1",
"ignore_label": "-1",
"multi_output": "False",
"normalization": "null",
"use_ignore": "False"
},
"name": "prob1",
"inputs": [[37, 0], [38, 0]],
"backward_source_id": -1
}
],
"arg_nodes": [
0,
1,
2,
4,
7,
8,
10,
13,
14,
16,
19,
20,
22,
24,
25,
27,
29,
30,
32,
33,
35,
36,
38
],
"heads": [[31, 0], [34, 0], [39, 0]]
}
\ No newline at end of file
name: "ONet"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 48
input_dim: 48
##################################
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 32
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1"
type: "PReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2"
type: "PReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3"
type: "PReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "pool3"
type: "Pooling"
bottom: "conv3"
top: "pool3"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv4"
type: "Convolution"
bottom: "pool3"
top: "conv4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 128
kernel_size: 2
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4"
type: "PReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "InnerProduct"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
#kernel_size: 3
num_output: 256
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "drop5"
type: "Dropout"
bottom: "conv5"
top: "conv5"
dropout_param {
dropout_ratio: 0.25
}
}
layer {
name: "prelu5"
type: "PReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "conv6-1"
type: "InnerProduct"
bottom: "conv5"
top: "conv6-1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
#kernel_size: 1
num_output: 2
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "conv6-2"
type: "InnerProduct"
bottom: "conv5"
top: "conv6-2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
#kernel_size: 1
num_output: 4
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "conv6-3"
type: "InnerProduct"
bottom: "conv5"
top: "conv6-3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
#kernel_size: 1
num_output: 10
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prob1"
type: "Softmax"
bottom: "conv6-1"
top: "prob1"
}
{
"nodes": [
{
"op": "null",
"param": {},
"name": "data",
"inputs": [],
"backward_source_id": -1
},
{
"op": "SliceChannel",
"param": {
"axis": "1",
"num_outputs": "5",
"squeeze_axis": "False"
},
"name": "slice",
"inputs": [[0, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "28",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1_1",
"inputs": [[1, 0], [2, 0], [3, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1_1",
"inputs": [[4, 0], [5, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1_1",
"inputs": [[6, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "48",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2_1",
"inputs": [[7, 0], [8, 0], [9, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2_1",
"inputs": [[10, 0], [11, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2_1",
"inputs": [[12, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3_1",
"inputs": [[13, 0], [14, 0], [15, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3_1",
"inputs": [[16, 0], [17, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "28",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1_2",
"inputs": [[1, 1], [19, 0], [20, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1_2",
"inputs": [[21, 0], [22, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1_2",
"inputs": [[23, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "48",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2_2",
"inputs": [[24, 0], [25, 0], [26, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2_2",
"inputs": [[27, 0], [28, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2_2",
"inputs": [[29, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3_2",
"inputs": [[30, 0], [31, 0], [32, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3_2",
"inputs": [[33, 0], [34, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "28",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1_3",
"inputs": [[1, 2], [36, 0], [37, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1_3",
"inputs": [[38, 0], [39, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1_3",
"inputs": [[40, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "48",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2_3",
"inputs": [[41, 0], [42, 0], [43, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2_3",
"inputs": [[44, 0], [45, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2_3",
"inputs": [[46, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3_3",
"inputs": [[47, 0], [48, 0], [49, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3_3",
"inputs": [[50, 0], [51, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "28",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1_4",
"inputs": [[1, 3], [53, 0], [54, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1_4",
"inputs": [[55, 0], [56, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1_4",
"inputs": [[57, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "48",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2_4",
"inputs": [[58, 0], [59, 0], [60, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2_4",
"inputs": [[61, 0], [62, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2_4",
"inputs": [[63, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3_4",
"inputs": [[64, 0], [65, 0], [66, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3_4",
"inputs": [[67, 0], [68, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_5_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv1_5_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "28",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv1_5",
"inputs": [[1, 4], [70, 0], [71, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu1_5_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu1_5",
"inputs": [[72, 0], [73, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool1_5",
"inputs": [[74, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_5_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv2_5_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(3,3)",
"no_bias": "False",
"num_filter": "48",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv2_5",
"inputs": [[75, 0], [76, 0], [77, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu2_5_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu2_5",
"inputs": [[78, 0], [79, 0]],
"backward_source_id": -1
},
{
"op": "Pooling",
"param": {
"global_pool": "False",
"kernel": "(3,3)",
"pad": "(0,0)",
"pool_type": "max",
"pooling_convention": "full",
"stride": "(2,2)"
},
"name": "pool2_5",
"inputs": [[80, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_5_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "conv3_5_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "Convolution",
"param": {
"cudnn_off": "False",
"cudnn_tune": "off",
"dilate": "(1,1)",
"kernel": "(2,2)",
"no_bias": "False",
"num_filter": "64",
"num_group": "1",
"pad": "(0,0)",
"stride": "(1,1)",
"workspace": "1024"
},
"name": "conv3_5",
"inputs": [[81, 0], [82, 0], [83, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu3_5_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu3_5",
"inputs": [[84, 0], [85, 0]],
"backward_source_id": -1
},
{
"op": "Concat",
"param": {
"dim": "1",
"num_args": "5"
},
"name": "concat",
"inputs": [[18, 0], [35, 0], [52, 0], [69, 0], [86, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "256"
},
"name": "fc4",
"inputs": [[87, 0], [88, 0], [89, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4",
"inputs": [[90, 0], [91, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "64"
},
"name": "fc4_1",
"inputs": [[92, 0], [93, 0], [94, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_1_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4_1",
"inputs": [[95, 0], [96, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_1_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_1_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "fc5_1",
"inputs": [[97, 0], [98, 0], [99, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "64"
},
"name": "fc4_2",
"inputs": [[92, 0], [101, 0], [102, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_2_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4_2",
"inputs": [[103, 0], [104, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_2_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_2_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "fc5_2",
"inputs": [[105, 0], [106, 0], [107, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "64"
},
"name": "fc4_3",
"inputs": [[92, 0], [109, 0], [110, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_3_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4_3",
"inputs": [[111, 0], [112, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_3_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_3_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "fc5_3",
"inputs": [[113, 0], [114, 0], [115, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "64"
},
"name": "fc4_4",
"inputs": [[92, 0], [117, 0], [118, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_4_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4_4",
"inputs": [[119, 0], [120, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_4_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_4_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "fc5_4",
"inputs": [[121, 0], [122, 0], [123, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_5_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc4_5_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "64"
},
"name": "fc4_5",
"inputs": [[92, 0], [125, 0], [126, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "prelu4_5_gamma",
"inputs": [],
"backward_source_id": -1
},
{
"op": "LeakyReLU",
"param": {
"act_type": "prelu",
"lower_bound": "0.125",
"slope": "0.25",
"upper_bound": "0.334"
},
"name": "prelu4_5",
"inputs": [[127, 0], [128, 0]],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_5_weight",
"inputs": [],
"backward_source_id": -1
},
{
"op": "null",
"param": {},
"name": "fc5_5_bias",
"inputs": [],
"backward_source_id": -1
},
{
"op": "FullyConnected",
"param": {
"no_bias": "False",
"num_hidden": "2"
},
"name": "fc5_5",
"inputs": [[129, 0], [130, 0], [131, 0]],
"backward_source_id": -1
}
],
"arg_nodes": [
0,
2,
3,
5,
8,
9,
11,
14,
15,
17,
19,
20,
22,
25,
26,
28,
31,
32,
34,
36,
37,
39,
42,
43,
45,
48,
49,
51,
53,
54,
56,
59,
60,
62,
65,
66,
68,
70,
71,
73,
76,
77,
79,
82,
83,
85,
88,
89,
91,
93,
94,
96,
98,
99,
101,
102,
104,
106,
107,
109,
110,
112,
114,
115,
117,
118,
120,
122,
123,
125,
126,
128,
130,
131
],
"heads": [[100, 0], [108, 0], [116, 0], [124, 0], [132, 0]]
}
\ No newline at end of file
name: "LNet"
input: "data"
input_dim: 1
input_dim: 15
input_dim: 24
input_dim: 24
layer {
name: "slicer_data"
type: "Slice"
bottom: "data"
top: "data241"
top: "data242"
top: "data243"
top: "data244"
top: "data245"
slice_param {
axis: 1
slice_point: 3
slice_point: 6
slice_point: 9
slice_point: 12
}
}
layer {
name: "conv1_1"
type: "Convolution"
bottom: "data241"
top: "conv1_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 28
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1_1"
type: "PReLU"
bottom: "conv1_1"
top: "conv1_1"
}
layer {
name: "pool1_1"
type: "Pooling"
bottom: "conv1_1"
top: "pool1_1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2_1"
type: "Convolution"
bottom: "pool1_1"
top: "conv2_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 48
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2_1"
type: "PReLU"
bottom: "conv2_1"
top: "conv2_1"
}
layer {
name: "pool2_1"
type: "Pooling"
bottom: "conv2_1"
top: "pool2_1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3_1"
type: "Convolution"
bottom: "pool2_1"
top: "conv3_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 2
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3_1"
type: "PReLU"
bottom: "conv3_1"
top: "conv3_1"
}
##########################
layer {
name: "conv1_2"
type: "Convolution"
bottom: "data242"
top: "conv1_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 28
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1_2"
type: "PReLU"
bottom: "conv1_2"
top: "conv1_2"
}
layer {
name: "pool1_2"
type: "Pooling"
bottom: "conv1_2"
top: "pool1_2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2_2"
type: "Convolution"
bottom: "pool1_2"
top: "conv2_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 48
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2_2"
type: "PReLU"
bottom: "conv2_2"
top: "conv2_2"
}
layer {
name: "pool2_2"
type: "Pooling"
bottom: "conv2_2"
top: "pool2_2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3_2"
type: "Convolution"
bottom: "pool2_2"
top: "conv3_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 2
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3_2"
type: "PReLU"
bottom: "conv3_2"
top: "conv3_2"
}
##########################
##########################
layer {
name: "conv1_3"
type: "Convolution"
bottom: "data243"
top: "conv1_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 28
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1_3"
type: "PReLU"
bottom: "conv1_3"
top: "conv1_3"
}
layer {
name: "pool1_3"
type: "Pooling"
bottom: "conv1_3"
top: "pool1_3"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2_3"
type: "Convolution"
bottom: "pool1_3"
top: "conv2_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 48
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2_3"
type: "PReLU"
bottom: "conv2_3"
top: "conv2_3"
}
layer {
name: "pool2_3"
type: "Pooling"
bottom: "conv2_3"
top: "pool2_3"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3_3"
type: "Convolution"
bottom: "pool2_3"
top: "conv3_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 2
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3_3"
type: "PReLU"
bottom: "conv3_3"
top: "conv3_3"
}
##########################
##########################
layer {
name: "conv1_4"
type: "Convolution"
bottom: "data244"
top: "conv1_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 28
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1_4"
type: "PReLU"
bottom: "conv1_4"
top: "conv1_4"
}
layer {
name: "pool1_4"
type: "Pooling"
bottom: "conv1_4"
top: "pool1_4"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2_4"
type: "Convolution"
bottom: "pool1_4"
top: "conv2_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 48
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2_4"
type: "PReLU"
bottom: "conv2_4"
top: "conv2_4"
}
layer {
name: "pool2_4"
type: "Pooling"
bottom: "conv2_4"
top: "pool2_4"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3_4"
type: "Convolution"
bottom: "pool2_4"
top: "conv3_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 2
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3_4"
type: "PReLU"
bottom: "conv3_4"
top: "conv3_4"
}
##########################
##########################
layer {
name: "conv1_5"
type: "Convolution"
bottom: "data245"
top: "conv1_5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 28
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu1_5"
type: "PReLU"
bottom: "conv1_5"
top: "conv1_5"
}
layer {
name: "pool1_5"
type: "Pooling"
bottom: "conv1_5"
top: "pool1_5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2_5"
type: "Convolution"
bottom: "pool1_5"
top: "conv2_5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 48
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu2_5"
type: "PReLU"
bottom: "conv2_5"
top: "conv2_5"
}
layer {
name: "pool2_5"
type: "Pooling"
bottom: "conv2_5"
top: "pool2_5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3_5"
type: "Convolution"
bottom: "pool2_5"
top: "conv3_5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
convolution_param {
num_output: 64
kernel_size: 2
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu3_5"
type: "PReLU"
bottom: "conv3_5"
top: "conv3_5"
}
##########################
layer {
name: "concat"
bottom: "conv3_1"
bottom: "conv3_2"
bottom: "conv3_3"
bottom: "conv3_4"
bottom: "conv3_5"
top: "conv3"
type: "Concat"
concat_param {
axis: 1
}
}
##########################
layer {
name: "fc4"
type: "InnerProduct"
bottom: "conv3"
top: "fc4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 256
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4"
type: "PReLU"
bottom: "fc4"
top: "fc4"
}
############################
layer {
name: "fc4_1"
type: "InnerProduct"
bottom: "fc4"
top: "fc4_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 64
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4_1"
type: "PReLU"
bottom: "fc4_1"
top: "fc4_1"
}
layer {
name: "fc5_1"
type: "InnerProduct"
bottom: "fc4_1"
top: "fc5_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
#type: "constant"
#value: 0
}
bias_filler {
type: "constant"
value: 0
}
}
}
#########################
layer {
name: "fc4_2"
type: "InnerProduct"
bottom: "fc4"
top: "fc4_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 64
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4_2"
type: "PReLU"
bottom: "fc4_2"
top: "fc4_2"
}
layer {
name: "fc5_2"
type: "InnerProduct"
bottom: "fc4_2"
top: "fc5_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
#type: "constant"
#value: 0
}
bias_filler {
type: "constant"
value: 0
}
}
}
#########################
layer {
name: "fc4_3"
type: "InnerProduct"
bottom: "fc4"
top: "fc4_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 64
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4_3"
type: "PReLU"
bottom: "fc4_3"
top: "fc4_3"
}
layer {
name: "fc5_3"
type: "InnerProduct"
bottom: "fc4_3"
top: "fc5_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
#type: "constant"
#value: 0
}
bias_filler {
type: "constant"
value: 0
}
}
}
#########################
layer {
name: "fc4_4"
type: "InnerProduct"
bottom: "fc4"
top: "fc4_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 64
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4_4"
type: "PReLU"
bottom: "fc4_4"
top: "fc4_4"
}
layer {
name: "fc5_4"
type: "InnerProduct"
bottom: "fc4_4"
top: "fc5_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
#type: "constant"
#value: 0
}
bias_filler {
type: "constant"
value: 0
}
}
}
#########################
layer {
name: "fc4_5"
type: "InnerProduct"
bottom: "fc4"
top: "fc4_5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 64
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "prelu4_5"
type: "PReLU"
bottom: "fc4_5"
top: "fc4_5"
}
layer {
name: "fc5_5"
type: "InnerProduct"
bottom: "fc4_5"
top: "fc5_5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 1
}
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
#type: "constant"
#value: 0
}
bias_filler {
type: "constant"
value: 0
}
}
}
#########################
# coding: utf-8
import os
import mxnet as mx
import numpy as np
import math
import cv2
from multiprocessing import Pool
from itertools import repeat
#from itertools import zip_longest as zip
from itertools import izip
from helper import nms, adjust_input, generate_bbox, detect_first_stage_warpper
class MtcnnDetector(object):
"""
Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Neural Networks
see https://github.com/kpzhang93/MTCNN_face_detection_alignment
this is a mxnet version
"""
def __init__(self,
model_folder='.',
minsize = 20,
threshold = [0.6, 0.7, 0.8],
factor = 0.709,
num_worker = 1,
accurate_landmark = False,
ctx=mx.cpu()):
"""
Initialize the detector
Parameters:
----------
model_folder : string
path for the models
minsize : float number
minimal face to detect
threshold : float number
detect threshold for 3 stages
factor: float number
scale factor for image pyramid
num_worker: int number
number of processes we use for first stage
accurate_landmark: bool
use accurate landmark localization or not
"""
self.num_worker = num_worker
self.accurate_landmark = accurate_landmark
# load 4 models from folder
models = ['det1', 'det2', 'det3','det4']
models = [ os.path.join(model_folder, f) for f in models]
self.PNets = []
for i in range(num_worker):
workner_net = mx.model.FeedForward.load(models[0], 1, ctx=ctx)
self.PNets.append(workner_net)
#self.Pool = Pool(num_worker)
self.RNet = mx.model.FeedForward.load(models[1], 1, ctx=ctx)
self.ONet = mx.model.FeedForward.load(models[2], 1, ctx=ctx)
self.LNet = mx.model.FeedForward.load(models[3], 1, ctx=ctx)
self.minsize = float(minsize)
self.factor = float(factor)
self.threshold = threshold
def convert_to_square(self, bbox):
"""
convert bbox to square
Parameters:
----------
bbox: numpy array , shape n x 5
input bbox
Returns:
-------
square bbox
"""
square_bbox = bbox.copy()
h = bbox[:, 3] - bbox[:, 1] + 1
w = bbox[:, 2] - bbox[:, 0] + 1
max_side = np.maximum(h,w)
square_bbox[:, 0] = bbox[:, 0] + w*0.5 - max_side*0.5
square_bbox[:, 1] = bbox[:, 1] + h*0.5 - max_side*0.5
square_bbox[:, 2] = square_bbox[:, 0] + max_side - 1
square_bbox[:, 3] = square_bbox[:, 1] + max_side - 1
return square_bbox
def calibrate_box(self, bbox, reg):
"""
calibrate bboxes
Parameters:
----------
bbox: numpy array, shape n x 5
input bboxes
reg: numpy array, shape n x 4
bboxex adjustment
Returns:
-------
bboxes after refinement
"""
w = bbox[:, 2] - bbox[:, 0] + 1
w = np.expand_dims(w, 1)
h = bbox[:, 3] - bbox[:, 1] + 1
h = np.expand_dims(h, 1)
reg_m = np.hstack([w, h, w, h])
aug = reg_m * reg
bbox[:, 0:4] = bbox[:, 0:4] + aug
return bbox
def pad(self, bboxes, w, h):
"""
pad the the bboxes, alse restrict the size of it
Parameters:
----------
bboxes: numpy array, n x 5
input bboxes
w: float number
width of the input image
h: float number
height of the input image
Returns :
------s
dy, dx : numpy array, n x 1
start point of the bbox in target image
edy, edx : numpy array, n x 1
end point of the bbox in target image
y, x : numpy array, n x 1
start point of the bbox in original image
ex, ex : numpy array, n x 1
end point of the bbox in original image
tmph, tmpw: numpy array, n x 1
height and width of the bbox
"""
tmpw, tmph = bboxes[:, 2] - bboxes[:, 0] + 1, bboxes[:, 3] - bboxes[:, 1] + 1
num_box = bboxes.shape[0]
dx , dy= np.zeros((num_box, )), np.zeros((num_box, ))
edx, edy = tmpw.copy()-1, tmph.copy()-1
x, y, ex, ey = bboxes[:, 0], bboxes[:, 1], bboxes[:, 2], bboxes[:, 3]
tmp_index = np.where(ex > w-1)
edx[tmp_index] = tmpw[tmp_index] + w - 2 - ex[tmp_index]
ex[tmp_index] = w - 1
tmp_index = np.where(ey > h-1)
edy[tmp_index] = tmph[tmp_index] + h - 2 - ey[tmp_index]
ey[tmp_index] = h - 1
tmp_index = np.where(x < 0)
dx[tmp_index] = 0 - x[tmp_index]
x[tmp_index] = 0
tmp_index = np.where(y < 0)
dy[tmp_index] = 0 - y[tmp_index]
y[tmp_index] = 0
return_list = [dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph]
return_list = [item.astype(np.int32) for item in return_list]
return return_list
def slice_index(self, number):
"""
slice the index into (n,n,m), m < n
Parameters:
----------
number: int number
number
"""
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
num_list = range(number)
return list(chunks(num_list, self.num_worker))
def detect_face_limited(self, img, det_type=2):
height, width, _ = img.shape
if det_type>=2:
total_boxes = np.array( [ [0.0, 0.0, img.shape[1], img.shape[0], 0.9] ] ,dtype=np.float32)
num_box = total_boxes.shape[0]
# pad the bbox
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(total_boxes, width, height)
# (3, 24, 24) is the input shape for RNet
input_buf = np.zeros((num_box, 3, 24, 24), dtype=np.float32)
for i in range(num_box):
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
tmp[dy[i]:edy[i]+1, dx[i]:edx[i]+1, :] = img[y[i]:ey[i]+1, x[i]:ex[i]+1, :]
input_buf[i, :, :, :] = adjust_input(cv2.resize(tmp, (24, 24)))
output = self.RNet.predict(input_buf)
# filter the total_boxes with threshold
passed = np.where(output[1][:, 1] > self.threshold[1])
total_boxes = total_boxes[passed]
if total_boxes.size == 0:
return None
total_boxes[:, 4] = output[1][passed, 1].reshape((-1,))
reg = output[0][passed]
# nms
pick = nms(total_boxes, 0.7, 'Union')
total_boxes = total_boxes[pick]
total_boxes = self.calibrate_box(total_boxes, reg[pick])
total_boxes = self.convert_to_square(total_boxes)
total_boxes[:, 0:4] = np.round(total_boxes[:, 0:4])
else:
total_boxes = np.array( [ [0.0, 0.0, img.shape[1], img.shape[0], 0.9] ] ,dtype=np.float32)
num_box = total_boxes.shape[0]
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(total_boxes, width, height)
# (3, 48, 48) is the input shape for ONet
input_buf = np.zeros((num_box, 3, 48, 48), dtype=np.float32)
for i in range(num_box):
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.float32)
tmp[dy[i]:edy[i]+1, dx[i]:edx[i]+1, :] = img[y[i]:ey[i]+1, x[i]:ex[i]+1, :]
input_buf[i, :, :, :] = adjust_input(cv2.resize(tmp, (48, 48)))
output = self.ONet.predict(input_buf)
#print(output[2])
# filter the total_boxes with threshold
passed = np.where(output[2][:, 1] > self.threshold[2])
total_boxes = total_boxes[passed]
if total_boxes.size == 0:
return None
total_boxes[:, 4] = output[2][passed, 1].reshape((-1,))
reg = output[1][passed]
points = output[0][passed]
# compute landmark points
bbw = total_boxes[:, 2] - total_boxes[:, 0] + 1
bbh = total_boxes[:, 3] - total_boxes[:, 1] + 1
points[:, 0:5] = np.expand_dims(total_boxes[:, 0], 1) + np.expand_dims(bbw, 1) * points[:, 0:5]
points[:, 5:10] = np.expand_dims(total_boxes[:, 1], 1) + np.expand_dims(bbh, 1) * points[:, 5:10]
# nms
total_boxes = self.calibrate_box(total_boxes, reg)
pick = nms(total_boxes, 0.7, 'Min')
total_boxes = total_boxes[pick]
points = points[pick]
if not self.accurate_landmark:
return total_boxes, points
#############################################
# extended stage
#############################################
num_box = total_boxes.shape[0]
patchw = np.maximum(total_boxes[:, 2]-total_boxes[:, 0]+1, total_boxes[:, 3]-total_boxes[:, 1]+1)
patchw = np.round(patchw*0.25)
# make it even
patchw[np.where(np.mod(patchw,2) == 1)] += 1
input_buf = np.zeros((num_box, 15, 24, 24), dtype=np.float32)
for i in range(5):
x, y = points[:, i], points[:, i+5]
x, y = np.round(x-0.5*patchw), np.round(y-0.5*patchw)
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(np.vstack([x, y, x+patchw-1, y+patchw-1]).T,
width,
height)
for j in range(num_box):
tmpim = np.zeros((tmpw[j], tmpw[j], 3), dtype=np.float32)
tmpim[dy[j]:edy[j]+1, dx[j]:edx[j]+1, :] = img[y[j]:ey[j]+1, x[j]:ex[j]+1, :]
input_buf[j, i*3:i*3+3, :, :] = adjust_input(cv2.resize(tmpim, (24, 24)))
output = self.LNet.predict(input_buf)
pointx = np.zeros((num_box, 5))
pointy = np.zeros((num_box, 5))
for k in range(5):
# do not make a large movement
tmp_index = np.where(np.abs(output[k]-0.5) > 0.35)
output[k][tmp_index[0]] = 0.5
pointx[:, k] = np.round(points[:, k] - 0.5*patchw) + output[k][:, 0]*patchw
pointy[:, k] = np.round(points[:, k+5] - 0.5*patchw) + output[k][:, 1]*patchw
points = np.hstack([pointx, pointy])
points = points.astype(np.int32)
return total_boxes, points
def detect_face(self, img, det_type=0):
"""
detect face over img
Parameters:
----------
img: numpy array, bgr order of shape (1, 3, n, m)
input image
Retures:
-------
bboxes: numpy array, n x 5 (x1,y2,x2,y2,score)
bboxes
points: numpy array, n x 10 (x1, x2 ... x5, y1, y2 ..y5)
landmarks
"""
# check input
height, width, _ = img.shape
if det_type==0:
MIN_DET_SIZE = 12
if img is None:
return None
# only works for color image
if len(img.shape) != 3:
return None
# detected boxes
total_boxes = []
minl = min( height, width)
# get all the valid scales
scales = []
m = MIN_DET_SIZE/self.minsize
minl *= m
factor_count = 0
while minl > MIN_DET_SIZE:
scales.append(m*self.factor**factor_count)
minl *= self.factor
factor_count += 1
#############################################
# first stage
#############################################
#for scale in scales:
# return_boxes = self.detect_first_stage(img, scale, 0)
# if return_boxes is not None:
# total_boxes.append(return_boxes)
sliced_index = self.slice_index(len(scales))
total_boxes = []
for batch in sliced_index:
#local_boxes = self.Pool.map( detect_first_stage_warpper, \
# izip(repeat(img), self.PNets[:len(batch)], [scales[i] for i in batch], repeat(self.threshold[0])) )
local_boxes = map( detect_first_stage_warpper, \
izip(repeat(img), self.PNets[:len(batch)], [scales[i] for i in batch], repeat(self.threshold[0])) )
total_boxes.extend(local_boxes)
#print('local_boxes',local_boxes)
# remove the Nones
total_boxes = [ i for i in total_boxes if i is not None]
if len(total_boxes) == 0:
return None
total_boxes = np.vstack(total_boxes)
if total_boxes.size == 0:
return None
# merge the detection from first stage
pick = nms(total_boxes[:, 0:5], 0.7, 'Union')
total_boxes = total_boxes[pick]
bbw = total_boxes[:, 2] - total_boxes[:, 0] + 1
bbh = total_boxes[:, 3] - total_boxes[:, 1] + 1
# refine the bboxes
total_boxes = np.vstack([total_boxes[:, 0]+total_boxes[:, 5] * bbw,
total_boxes[:, 1]+total_boxes[:, 6] * bbh,
total_boxes[:, 2]+total_boxes[:, 7] * bbw,
total_boxes[:, 3]+total_boxes[:, 8] * bbh,
total_boxes[:, 4]
])
total_boxes = total_boxes.T
total_boxes = self.convert_to_square(total_boxes)
total_boxes[:, 0:4] = np.round(total_boxes[:, 0:4])
else:
total_boxes = np.array( [ [0.0, 0.0, img.shape[1], img.shape[0], 0.9] ] ,dtype=np.float32)
#############################################
# second stage
#############################################
num_box = total_boxes.shape[0]
# pad the bbox
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(total_boxes, width, height)
# (3, 24, 24) is the input shape for RNet
input_buf = np.zeros((num_box, 3, 24, 24), dtype=np.float32)
for i in range(num_box):
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
tmp[dy[i]:edy[i]+1, dx[i]:edx[i]+1, :] = img[y[i]:ey[i]+1, x[i]:ex[i]+1, :]
input_buf[i, :, :, :] = adjust_input(cv2.resize(tmp, (24, 24)))
output = self.RNet.predict(input_buf)
# filter the total_boxes with threshold
passed = np.where(output[1][:, 1] > self.threshold[1])
total_boxes = total_boxes[passed]
if total_boxes.size == 0:
return None
total_boxes[:, 4] = output[1][passed, 1].reshape((-1,))
reg = output[0][passed]
# nms
pick = nms(total_boxes, 0.7, 'Union')
total_boxes = total_boxes[pick]
total_boxes = self.calibrate_box(total_boxes, reg[pick])
total_boxes = self.convert_to_square(total_boxes)
total_boxes[:, 0:4] = np.round(total_boxes[:, 0:4])
#############################################
# third stage
#############################################
num_box = total_boxes.shape[0]
# pad the bbox
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(total_boxes, width, height)
# (3, 48, 48) is the input shape for ONet
input_buf = np.zeros((num_box, 3, 48, 48), dtype=np.float32)
for i in range(num_box):
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.float32)
tmp[dy[i]:edy[i]+1, dx[i]:edx[i]+1, :] = img[y[i]:ey[i]+1, x[i]:ex[i]+1, :]
input_buf[i, :, :, :] = adjust_input(cv2.resize(tmp, (48, 48)))
output = self.ONet.predict(input_buf)
# filter the total_boxes with threshold
passed = np.where(output[2][:, 1] > self.threshold[2])
total_boxes = total_boxes[passed]
if total_boxes.size == 0:
return None
total_boxes[:, 4] = output[2][passed, 1].reshape((-1,))
reg = output[1][passed]
points = output[0][passed]
# compute landmark points
bbw = total_boxes[:, 2] - total_boxes[:, 0] + 1
bbh = total_boxes[:, 3] - total_boxes[:, 1] + 1
points[:, 0:5] = np.expand_dims(total_boxes[:, 0], 1) + np.expand_dims(bbw, 1) * points[:, 0:5]
points[:, 5:10] = np.expand_dims(total_boxes[:, 1], 1) + np.expand_dims(bbh, 1) * points[:, 5:10]
# nms
total_boxes = self.calibrate_box(total_boxes, reg)
pick = nms(total_boxes, 0.7, 'Min')
total_boxes = total_boxes[pick]
points = points[pick]
if not self.accurate_landmark:
return total_boxes, points
#############################################
# extended stage
#############################################
num_box = total_boxes.shape[0]
patchw = np.maximum(total_boxes[:, 2]-total_boxes[:, 0]+1, total_boxes[:, 3]-total_boxes[:, 1]+1)
patchw = np.round(patchw*0.25)
# make it even
patchw[np.where(np.mod(patchw,2) == 1)] += 1
input_buf = np.zeros((num_box, 15, 24, 24), dtype=np.float32)
for i in range(5):
x, y = points[:, i], points[:, i+5]
x, y = np.round(x-0.5*patchw), np.round(y-0.5*patchw)
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(np.vstack([x, y, x+patchw-1, y+patchw-1]).T,
width,
height)
for j in range(num_box):
tmpim = np.zeros((tmpw[j], tmpw[j], 3), dtype=np.float32)
tmpim[dy[j]:edy[j]+1, dx[j]:edx[j]+1, :] = img[y[j]:ey[j]+1, x[j]:ex[j]+1, :]
input_buf[j, i*3:i*3+3, :, :] = adjust_input(cv2.resize(tmpim, (24, 24)))
output = self.LNet.predict(input_buf)
pointx = np.zeros((num_box, 5))
pointy = np.zeros((num_box, 5))
for k in range(5):
# do not make a large movement
tmp_index = np.where(np.abs(output[k]-0.5) > 0.35)
output[k][tmp_index[0]] = 0.5
pointx[:, k] = np.round(points[:, k] - 0.5*patchw) + output[k][:, 0]*patchw
pointy[:, k] = np.round(points[:, k+5] - 0.5*patchw) + output[k][:, 1]*patchw
points = np.hstack([pointx, pointy])
points = points.astype(np.int32)
return total_boxes, points
def list2colmatrix(self, pts_list):
"""
convert list to column matrix
Parameters:
----------
pts_list:
input list
Retures:
-------
colMat:
"""
assert len(pts_list) > 0
colMat = []
for i in range(len(pts_list)):
colMat.append(pts_list[i][0])
colMat.append(pts_list[i][1])
colMat = np.matrix(colMat).transpose()
return colMat
def find_tfrom_between_shapes(self, from_shape, to_shape):
"""
find transform between shapes
Parameters:
----------
from_shape:
to_shape:
Retures:
-------
tran_m:
tran_b:
"""
assert from_shape.shape[0] == to_shape.shape[0] and from_shape.shape[0] % 2 == 0
sigma_from = 0.0
sigma_to = 0.0
cov = np.matrix([[0.0, 0.0], [0.0, 0.0]])
# compute the mean and cov
from_shape_points = from_shape.reshape(from_shape.shape[0]/2, 2)
to_shape_points = to_shape.reshape(to_shape.shape[0]/2, 2)
mean_from = from_shape_points.mean(axis=0)
mean_to = to_shape_points.mean(axis=0)
for i in range(from_shape_points.shape[0]):
temp_dis = np.linalg.norm(from_shape_points[i] - mean_from)
sigma_from += temp_dis * temp_dis
temp_dis = np.linalg.norm(to_shape_points[i] - mean_to)
sigma_to += temp_dis * temp_dis
cov += (to_shape_points[i].transpose() - mean_to.transpose()) * (from_shape_points[i] - mean_from)
sigma_from = sigma_from / to_shape_points.shape[0]
sigma_to = sigma_to / to_shape_points.shape[0]
cov = cov / to_shape_points.shape[0]
# compute the affine matrix
s = np.matrix([[1.0, 0.0], [0.0, 1.0]])
u, d, vt = np.linalg.svd(cov)
if np.linalg.det(cov) < 0:
if d[1] < d[0]:
s[1, 1] = -1
else:
s[0, 0] = -1
r = u * s * vt
c = 1.0
if sigma_from != 0:
c = 1.0 / sigma_from * np.trace(np.diag(d) * s)
tran_b = mean_to.transpose() - c * r * mean_from.transpose()
tran_m = c * r
return tran_m, tran_b
def extract_image_chips(self, img, points, desired_size=256, padding=0):
"""
crop and align face
Parameters:
----------
img: numpy array, bgr order of shape (1, 3, n, m)
input image
points: numpy array, n x 10 (x1, x2 ... x5, y1, y2 ..y5)
desired_size: default 256
padding: default 0
Retures:
-------
crop_imgs: list, n
cropped and aligned faces
"""
crop_imgs = []
for p in points:
shape =[]
for k in range(len(p)/2):
shape.append(p[k])
shape.append(p[k+5])
if padding > 0:
padding = padding
else:
padding = 0
# average positions of face points
mean_face_shape_x = [0.224152, 0.75610125, 0.490127, 0.254149, 0.726104]
mean_face_shape_y = [0.2119465, 0.2119465, 0.628106, 0.780233, 0.780233]
from_points = []
to_points = []
for i in range(len(shape)/2):
x = (padding + mean_face_shape_x[i]) / (2 * padding + 1) * desired_size
y = (padding + mean_face_shape_y[i]) / (2 * padding + 1) * desired_size
to_points.append([x, y])
from_points.append([shape[2*i], shape[2*i+1]])
# convert the points to Mat
from_mat = self.list2colmatrix(from_points)
to_mat = self.list2colmatrix(to_points)
# compute the similar transfrom
tran_m, tran_b = self.find_tfrom_between_shapes(from_mat, to_mat)
probe_vec = np.matrix([1.0, 0.0]).transpose()
probe_vec = tran_m * probe_vec
scale = np.linalg.norm(probe_vec)
angle = 180.0 / math.pi * math.atan2(probe_vec[1, 0], probe_vec[0, 0])
from_center = [(shape[0]+shape[2])/2.0, (shape[1]+shape[3])/2.0]
to_center = [0, 0]
to_center[1] = desired_size * 0.4
to_center[0] = desired_size * 0.5
ex = to_center[0] - from_center[0]
ey = to_center[1] - from_center[1]
rot_mat = cv2.getRotationMatrix2D((from_center[0], from_center[1]), -1*angle, scale)
rot_mat[0][2] += ex
rot_mat[1][2] += ey
chips = cv2.warpAffine(img, rot_mat, (desired_size, desired_size))
crop_imgs.append(chips)
return crop_imgs
import mxnet.optimizer as optimizer
from mxnet import ndarray as nd
class NoiseSGD(optimizer.SGD):
"""Noise SGD.
This optimizer accepts the same arguments as :class:`.SGD`.
"""
def __init__(self, scale, **kwargs):
super(NoiseSGD, self).__init__(**kwargs)
print('init noise sgd with', scale)
self.scale = scale
def update(self, index, weight, grad, state):
assert(isinstance(weight, NDArray))
assert(isinstance(grad, NDArray))
self._update_count(index)
lr = self._get_lr(index)
wd = self._get_wd(index)
grad = grad * self.rescale_grad
if self.clip_gradient is not None:
grad = clip(grad, -self.clip_gradient, self.clip_gradient)
noise = nd.random.normal(scale = self.scale, shape = grad.shape, dtype=grad.dtype, ctx = grad.context)
grad += noise
if state is not None:
mom = state
mom[:] *= self.momentum
grad += wd * weight
mom[:] += grad
grad[:] += self.momentum * mom
weight[:] += -lr * grad
else:
assert self.momentum == 0.0
weight[:] += -lr * (grad + wd * weight)
python gender.py --image testimg
#python test.py --image testimg
Copyright (c) 2017, rentingting
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include README.md
include requirements.txt
include AgeGenderDist/model/*
include AgeGenderDist/mtcnn-model/*
include AgeGenderDist/face_image
include AgeGenderDist/face_model
include AgeGenderDist/face_preprocess
include AgeGenderDist/helper
include AgeGenderDist/mtcnn_detector
include AgeGenderDist/noise_sgd
include AgeGenderDist/gender
AgeGenderDist
===============================
version number: 0.1.0
author: rentingting
Overview
--------
A short description of the project
Installation / Usage
--------------------
To install use pip:
$ pip install AgeGenderDist
Or clone the repo:
$ git clone https://github.com/rentingting/AgeGenderDist.git
$ python setup.py install
Contributing
------------
TBD
Example
-------
TBD
\ No newline at end of file
# Dev/Deployment
mxnet-cu100==1.4.1
scipy==1.2.2
scikit-learn==0.20.3
opencv-python==4.1.0.25
easydict==1.9
scikit-image==0.14.3
from setuptools import setup, find_packages
from codecs import open
from os import path
__version__ = '0.1.0'
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# get the dependencies and installs
with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
dependency_links = [x.strip().replace('git+', '') for x in all_reqs if x.startswith('git+')]
setup(
name='AgeGenderDist',
version=__version__,
description='A short description of the project',
long_description=long_description,
url='https://github.com/rentingting/AgeGenderDist',
download_url='https://github.com/rentingting/AgeGenderDist/tarball/' + __version__,
license='BSD',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
],
keywords='',
packages=find_packages(exclude=['docs', 'tests*']),
include_package_data=True,
author='rentingting',
install_requires=install_requires,
dependency_links=dependency_links,
author_email='Your address email (eq. you@example.com)'
)
# Sample Test passing with nose and pytest
def test_pass():
assert True, "dummy sample test"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment