Skip to content

Commit f087dea

Browse files
committed
Initial comit
0 parents  commit f087dea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+504933
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vs/MTCNN/v14/.suo
2+
bin/
3+
train/
4+
x64/

CMakeLists.txt

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
3+
project(MTCNN)
4+
set(CMAKE_CXX_STANDARD 11)
5+
6+
find_package(OpenCV REQUIRED)
7+
option(BUILD_CAFFE "build with caffe" ON)
8+
option(BUILD_NCNN "build with ncnn" ON)
9+
10+
#default build light, only depend on openblas
11+
add_subdirectory(MTCNN-light)
12+
13+
#need opencv version >= 3.4.* or recompile opencv with conrtib module
14+
#add_subdirectory(Fast-MTCNN)
15+
16+
if(BUILD_CAFFE)
17+
find_package(Caffe REQUIRED)
18+
include_directories(${Caffe_INCLUDE_DIRS})
19+
add_subdirectory(cpp)
20+
endif()
21+
22+
if(BUILD_NCNN)
23+
add_subdirectory(ncnn)
24+
endif()

Fast-MTCNN/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
AUX_SOURCE_DIRECTORY(./ SRC_FILES)
2+
set(DEMO_NAME Fast-MTCNN)
3+
add_executable(${DEMO_NAME} ${SRC_FILES})
4+
5+
target_link_libraries(${DEMO_NAME} ${OpenCV_LIBS})

Fast-MTCNN/Fast-MTCNN.vcxproj

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{7B3E0D5D-CB84-451F-9E0D-D5DDF93203E1}</ProjectGuid>
23+
<Keyword>Win32Proj</Keyword>
24+
<RootNamespace>FastMTCNN</RootNamespace>
25+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
26+
</PropertyGroup>
27+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
29+
<ConfigurationType>Application</ConfigurationType>
30+
<UseDebugLibraries>true</UseDebugLibraries>
31+
<PlatformToolset>v140</PlatformToolset>
32+
<CharacterSet>Unicode</CharacterSet>
33+
</PropertyGroup>
34+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
35+
<ConfigurationType>Application</ConfigurationType>
36+
<UseDebugLibraries>false</UseDebugLibraries>
37+
<PlatformToolset>v140</PlatformToolset>
38+
<WholeProgramOptimization>true</WholeProgramOptimization>
39+
<CharacterSet>Unicode</CharacterSet>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
42+
<ConfigurationType>Application</ConfigurationType>
43+
<UseDebugLibraries>true</UseDebugLibraries>
44+
<PlatformToolset>v140</PlatformToolset>
45+
<CharacterSet>Unicode</CharacterSet>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
48+
<ConfigurationType>Application</ConfigurationType>
49+
<UseDebugLibraries>false</UseDebugLibraries>
50+
<PlatformToolset>v140</PlatformToolset>
51+
<WholeProgramOptimization>true</WholeProgramOptimization>
52+
<CharacterSet>Unicode</CharacterSet>
53+
</PropertyGroup>
54+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
55+
<ImportGroup Label="ExtensionSettings">
56+
</ImportGroup>
57+
<ImportGroup Label="Shared">
58+
</ImportGroup>
59+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
63+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
64+
</ImportGroup>
65+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
66+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
67+
</ImportGroup>
68+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
69+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
70+
</ImportGroup>
71+
<PropertyGroup Label="UserMacros" />
72+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
73+
<LinkIncremental>true</LinkIncremental>
74+
</PropertyGroup>
75+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
76+
<LinkIncremental>true</LinkIncremental>
77+
</PropertyGroup>
78+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
79+
<LinkIncremental>false</LinkIncremental>
80+
</PropertyGroup>
81+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
82+
<LinkIncremental>false</LinkIncremental>
83+
<IncludePath>D:\opencv347\build\include;$(IncludePath)</IncludePath>
84+
</PropertyGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86+
<ClCompile>
87+
<PrecompiledHeader>
88+
</PrecompiledHeader>
89+
<WarningLevel>Level3</WarningLevel>
90+
<Optimization>Disabled</Optimization>
91+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<SDLCheck>true</SDLCheck>
93+
</ClCompile>
94+
<Link>
95+
<SubSystem>Console</SubSystem>
96+
<GenerateDebugInformation>true</GenerateDebugInformation>
97+
</Link>
98+
</ItemDefinitionGroup>
99+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
100+
<ClCompile>
101+
<PrecompiledHeader>
102+
</PrecompiledHeader>
103+
<WarningLevel>Level3</WarningLevel>
104+
<Optimization>Disabled</Optimization>
105+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106+
<SDLCheck>true</SDLCheck>
107+
</ClCompile>
108+
<Link>
109+
<SubSystem>Console</SubSystem>
110+
<GenerateDebugInformation>true</GenerateDebugInformation>
111+
</Link>
112+
</ItemDefinitionGroup>
113+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
114+
<ClCompile>
115+
<WarningLevel>Level3</WarningLevel>
116+
<PrecompiledHeader>
117+
</PrecompiledHeader>
118+
<Optimization>MaxSpeed</Optimization>
119+
<FunctionLevelLinking>true</FunctionLevelLinking>
120+
<IntrinsicFunctions>true</IntrinsicFunctions>
121+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
122+
<SDLCheck>true</SDLCheck>
123+
</ClCompile>
124+
<Link>
125+
<SubSystem>Console</SubSystem>
126+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
127+
<OptimizeReferences>true</OptimizeReferences>
128+
<GenerateDebugInformation>true</GenerateDebugInformation>
129+
</Link>
130+
</ItemDefinitionGroup>
131+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
132+
<ClCompile>
133+
<WarningLevel>Level3</WarningLevel>
134+
<PrecompiledHeader>
135+
</PrecompiledHeader>
136+
<Optimization>MaxSpeed</Optimization>
137+
<FunctionLevelLinking>true</FunctionLevelLinking>
138+
<IntrinsicFunctions>true</IntrinsicFunctions>
139+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
140+
<SDLCheck>true</SDLCheck>
141+
</ClCompile>
142+
<Link>
143+
<SubSystem>Console</SubSystem>
144+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
145+
<OptimizeReferences>true</OptimizeReferences>
146+
<GenerateDebugInformation>true</GenerateDebugInformation>
147+
</Link>
148+
</ItemDefinitionGroup>
149+
<ItemGroup>
150+
<ClCompile Include="mtcnn_opencv.cpp" />
151+
</ItemGroup>
152+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
153+
<ImportGroup Label="ExtensionTargets">
154+
</ImportGroup>
155+
</Project>

Fast-MTCNN/model/det1.prototxt

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: "PNet"
2+
input: "data"
3+
input_dim: 1
4+
input_dim: 3
5+
input_dim: 12
6+
input_dim: 12
7+
8+
layer {
9+
name: "conv1"
10+
type: "Convolution"
11+
bottom: "data"
12+
top: "conv1"
13+
param {
14+
lr_mult: 1
15+
decay_mult: 1
16+
}
17+
param {
18+
lr_mult: 2
19+
decay_mult: 0
20+
}
21+
convolution_param {
22+
num_output: 10
23+
kernel_size: 3
24+
stride: 1
25+
weight_filler {
26+
type: "xavier"
27+
}
28+
bias_filler {
29+
type: "constant"
30+
value: 0
31+
}
32+
}
33+
}
34+
layer {
35+
name: "PReLU1"
36+
type: "PReLU"
37+
bottom: "conv1"
38+
top: "conv1"
39+
}
40+
layer {
41+
name: "pool1"
42+
type: "Pooling"
43+
bottom: "conv1"
44+
top: "pool1"
45+
pooling_param {
46+
pool: MAX
47+
kernel_size: 2
48+
stride: 2
49+
}
50+
}
51+
52+
layer {
53+
name: "conv2"
54+
type: "Convolution"
55+
bottom: "pool1"
56+
top: "conv2"
57+
param {
58+
lr_mult: 1
59+
decay_mult: 1
60+
}
61+
param {
62+
lr_mult: 2
63+
decay_mult: 0
64+
}
65+
convolution_param {
66+
num_output: 16
67+
kernel_size: 3
68+
stride: 1
69+
weight_filler {
70+
type: "xavier"
71+
}
72+
bias_filler {
73+
type: "constant"
74+
value: 0
75+
}
76+
}
77+
}
78+
layer {
79+
name: "PReLU2"
80+
type: "PReLU"
81+
bottom: "conv2"
82+
top: "conv2"
83+
}
84+
85+
layer {
86+
name: "conv3"
87+
type: "Convolution"
88+
bottom: "conv2"
89+
top: "conv3"
90+
param {
91+
lr_mult: 1
92+
decay_mult: 1
93+
}
94+
param {
95+
lr_mult: 2
96+
decay_mult: 0
97+
}
98+
convolution_param {
99+
num_output: 32
100+
kernel_size: 3
101+
stride: 1
102+
weight_filler {
103+
type: "xavier"
104+
}
105+
bias_filler {
106+
type: "constant"
107+
value: 0
108+
}
109+
}
110+
}
111+
layer {
112+
name: "PReLU3"
113+
type: "PReLU"
114+
bottom: "conv3"
115+
top: "conv3"
116+
}
117+
118+
119+
layer {
120+
name: "conv4-1"
121+
type: "Convolution"
122+
bottom: "conv3"
123+
top: "conv4-1"
124+
param {
125+
lr_mult: 1
126+
decay_mult: 1
127+
}
128+
param {
129+
lr_mult: 2
130+
decay_mult: 0
131+
}
132+
convolution_param {
133+
num_output: 2
134+
kernel_size: 1
135+
stride: 1
136+
weight_filler {
137+
type: "xavier"
138+
}
139+
bias_filler {
140+
type: "constant"
141+
value: 0
142+
}
143+
}
144+
}
145+
146+
layer {
147+
name: "conv4-2"
148+
type: "Convolution"
149+
bottom: "conv3"
150+
top: "conv4-2"
151+
param {
152+
lr_mult: 1
153+
decay_mult: 1
154+
}
155+
param {
156+
lr_mult: 2
157+
decay_mult: 0
158+
}
159+
convolution_param {
160+
num_output: 4
161+
kernel_size: 1
162+
stride: 1
163+
weight_filler {
164+
type: "xavier"
165+
}
166+
bias_filler {
167+
type: "constant"
168+
value: 0
169+
}
170+
}
171+
}
172+
layer {
173+
name: "prob1"
174+
type: "Softmax"
175+
bottom: "conv4-1"
176+
top: "prob1"
177+
}

Fast-MTCNN/model/det1_.caffemodel

16.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)