Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
08d3119e
Unverified
提交
08d3119e
authored
1月 27, 2021
作者:
Glenn Jocher
提交者:
GitHub
1月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add histogram equalization fcn (#2049)
上级
d68afedb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
13 行增加
和
7 行删除
+13
-7
Dockerfile
Dockerfile
+2
-2
yolo.py
models/yolo.py
+1
-1
datasets.py
utils/datasets.py
+10
-4
没有找到文件。
Dockerfile
浏览文件 @
08d3119e
...
...
@@ -39,13 +39,13 @@ COPY . /usr/src/app
# sudo docker kill $(sudo docker ps -q)
# Kill all image-based
# sudo docker kill $(sudo docker ps -
a -q
--filter ancestor=ultralytics/yolov5:latest)
# sudo docker kill $(sudo docker ps -
qa
--filter ancestor=ultralytics/yolov5:latest)
# Bash into running container
# sudo docker exec -it 5a9b5863d93d bash
# Bash into stopped container
# id=
5a9b5863d93d
&& sudo docker start $id && sudo docker exec -it $id bash
# id=
$(sudo docker ps -qa)
&& sudo docker start $id && sudo docker exec -it $id bash
# Send weights to GCP
# python -c "from utils.general import *; strip_optimizer('runs/train/exp0_*/weights/best.pt', 'tmp.pt')" && gsutil cp tmp.pt gs://*.pt
...
...
models/yolo.py
浏览文件 @
08d3119e
...
...
@@ -107,7 +107,7 @@ class Model(nn.Module):
for
si
,
fi
in
zip
(
s
,
f
):
xi
=
scale_img
(
x
.
flip
(
fi
)
if
fi
else
x
,
si
,
gs
=
int
(
self
.
stride
.
max
()))
yi
=
self
.
forward_once
(
xi
)[
0
]
# forward
# cv2.imwrite(
'img%g.jpg' % s, 255 * xi[0]
.numpy().transpose((1, 2, 0))[:, :, ::-1]) # save
# cv2.imwrite(
f'img_{si}.jpg', 255 * xi[0].cpu()
.numpy().transpose((1, 2, 0))[:, :, ::-1]) # save
yi
[
...
,
:
4
]
/=
si
# de-scale
if
fi
==
2
:
yi
[
...
,
1
]
=
img_size
[
0
]
-
yi
[
...
,
1
]
# de-flip ud
...
...
utils/datasets.py
浏览文件 @
08d3119e
...
...
@@ -631,10 +631,16 @@ def augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5):
img_hsv
=
cv2
.
merge
((
cv2
.
LUT
(
hue
,
lut_hue
),
cv2
.
LUT
(
sat
,
lut_sat
),
cv2
.
LUT
(
val
,
lut_val
)))
.
astype
(
dtype
)
cv2
.
cvtColor
(
img_hsv
,
cv2
.
COLOR_HSV2BGR
,
dst
=
img
)
# no return needed
# Histogram equalization
# if random.random() < 0.2:
# for i in range(3):
# img[:, :, i] = cv2.equalizeHist(img[:, :, i])
def
hist_equalize
(
img
,
clahe
=
True
,
bgr
=
False
):
# Equalize histogram on BGR image 'img' with img.shape(n,m,3) and range 0-255
yuv
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2YUV
if
bgr
else
cv2
.
COLOR_RGB2YUV
)
if
clahe
:
c
=
cv2
.
createCLAHE
(
clipLimit
=
2.0
,
tileGridSize
=
(
8
,
8
))
yuv
[:,
:,
0
]
=
c
.
apply
(
yuv
[:,
:,
0
])
else
:
yuv
[:,
:,
0
]
=
cv2
.
equalizeHist
(
yuv
[:,
:,
0
])
# equalize Y channel histogram
return
cv2
.
cvtColor
(
yuv
,
cv2
.
COLOR_YUV2BGR
if
bgr
else
cv2
.
COLOR_YUV2RGB
)
# convert YUV image to RGB
def
load_mosaic
(
self
,
index
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论