Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
再见难再见
fcos
提交
ebdd88b4
F
fcos
项目概览
再见难再见
/
fcos
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fcos
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ebdd88b4
编写于
10月 08, 2019
作者:
H
Hao Chen
提交者:
GitHub
10月 08, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #164 from stanstarks/master
Make compatible with torchvision 0.4.0
上级
a62aeca5
0ea6ea06
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
11 deletion
+15
-11
fcos_core/data/datasets/coco.py
fcos_core/data/datasets/coco.py
+3
-3
fcos_core/data/datasets/evaluation/voc/voc_eval.py
fcos_core/data/datasets/evaluation/voc/voc_eval.py
+0
-2
fcos_core/data/transforms/transforms.py
fcos_core/data/transforms/transforms.py
+5
-2
fcos_core/structures/segmentation_mask.py
fcos_core/structures/segmentation_mask.py
+7
-4
未找到文件。
fcos_core/data/datasets/coco.py
浏览文件 @
ebdd88b4
...
...
@@ -61,7 +61,7 @@ class COCODataset(torchvision.datasets.coco.CocoDetection):
v
:
k
for
k
,
v
in
self
.
json_category_id_to_contiguous_id
.
items
()
}
self
.
id_to_img_map
=
{
k
:
v
for
k
,
v
in
enumerate
(
self
.
ids
)}
self
.
transforms
=
transforms
self
.
_
transforms
=
transforms
def
__getitem__
(
self
,
idx
):
img
,
anno
=
super
(
COCODataset
,
self
).
__getitem__
(
idx
)
...
...
@@ -90,8 +90,8 @@ class COCODataset(torchvision.datasets.coco.CocoDetection):
target
=
target
.
clip_to_image
(
remove_empty
=
True
)
if
self
.
transforms
is
not
None
:
img
,
target
=
self
.
transforms
(
img
,
target
)
if
self
.
_
transforms
is
not
None
:
img
,
target
=
self
.
_
transforms
(
img
,
target
)
return
img
,
target
,
idx
...
...
fcos_core/data/datasets/evaluation/voc/voc_eval.py
浏览文件 @
ebdd88b4
...
...
@@ -16,8 +16,6 @@ def do_voc_evaluation(dataset, predictions, output_folder, logger):
gt_boxlists
=
[]
for
image_id
,
prediction
in
enumerate
(
predictions
):
img_info
=
dataset
.
get_img_info
(
image_id
)
if
len
(
prediction
)
==
0
:
continue
image_width
=
img_info
[
"width"
]
image_height
=
img_info
[
"height"
]
prediction
=
prediction
.
resize
((
image_width
,
image_height
))
...
...
fcos_core/data/transforms/transforms.py
浏览文件 @
ebdd88b4
...
...
@@ -57,9 +57,12 @@ class Resize(object):
def
__call__
(
self
,
image
,
target
=
None
):
size
=
self
.
get_size
(
image
.
size
)
image
=
F
.
resize
(
image
,
size
)
if
target
is
None
:
if
isinstance
(
target
,
list
):
target
=
[
t
.
resize
(
image
.
size
)
for
t
in
target
]
elif
target
is
None
:
return
image
target
=
target
.
resize
(
image
.
size
)
else
:
target
=
target
.
resize
(
image
.
size
)
return
image
,
target
...
...
fcos_core/structures/segmentation_mask.py
浏览文件 @
ebdd88b4
import
cv2
import
copy
import
torch
import
numpy
as
np
from
fcos_core.layers.misc
import
interpolate
...
...
@@ -195,7 +195,7 @@ class PolygonInstance(object):
polygons
=
valid_polygons
elif
isinstance
(
polygons
,
PolygonInstance
):
polygons
=
[
p
.
clone
()
for
p
in
polygons
.
polygons
]
polygons
=
copy
.
copy
(
polygons
.
polygons
)
else
:
RuntimeError
(
"Type of argument `polygons` is not allowed:%s"
%
(
type
(
polygons
))
...
...
@@ -414,7 +414,8 @@ class PolygonList(object):
else
:
# advanced indexing on a single dimension
selected_polygons
=
[]
if
isinstance
(
item
,
torch
.
Tensor
)
and
item
.
dtype
==
torch
.
uint8
:
if
isinstance
(
item
,
torch
.
Tensor
)
and
\
item
.
dtype
==
torch
.
uint8
or
item
.
dtype
==
torch
.
bool
:
item
=
item
.
nonzero
()
item
=
item
.
squeeze
(
1
)
if
item
.
numel
()
>
0
else
item
item
=
item
.
tolist
()
...
...
@@ -522,7 +523,9 @@ class SegmentationMask(object):
next_segmentation
=
self
.
__getitem__
(
self
.
iter_idx
)
self
.
iter_idx
+=
1
return
next_segmentation
raise
StopIteration
raise
StopIteration
()
next
=
__next__
# Python 2 compatibility
def
__repr__
(
self
):
s
=
self
.
__class__
.
__name__
+
"("
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录