Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
food-round2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joel Joseph
food-round2
Commits
717b2587
Commit
717b2587
authored
6 years ago
by
Kai Chen
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:open-mmlab/mmdetection
parents
ac8d34e7
777d5d4b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mmdet/core/bbox/bbox_target.py
+0
-3
0 additions, 3 deletions
mmdet/core/bbox/bbox_target.py
mmdet/models/bbox_heads/bbox_head.py
+9
-3
9 additions, 3 deletions
mmdet/models/bbox_heads/bbox_head.py
mmdet/ops/dcn/src/deform_conv_cuda.cpp
+9
-9
9 additions, 9 deletions
mmdet/ops/dcn/src/deform_conv_cuda.cpp
with
18 additions
and
15 deletions
mmdet/core/bbox/bbox_target.py
+
0
−
3
View file @
717b2587
...
@@ -57,9 +57,6 @@ def bbox_target_single(pos_bboxes,
...
@@ -57,9 +57,6 @@ def bbox_target_single(pos_bboxes,
bbox_weights
[:
num_pos
,
:]
=
1
bbox_weights
[:
num_pos
,
:]
=
1
if
num_neg
>
0
:
if
num_neg
>
0
:
label_weights
[
-
num_neg
:]
=
1.0
label_weights
[
-
num_neg
:]
=
1.0
if
reg_classes
>
1
:
bbox_targets
,
bbox_weights
=
expand_target
(
bbox_targets
,
bbox_weights
,
labels
,
reg_classes
)
return
labels
,
label_weights
,
bbox_targets
,
bbox_weights
return
labels
,
label_weights
,
bbox_targets
,
bbox_weights
...
...
This diff is collapsed.
Click to expand it.
mmdet/models/bbox_heads/bbox_head.py
+
9
−
3
View file @
717b2587
...
@@ -94,10 +94,16 @@ class BBoxHead(nn.Module):
...
@@ -94,10 +94,16 @@ class BBoxHead(nn.Module):
cls_score
,
labels
,
label_weights
,
reduce
=
reduce
)
cls_score
,
labels
,
label_weights
,
reduce
=
reduce
)
losses
[
'
acc
'
]
=
accuracy
(
cls_score
,
labels
)
losses
[
'
acc
'
]
=
accuracy
(
cls_score
,
labels
)
if
bbox_pred
is
not
None
:
if
bbox_pred
is
not
None
:
pos_inds
=
labels
>
0
if
self
.
reg_class_agnostic
:
pos_bbox_pred
=
bbox_pred
.
view
(
bbox_pred
.
size
(
0
),
4
)[
pos_inds
]
else
:
pos_bbox_pred
=
bbox_pred
.
view
(
bbox_pred
.
size
(
0
),
-
1
,
4
)[
pos_inds
,
labels
[
pos_inds
]]
losses
[
'
loss_reg
'
]
=
weighted_smoothl1
(
losses
[
'
loss_reg
'
]
=
weighted_smoothl1
(
bbox_pred
,
pos_
bbox_pred
,
bbox_targets
,
bbox_targets
[
pos_inds
]
,
bbox_weights
,
bbox_weights
[
pos_inds
]
,
avg_factor
=
bbox_targets
.
size
(
0
))
avg_factor
=
bbox_targets
.
size
(
0
))
return
losses
return
losses
...
...
This diff is collapsed.
Click to expand it.
mmdet/ops/dcn/src/deform_conv_cuda.cpp
+
9
−
9
View file @
717b2587
...
@@ -195,11 +195,11 @@ int deform_conv_forward_cuda(at::Tensor input, at::Tensor weight,
...
@@ -195,11 +195,11 @@ int deform_conv_forward_cuda(at::Tensor input, at::Tensor weight,
outputHeight
,
outputWidth
});
outputHeight
,
outputWidth
});
columns
=
at
::
zeros
(
columns
=
at
::
zeros
(
{
nInputPlane
*
kW
*
kH
,
im2col_step
*
outputHeight
*
outputWidth
},
{
nInputPlane
*
kW
*
kH
,
im2col_step
*
outputHeight
*
outputWidth
},
input
.
type
());
input
.
options
());
if
(
ones
.
ndimension
()
!=
2
||
if
(
ones
.
ndimension
()
!=
2
||
ones
.
size
(
0
)
*
ones
.
size
(
1
)
<
outputHeight
*
outputWidth
)
{
ones
.
size
(
0
)
*
ones
.
size
(
1
)
<
outputHeight
*
outputWidth
)
{
ones
=
at
::
ones
({
outputHeight
,
outputWidth
},
input
.
type
());
ones
=
at
::
ones
({
outputHeight
,
outputWidth
},
input
.
options
());
}
}
input
=
input
.
view
({
batchSize
/
im2col_step
,
im2col_step
,
nInputPlane
,
input
=
input
.
view
({
batchSize
/
im2col_step
,
im2col_step
,
nInputPlane
,
...
@@ -211,7 +211,7 @@ int deform_conv_forward_cuda(at::Tensor input, at::Tensor weight,
...
@@ -211,7 +211,7 @@ int deform_conv_forward_cuda(at::Tensor input, at::Tensor weight,
at
::
Tensor
output_buffer
=
at
::
Tensor
output_buffer
=
at
::
zeros
({
batchSize
/
im2col_step
,
nOutputPlane
,
at
::
zeros
({
batchSize
/
im2col_step
,
nOutputPlane
,
im2col_step
*
outputHeight
,
outputWidth
},
im2col_step
*
outputHeight
,
outputWidth
},
output
.
type
());
output
.
options
());
output_buffer
=
output_buffer
.
view
(
output_buffer
=
output_buffer
.
view
(
{
output_buffer
.
size
(
0
),
group
,
output_buffer
.
size
(
1
)
/
group
,
{
output_buffer
.
size
(
0
),
group
,
output_buffer
.
size
(
1
)
/
group
,
...
@@ -299,7 +299,7 @@ int deform_conv_backward_input_cuda(at::Tensor input, at::Tensor offset,
...
@@ -299,7 +299,7 @@ int deform_conv_backward_input_cuda(at::Tensor input, at::Tensor offset,
gradInput
=
gradInput
.
view
({
batchSize
,
nInputPlane
,
inputHeight
,
inputWidth
});
gradInput
=
gradInput
.
view
({
batchSize
,
nInputPlane
,
inputHeight
,
inputWidth
});
columns
=
at
::
zeros
(
columns
=
at
::
zeros
(
{
nInputPlane
*
kW
*
kH
,
im2col_step
*
outputHeight
*
outputWidth
},
{
nInputPlane
*
kW
*
kH
,
im2col_step
*
outputHeight
*
outputWidth
},
input
.
type
());
input
.
options
());
// change order of grad output
// change order of grad output
gradOutput
=
gradOutput
.
view
({
batchSize
/
im2col_step
,
im2col_step
,
gradOutput
=
gradOutput
.
view
({
batchSize
/
im2col_step
,
im2col_step
,
...
@@ -414,7 +414,7 @@ int deform_conv_backward_parameters_cuda(
...
@@ -414,7 +414,7 @@ int deform_conv_backward_parameters_cuda(
columns
=
at
::
zeros
(
columns
=
at
::
zeros
(
{
nInputPlane
*
kW
*
kH
,
im2col_step
*
outputHeight
*
outputWidth
},
{
nInputPlane
*
kW
*
kH
,
im2col_step
*
outputHeight
*
outputWidth
},
input
.
type
());
input
.
options
());
gradOutput
=
gradOutput
.
view
({
batchSize
/
im2col_step
,
im2col_step
,
gradOutput
=
gradOutput
.
view
({
batchSize
/
im2col_step
,
im2col_step
,
nOutputPlane
,
outputHeight
,
outputWidth
});
nOutputPlane
,
outputHeight
,
outputWidth
});
...
@@ -518,7 +518,7 @@ void modulated_deform_conv_cuda_forward(
...
@@ -518,7 +518,7 @@ void modulated_deform_conv_cuda_forward(
if
(
ones
.
ndimension
()
!=
2
||
if
(
ones
.
ndimension
()
!=
2
||
ones
.
size
(
0
)
*
ones
.
size
(
1
)
<
height_out
*
width_out
)
{
ones
.
size
(
0
)
*
ones
.
size
(
1
)
<
height_out
*
width_out
)
{
// Resize plane and fill with ones...
// Resize plane and fill with ones...
ones
=
at
::
ones
({
height_out
,
width_out
},
input
.
type
());
ones
=
at
::
ones
({
height_out
,
width_out
},
input
.
options
());
}
}
// resize output
// resize output
...
@@ -526,7 +526,7 @@ void modulated_deform_conv_cuda_forward(
...
@@ -526,7 +526,7 @@ void modulated_deform_conv_cuda_forward(
// resize temporary columns
// resize temporary columns
columns
=
columns
=
at
::
zeros
({
channels
*
kernel_h
*
kernel_w
,
1
*
height_out
*
width_out
},
at
::
zeros
({
channels
*
kernel_h
*
kernel_w
,
1
*
height_out
*
width_out
},
input
.
type
());
input
.
options
());
output
=
output
.
view
({
output
.
size
(
0
),
group
,
output
.
size
(
1
)
/
group
,
output
=
output
.
view
({
output
.
size
(
0
),
group
,
output
.
size
(
1
)
/
group
,
output
.
size
(
2
),
output
.
size
(
3
)});
output
.
size
(
2
),
output
.
size
(
3
)});
...
@@ -597,12 +597,12 @@ void modulated_deform_conv_cuda_backward(
...
@@ -597,12 +597,12 @@ void modulated_deform_conv_cuda_backward(
if
(
ones
.
ndimension
()
!=
2
||
if
(
ones
.
ndimension
()
!=
2
||
ones
.
size
(
0
)
*
ones
.
size
(
1
)
<
height_out
*
width_out
)
{
ones
.
size
(
0
)
*
ones
.
size
(
1
)
<
height_out
*
width_out
)
{
// Resize plane and fill with ones...
// Resize plane and fill with ones...
ones
=
at
::
ones
({
height_out
,
width_out
},
input
.
type
());
ones
=
at
::
ones
({
height_out
,
width_out
},
input
.
options
());
}
}
grad_input
=
grad_input
.
view
({
batch
,
channels
,
height
,
width
});
grad_input
=
grad_input
.
view
({
batch
,
channels
,
height
,
width
});
columns
=
at
::
zeros
({
channels
*
kernel_h
*
kernel_w
,
height_out
*
width_out
},
columns
=
at
::
zeros
({
channels
*
kernel_h
*
kernel_w
,
height_out
*
width_out
},
input
.
type
());
input
.
options
());
grad_output
=
grad_output
=
grad_output
.
view
({
grad_output
.
size
(
0
),
group
,
grad_output
.
size
(
1
)
/
group
,
grad_output
.
view
({
grad_output
.
size
(
0
),
group
,
grad_output
.
size
(
1
)
/
group
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment