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
c7e29470
"tools/git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "d7b8dfbc0c0872d525568ccd2cdcc5398209fe5a"
Unverified
Commit
c7e29470
authored
Nov 20, 2023
by
Nicolas Hug
Committed by
GitHub
Nov 20, 2023
Browse files
Fix Kinetics dataset docstring (#8121)
parent
4433680a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
torchvision/datasets/kinetics.py
torchvision/datasets/kinetics.py
+4
-4
torchvision/datasets/video_utils.py
torchvision/datasets/video_utils.py
+6
-6
No files found.
torchvision/datasets/kinetics.py
View file @
c7e29470
...
@@ -42,12 +42,12 @@ class Kinetics(VisionDataset):
...
@@ -42,12 +42,12 @@ class Kinetics(VisionDataset):
root/
root/
├── split
├── split
│ ├── class1
│ ├── class1
│ │ ├──
clip
1.mp4
│ │ ├──
vid
1.mp4
│ │ ├──
clip
2.mp4
│ │ ├──
vid
2.mp4
│ │ ├──
clip
3.mp4
│ │ ├──
vid
3.mp4
│ │ ├── ...
│ │ ├── ...
│ ├── class2
│ ├── class2
│ │ ├──
clip
x.mp4
│ │ ├──
vid
x.mp4
│ │ └── ...
│ │ └── ...
Note: split is appended automatically using the split argument.
Note: split is appended automatically using the split argument.
...
...
torchvision/datasets/video_utils.py
View file @
c7e29470
...
@@ -135,8 +135,8 @@ class VideoClips:
...
@@ -135,8 +135,8 @@ class VideoClips:
self
.
compute_clips
(
clip_length_in_frames
,
frames_between_clips
,
frame_rate
)
self
.
compute_clips
(
clip_length_in_frames
,
frames_between_clips
,
frame_rate
)
def
_compute_frame_pts
(
self
)
->
None
:
def
_compute_frame_pts
(
self
)
->
None
:
self
.
video_pts
=
[]
self
.
video_pts
=
[]
# len = num_videos. Each entry is a tensor of shape (num_frames_in_video,)
self
.
video_fps
:
List
[
int
]
=
[]
self
.
video_fps
:
List
[
int
]
=
[]
# len = num_videos
# strategy: use a DataLoader to parallelize read_video_timestamps
# strategy: use a DataLoader to parallelize read_video_timestamps
# so need to create a dummy dataset first
# so need to create a dummy dataset first
...
@@ -152,13 +152,13 @@ class VideoClips:
...
@@ -152,13 +152,13 @@ class VideoClips:
with
tqdm
(
total
=
len
(
dl
))
as
pbar
:
with
tqdm
(
total
=
len
(
dl
))
as
pbar
:
for
batch
in
dl
:
for
batch
in
dl
:
pbar
.
update
(
1
)
pbar
.
update
(
1
)
clips
,
fps
=
list
(
zip
(
*
batch
))
batch_pts
,
batch_
fps
=
list
(
zip
(
*
batch
))
# we need to specify dtype=torch.long because for empty list,
# we need to specify dtype=torch.long because for empty list,
# torch.as_tensor will use torch.float as default dtype. This
# torch.as_tensor will use torch.float as default dtype. This
# happens when decoding fails and no pts is returned in the list.
# happens when decoding fails and no pts is returned in the list.
clip
s
=
[
torch
.
as_tensor
(
c
,
dtype
=
torch
.
long
)
for
c
in
clip
s
]
batch_pt
s
=
[
torch
.
as_tensor
(
pts
,
dtype
=
torch
.
long
)
for
pts
in
batch_pt
s
]
self
.
video_pts
.
extend
(
clip
s
)
self
.
video_pts
.
extend
(
batch_pt
s
)
self
.
video_fps
.
extend
(
fps
)
self
.
video_fps
.
extend
(
batch_
fps
)
def
_init_from_metadata
(
self
,
metadata
:
Dict
[
str
,
Any
])
->
None
:
def
_init_from_metadata
(
self
,
metadata
:
Dict
[
str
,
Any
])
->
None
:
self
.
video_paths
=
metadata
[
"video_paths"
]
self
.
video_paths
=
metadata
[
"video_paths"
]
...
...
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