Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FL1623863129
YOLOX
提交
5b895d74
Y
YOLOX
项目概览
FL1623863129
/
YOLOX
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YOLOX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5b895d74
编写于
4月 22, 2022
作者:
F
Feng Wang
提交者:
GitHub
4月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(exp): get_trainer method, add pre-commit (#1263)
上级
68408b40
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
8 deletion
+56
-8
.pre-commit-config.yaml
.pre-commit-config.yaml
+43
-0
tools/train.py
tools/train.py
+4
-4
yolox/core/trainer.py
yolox/core/trainer.py
+2
-1
yolox/exp/yolox_base.py
yolox/exp/yolox_base.py
+7
-3
未找到文件。
.pre-commit-config.yaml
0 → 100644
浏览文件 @
5b895d74
repos
:
-
repo
:
https://github.com/pycqa/flake8
rev
:
3.8.3
hooks
:
-
id
:
flake8
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
v3.1.0
hooks
:
-
id
:
check-added-large-files
-
id
:
check-docstring-first
-
id
:
check-executables-have-shebangs
-
id
:
check-json
-
id
:
check-yaml
args
:
[
"
--unsafe"
]
-
id
:
debug-statements
-
id
:
end-of-file-fixer
-
id
:
requirements-txt-fixer
-
id
:
trailing-whitespace
-
repo
:
https://github.com/jorisroovers/gitlint
rev
:
v0.15.1
hooks
:
-
id
:
gitlint
-
repo
:
https://github.com/pycqa/isort
rev
:
4.3.21
hooks
:
-
id
:
isort
-
repo
:
https://github.com/PyCQA/autoflake
rev
:
v1.4
hooks
:
-
id
:
autoflake
name
:
Remove unused variables and imports
entry
:
autoflake
language
:
python
args
:
[
"
--in-place"
,
"
--remove-all-unused-imports"
,
"
--remove-unused-variables"
,
"
--expand-star-imports"
,
"
--ignore-init-module-imports"
,
]
files
:
\.py$
tools/train.py
浏览文件 @
5b895d74
...
...
@@ -10,8 +10,8 @@ from loguru import logger
import
torch
import
torch.backends.cudnn
as
cudnn
from
yolox.core
import
Trainer
,
launch
from
yolox.exp
import
get_exp
from
yolox.core
import
launch
from
yolox.exp
import
Exp
,
get_exp
from
yolox.utils
import
configure_module
,
configure_nccl
,
configure_omp
,
get_num_devices
...
...
@@ -97,7 +97,7 @@ def make_parser():
@
logger
.
catch
def
main
(
exp
,
args
):
def
main
(
exp
:
Exp
,
args
):
if
exp
.
seed
is
not
None
:
random
.
seed
(
exp
.
seed
)
torch
.
manual_seed
(
exp
.
seed
)
...
...
@@ -113,7 +113,7 @@ def main(exp, args):
configure_omp
()
cudnn
.
benchmark
=
True
trainer
=
Trainer
(
exp
,
args
)
trainer
=
exp
.
get_trainer
(
args
)
trainer
.
train
()
...
...
yolox/core/trainer.py
浏览文件 @
5b895d74
...
...
@@ -12,6 +12,7 @@ from torch.nn.parallel import DistributedDataParallel as DDP
from
torch.utils.tensorboard
import
SummaryWriter
from
yolox.data
import
DataPrefetcher
from
yolox.exp
import
Exp
from
yolox.utils
import
(
MeterBuffer
,
ModelEMA
,
...
...
@@ -33,7 +34,7 @@ from yolox.utils import (
class
Trainer
:
def
__init__
(
self
,
exp
,
args
):
def
__init__
(
self
,
exp
:
Exp
,
args
):
# init function only defines some basic attr, other attrs like model, optimizer are built in
# before_train methods.
self
.
exp
=
exp
...
...
yolox/exp/yolox_base.py
浏览文件 @
5b895d74
...
...
@@ -127,9 +127,7 @@ class Exp(BaseExp):
self
.
model
.
train
()
return
self
.
model
def
get_data_loader
(
self
,
batch_size
,
is_distributed
,
no_aug
=
False
,
cache_img
=
False
):
def
get_data_loader
(
self
,
batch_size
,
is_distributed
,
no_aug
=
False
,
cache_img
=
False
):
from
yolox.data
import
(
COCODataset
,
TrainTransform
,
...
...
@@ -314,5 +312,11 @@ class Exp(BaseExp):
)
return
evaluator
def
get_trainer
(
self
,
args
):
from
yolox.core
import
Trainer
trainer
=
Trainer
(
self
,
args
)
# NOTE: trainer shouldn't be an attribute of exp object
return
trainer
def
eval
(
self
,
model
,
evaluator
,
is_distributed
,
half
=
False
):
return
evaluator
.
evaluate
(
model
,
is_distributed
,
half
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录