Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SeetaResearch
/
SeetaDet
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 071996af
authored
May 30, 2019
by
Ting PAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply new pixel means
1 parent
b1c4e901
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
11 deletions
lib/core/config.py
lib/modeling/base.py
lib/modeling/detector.py
lib/modeling/retinanet.py
lib/ssd/data/preprocessing/expand.py
lib/utils/blob.py
lib/core/config.py
View file @
071996a
...
@@ -513,10 +513,8 @@ __C.USE_NCCL = True
...
@@ -513,10 +513,8 @@ __C.USE_NCCL = True
# Hosts for Inter-Machine communication
# Hosts for Inter-Machine communication
__C
.
HOSTS
=
[]
__C
.
HOSTS
=
[]
# Pixel mean values (BGR order) as a (1, 1, 3) array
# Pixel mean values (BGR order)
# We use the same pixel mean for all networks even though it's not exactly what
__C
.
PIXEL_MEANS
=
[
102.
,
115.
,
122.
]
# they were trained with
__C
.
PIXEL_MEANS
=
np
.
array
([[[
102.9801
,
115.9465
,
122.7717
]]])
# Default weights on (dx, dy, dw, dh) for normalizing bbox regression targets
# Default weights on (dx, dy, dw, dh) for normalizing bbox regression targets
# These are empirically chosen to approximately lead to unit variance targets
# These are empirically chosen to approximately lead to unit variance targets
...
...
lib/modeling/base.py
View file @
071996a
...
@@ -35,7 +35,7 @@ class Bootstarp(torch.nn.Module):
...
@@ -35,7 +35,7 @@ class Bootstarp(torch.nn.Module):
'arguments'
:
{
'arguments'
:
{
'dtype'
:
self
.
dtype
,
'dtype'
:
self
.
dtype
,
'data_format'
:
'NCHW'
,
'data_format'
:
'NCHW'
,
'mean_values'
:
[
102.9801
,
115.9465
,
122.7717
]
,
'mean_values'
:
cfg
.
PIXEL_MEANS
,
}
}
}
}
...
...
lib/modeling/detector.py
View file @
071996a
...
@@ -109,8 +109,8 @@ class Detector(torch.nn.Module):
...
@@ -109,8 +109,8 @@ class Detector(torch.nn.Module):
# 1) NHWC => NCHW
# 1) NHWC => NCHW
# 2) Uint8 => Float32 or Float16
# 2) Uint8 => Float32 or Float16
# 3) Mean subtraction
# 3) Mean subtraction
processed
_data
=
self
.
bootstarp
(
inputs
[
'data'
])
image
_data
=
self
.
bootstarp
(
inputs
[
'data'
])
features
=
self
.
body
(
processed
_data
)
features
=
self
.
body
(
image
_data
)
# 2. Apply the FPN to enhance features if necessary
# 2. Apply the FPN to enhance features if necessary
if
hasattr
(
self
,
'fpn'
):
if
hasattr
(
self
,
'fpn'
):
...
...
lib/modeling/retinanet.py
View file @
071996a
...
@@ -43,7 +43,7 @@ class RetinaNet(torch.nn.Module):
...
@@ -43,7 +43,7 @@ class RetinaNet(torch.nn.Module):
self
.
cls_score
=
conv3x3
(
dim_in
,
self
.
C
*
A
,
bias
=
True
)
self
.
cls_score
=
conv3x3
(
dim_in
,
self
.
C
*
A
,
bias
=
True
)
self
.
bbox_pred
=
conv3x3
(
dim_in
,
4
*
A
,
bias
=
True
)
self
.
bbox_pred
=
conv3x3
(
dim_in
,
4
*
A
,
bias
=
True
)
self
.
cls_prob
=
torch
.
nn
.
Sigmoid
(
inplace
=
True
)
self
.
cls_prob
=
torch
.
nn
.
Sigmoid
(
inplace
=
True
)
self
.
relu
=
torch
.
nn
.
E
LU
(
inplace
=
True
)
self
.
relu
=
torch
.
nn
.
Re
LU
(
inplace
=
True
)
self
.
decoder
=
RetinaNetDecoder
()
self
.
decoder
=
RetinaNetDecoder
()
########################################
########################################
...
...
lib/ssd/data/preprocessing/expand.py
View file @
071996a
...
@@ -44,7 +44,7 @@ class Expander(object):
...
@@ -44,7 +44,7 @@ class Expander(object):
new_im
=
np
.
empty
((
expand_h
,
expand_w
,
3
),
dtype
=
np
.
uint8
)
new_im
=
np
.
empty
((
expand_h
,
expand_w
,
3
),
dtype
=
np
.
uint8
)
new_im
[:]
=
cfg
.
PIXEL_MEANS
new_im
[:]
=
cfg
.
PIXEL_MEANS
new_im
[
h_off
:
h_off
+
im_h
,
w_off
:
w_off
+
im_w
,
:]
=
im
new_im
[
h_off
:
h_off
+
im_h
,
w_off
:
w_off
+
im_w
,
:]
=
im
if
gt_boxes
is
not
None
:
if
gt_boxes
is
not
None
:
ex_gt_boxes
=
gt_boxes
.
astype
(
gt_boxes
.
dtype
,
copy
=
True
)
ex_gt_boxes
=
gt_boxes
.
astype
(
gt_boxes
.
dtype
,
copy
=
True
)
...
...
lib/utils/blob.py
View file @
071996a
...
@@ -41,8 +41,8 @@ def im_list_to_blob(ims):
...
@@ -41,8 +41,8 @@ def im_list_to_blob(ims):
blob
=
np
.
empty
(
unify_shape
,
dtype
=
np
.
uint8
)
blob
=
np
.
empty
(
unify_shape
,
dtype
=
np
.
uint8
)
blob
[:]
=
cfg
.
PIXEL_MEANS
blob
[:]
=
cfg
.
PIXEL_MEANS
for
i
dx
,
im
in
enumerate
(
ims
):
for
i
,
im
in
enumerate
(
ims
):
blob
[
i
dx
,
0
:
im
.
shape
[
0
],
0
:
im
.
shape
[
1
],
:]
=
im
blob
[
i
,
:
im
.
shape
[
0
],
:
im
.
shape
[
1
],
:]
=
im
return
blob
return
blob
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment