Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
57ce73cd
Unverified
提交
57ce73cd
authored
10月 07, 2021
作者:
Glenn Jocher
提交者:
GitHub
10月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update datasets.py comments (#5088)
上级
ce8e5dc8
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
7 行删除
+9
-7
datasets.py
utils/datasets.py
+9
-7
没有找到文件。
utils/datasets.py
浏览文件 @
57ce73cd
...
...
@@ -155,7 +155,8 @@ class _RepeatSampler(object):
yield
from
iter
(
self
.
sampler
)
class
LoadImages
:
# for inference
class
LoadImages
:
# YOLOv5 image/video dataloader, i.e. `python detect.py --source image.jpg/vid.mp4`
def
__init__
(
self
,
path
,
img_size
=
640
,
stride
=
32
,
auto
=
True
):
p
=
str
(
Path
(
path
)
.
resolve
())
# os-agnostic absolute path
if
'*'
in
p
:
...
...
@@ -237,6 +238,7 @@ class LoadImages: # for inference
class
LoadWebcam
:
# for inference
# YOLOv5 local webcam dataloader, i.e. `python detect.py --source 0`
def
__init__
(
self
,
pipe
=
'0'
,
img_size
=
640
,
stride
=
32
):
self
.
img_size
=
img_size
self
.
stride
=
stride
...
...
@@ -277,7 +279,8 @@ class LoadWebcam: # for inference
return
0
class
LoadStreams
:
# multiple IP or RTSP cameras
class
LoadStreams
:
# YOLOv5 streamloader, i.e. `python detect.py --source 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP streams`
def
__init__
(
self
,
sources
=
'streams.txt'
,
img_size
=
640
,
stride
=
32
,
auto
=
True
):
self
.
mode
=
'stream'
self
.
img_size
=
img_size
...
...
@@ -365,7 +368,8 @@ def img2label_paths(img_paths):
return
[
sb
.
join
(
x
.
rsplit
(
sa
,
1
))
.
rsplit
(
'.'
,
1
)[
0
]
+
'.txt'
for
x
in
img_paths
]
class
LoadImagesAndLabels
(
Dataset
):
# for training/testing
class
LoadImagesAndLabels
(
Dataset
):
# YOLOv5 train_loader/val_loader, loads images and labels for training and validation
cache_version
=
0.5
# dataset labels *.cache version
def
__init__
(
self
,
path
,
img_size
=
640
,
batch_size
=
16
,
augment
=
False
,
hyp
=
None
,
rect
=
False
,
image_weights
=
False
,
...
...
@@ -659,8 +663,7 @@ def load_image(self, i):
def
load_mosaic
(
self
,
index
):
# loads images in a 4-mosaic
# YOLOv5 4-mosaic loader. Loads 1 image + 3 random images into a 4-image mosaic
labels4
,
segments4
=
[],
[]
s
=
self
.
img_size
yc
,
xc
=
[
int
(
random
.
uniform
(
-
x
,
2
*
s
+
x
))
for
x
in
self
.
mosaic_border
]
# mosaic center x, y
...
...
@@ -717,8 +720,7 @@ def load_mosaic(self, index):
def
load_mosaic9
(
self
,
index
):
# loads images in a 9-mosaic
# YOLOv5 9-mosaic loader. Loads 1 image + 8 random images into a 9-image mosaic
labels9
,
segments9
=
[],
[]
s
=
self
.
img_size
indices
=
[
index
]
+
random
.
choices
(
self
.
indices
,
k
=
8
)
# 8 additional image indices
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论