Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
8566797f
Commit
8566797f
authored
Jan 11, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #1043
parent
0b2ab4ae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
examples/FasterRCNN/dataset.py
examples/FasterRCNN/dataset.py
+5
-4
examples/ResNet/load-resnet.py
examples/ResNet/load-resnet.py
+4
-4
tensorpack/models/linearwrap.py
tensorpack/models/linearwrap.py
+3
-0
No files found.
examples/FasterRCNN/dataset.py
View file @
8566797f
...
...
@@ -7,7 +7,6 @@ import tqdm
import
json
from
tensorpack.utils
import
logger
from
tensorpack.utils.argtools
import
log_once
from
tensorpack.utils.timer
import
timed_operation
from
config
import
config
as
cfg
...
...
@@ -121,7 +120,7 @@ class COCODetection(object):
valid_objs
=
[]
width
=
img
[
'width'
]
height
=
img
[
'height'
]
for
obj
in
objs
:
for
obj
id
,
obj
in
objs
:
if
obj
.
get
(
'ignore'
,
0
)
==
1
:
continue
x1
,
y1
,
w
,
h
=
obj
[
'bbox'
]
...
...
@@ -145,8 +144,10 @@ class COCODetection(object):
obj
[
'segmentation'
]
=
None
else
:
valid_segs
=
[
np
.
asarray
(
p
)
.
reshape
(
-
1
,
2
)
.
astype
(
'float32'
)
for
p
in
segs
if
len
(
p
)
>=
6
]
if
len
(
valid_segs
)
<
len
(
segs
):
log_once
(
"Image {} has invalid polygons!"
.
format
(
img
[
'file_name'
]),
'warn'
)
if
len
(
valid_segs
)
==
0
:
logger
.
error
(
"Object {} in image {} has no valid polygons!"
.
format
(
objid
,
img
[
'file_name'
]))
elif
len
(
valid_segs
)
<
len
(
segs
):
logger
.
warn
(
"Object {} in image {} has invalid polygons!"
.
format
(
objid
,
img
[
'file_name'
]))
obj
[
'segmentation'
]
=
valid_segs
...
...
examples/ResNet/load-resnet.py
View file @
8566797f
...
...
@@ -47,10 +47,10 @@ class Model(ModelDesc):
logits
=
(
LinearWrap
(
image
)
.
Conv2D
(
'conv0'
,
64
,
7
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
.
MaxPooling
(
'pool0'
,
3
,
strides
=
2
,
padding
=
'SAME'
)
.
apply
(
resnet_group
,
'group0'
,
bottleneck
,
64
,
blocks
[
0
],
1
)
.
apply
(
resnet_group
,
'group1'
,
bottleneck
,
128
,
blocks
[
1
],
2
)
.
apply
(
resnet_group
,
'group2'
,
bottleneck
,
256
,
blocks
[
2
],
2
)
.
apply
(
resnet_group
,
'group3'
,
bottleneck
,
512
,
blocks
[
3
],
2
)
.
apply
2
(
resnet_group
,
'group0'
,
bottleneck
,
64
,
blocks
[
0
],
1
)
.
apply
2
(
resnet_group
,
'group1'
,
bottleneck
,
128
,
blocks
[
1
],
2
)
.
apply
2
(
resnet_group
,
'group2'
,
bottleneck
,
256
,
blocks
[
2
],
2
)
.
apply
2
(
resnet_group
,
'group3'
,
bottleneck
,
512
,
blocks
[
3
],
2
)
.
GlobalAvgPooling
(
'gap'
)
.
FullyConnected
(
'linear'
,
1000
)())
tf
.
nn
.
softmax
(
logits
,
name
=
'prob'
)
...
...
tensorpack/models/linearwrap.py
View file @
8566797f
...
...
@@ -80,6 +80,9 @@ class LinearWrap(object):
Apply a function on the wrapped tensor. The tensor
will be the second argument of func.
This is because many symbolic functions
(such as tensorpack's layers) takes 'scope' as the first argument.
Returns:
LinearWrap: ``LinearWrap(func(args[0], self.tensor(), *args[1:], **kwargs))``.
"""
...
...
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