Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
aba68d6f
Commit
aba68d6f
authored
Apr 29, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
428b0bb8
1f0705ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
spatial_filtering.h
dlib/image_transforms/spatial_filtering.h
+19
-9
dnn_mnist_advanced_ex.cpp
examples/dnn_mnist_advanced_ex.cpp
+3
-1
No files found.
dlib/image_transforms/spatial_filtering.h
View file @
aba68d6f
...
@@ -1233,15 +1233,25 @@ namespace dlib
...
@@ -1233,15 +1233,25 @@ namespace dlib
<<
"
\n\t
is_same_object(in_img,out_img): "
<<
is_same_object
(
in_img
,
out_img
)
<<
"
\n\t
is_same_object(in_img,out_img): "
<<
is_same_object
(
in_img
,
out_img
)
);
);
typedef
typename
pixel_traits
<
typename
image_traits
<
out_image_type
>::
pixel_type
>::
basic_pixel_type
type
;
if
(
sigma
<
18
)
typedef
typename
promote
<
type
>::
type
ptype
;
{
typedef
typename
pixel_traits
<
typename
image_traits
<
out_image_type
>::
pixel_type
>::
basic_pixel_type
type
;
const
matrix
<
ptype
,
0
,
1
>&
filt
=
create_gaussian_filter
<
ptype
>
(
sigma
,
max_size
);
typedef
typename
promote
<
type
>::
type
ptype
;
const
matrix
<
ptype
,
0
,
1
>&
filt
=
create_gaussian_filter
<
ptype
>
(
sigma
,
max_size
);
ptype
scale
=
sum
(
filt
);
ptype
scale
=
sum
(
filt
);
scale
=
scale
*
scale
;
scale
=
scale
*
scale
;
return
spatially_filter_image_separable
(
in_img
,
out_img
,
filt
,
filt
,
scale
);
return
spatially_filter_image_separable
(
in_img
,
out_img
,
filt
,
filt
,
scale
);
}
else
{
// For large sigma we need to use a type with a lot of precision to avoid
// numerical problems. So we use double here.
typedef
double
ptype
;
const
matrix
<
ptype
,
0
,
1
>&
filt
=
create_gaussian_filter
<
ptype
>
(
sigma
,
max_size
);
ptype
scale
=
sum
(
filt
);
scale
=
scale
*
scale
;
return
spatially_filter_image_separable
(
in_img
,
out_img
,
filt
,
filt
,
scale
);
}
}
}
...
...
examples/dnn_mnist_advanced_ex.cpp
View file @
aba68d6f
...
@@ -56,7 +56,9 @@ template <typename SUBNET> using ares_down = base_ares<2,SUBNET>;
...
@@ -56,7 +56,9 @@ template <typename SUBNET> using ares_down = base_ares<2,SUBNET>;
// Now that we have these convenient aliases, we can define a residual network
// Now that we have these convenient aliases, we can define a residual network
// without a lot of typing. Note the use of a repeat layer. This special layer
// without a lot of typing. Note the use of a repeat layer. This special layer
// type allows us to type repeat<9,res<SUBNET>> instead of
// type allows us to type repeat<9,res<SUBNET>> instead of
// res<res<res<res<res<res<res<res<res<SUBNET>>>>>>>>>.
// res<res<res<res<res<res<res<res<res<SUBNET>>>>>>>>>. It will also prevent
// the compiler from complaining about super deep template nesting when creating
// large networks.
const
unsigned
long
number_of_classes
=
10
;
const
unsigned
long
number_of_classes
=
10
;
using
net_type
=
loss_multiclass_log
<
fc
<
number_of_classes
,
using
net_type
=
loss_multiclass_log
<
fc
<
number_of_classes
,
avg_pool
<
11
,
11
,
11
,
11
,
avg_pool
<
11
,
11
,
11
,
11
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment