Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
835c2c35
Unverified
Commit
835c2c35
authored
Jul 16, 2021
by
F-G Fernandez
Committed by
GitHub
Jul 16, 2021
Browse files
Added missing typing annotations in datasets/coco (#4168)
parent
d993ce56
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
torchvision/datasets/coco.py
torchvision/datasets/coco.py
+3
-3
No files found.
torchvision/datasets/coco.py
View file @
835c2c35
...
@@ -26,7 +26,7 @@ class CocoDetection(VisionDataset):
...
@@ -26,7 +26,7 @@ class CocoDetection(VisionDataset):
transform
:
Optional
[
Callable
]
=
None
,
transform
:
Optional
[
Callable
]
=
None
,
target_transform
:
Optional
[
Callable
]
=
None
,
target_transform
:
Optional
[
Callable
]
=
None
,
transforms
:
Optional
[
Callable
]
=
None
,
transforms
:
Optional
[
Callable
]
=
None
,
):
)
->
None
:
super
().
__init__
(
root
,
transforms
,
transform
,
target_transform
)
super
().
__init__
(
root
,
transforms
,
transform
,
target_transform
)
from
pycocotools.coco
import
COCO
from
pycocotools.coco
import
COCO
...
@@ -37,7 +37,7 @@ class CocoDetection(VisionDataset):
...
@@ -37,7 +37,7 @@ class CocoDetection(VisionDataset):
path
=
self
.
coco
.
loadImgs
(
id
)[
0
][
"file_name"
]
path
=
self
.
coco
.
loadImgs
(
id
)[
0
][
"file_name"
]
return
Image
.
open
(
os
.
path
.
join
(
self
.
root
,
path
)).
convert
(
"RGB"
)
return
Image
.
open
(
os
.
path
.
join
(
self
.
root
,
path
)).
convert
(
"RGB"
)
def
_load_target
(
self
,
id
)
->
List
[
Any
]:
def
_load_target
(
self
,
id
:
int
)
->
List
[
Any
]:
return
self
.
coco
.
loadAnns
(
self
.
coco
.
getAnnIds
(
id
))
return
self
.
coco
.
loadAnns
(
self
.
coco
.
getAnnIds
(
id
))
def
__getitem__
(
self
,
index
:
int
)
->
Tuple
[
Any
,
Any
]:
def
__getitem__
(
self
,
index
:
int
)
->
Tuple
[
Any
,
Any
]:
...
@@ -95,5 +95,5 @@ class CocoCaptions(CocoDetection):
...
@@ -95,5 +95,5 @@ class CocoCaptions(CocoDetection):
"""
"""
def
_load_target
(
self
,
id
)
->
List
[
str
]:
def
_load_target
(
self
,
id
:
int
)
->
List
[
str
]:
return
[
ann
[
"caption"
]
for
ann
in
super
().
_load_target
(
id
)]
return
[
ann
[
"caption"
]
for
ann
in
super
().
_load_target
(
id
)]
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