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
mmdetection3d
Commits
5b9eacdf
"...text-generation-inference.git" did not exist on "5e5e9d4bbd51fafcca3cf4da39170e40951ca638"
Unverified
Commit
5b9eacdf
authored
Aug 09, 2022
by
VVsssssk
Committed by
GitHub
Aug 09, 2022
Browse files
rm find_latest_checkpoint and get_root_logger (#1707)
parent
583c4acc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
79 deletions
+8
-79
docs/en/tutorials/customize_runtime.md
docs/en/tutorials/customize_runtime.md
+1
-1
docs/zh_cn/tutorials/customize_runtime.md
docs/zh_cn/tutorials/customize_runtime.md
+1
-1
mmdet3d/datasets/transforms/dbsampler.py
mmdet3d/datasets/transforms/dbsampler.py
+2
-2
mmdet3d/utils/__init__.py
mmdet3d/utils/__init__.py
+4
-6
mmdet3d/utils/logger.py
mmdet3d/utils/logger.py
+0
-31
mmdet3d/utils/misc.py
mmdet3d/utils/misc.py
+0
-38
No files found.
docs/en/tutorials/customize_runtime.md
View file @
5b9eacdf
...
@@ -93,7 +93,7 @@ The users can tune those fine-grained parameters through customizing optimizer c
...
@@ -93,7 +93,7 @@ The users can tune those fine-grained parameters through customizing optimizer c
from
mmcv.utils
import
build_from_cfg
from
mmcv.utils
import
build_from_cfg
from
mmcv.runner.optimizer
import
OPTIMIZER_BUILDERS
,
OPTIMIZERS
from
mmcv.runner.optimizer
import
OPTIMIZER_BUILDERS
,
OPTIMIZERS
from
mm
det.utils
import
get_root_l
ogger
from
mm
engine.logging
import
MML
ogger
from
.my_optimizer
import
MyOptimizer
from
.my_optimizer
import
MyOptimizer
...
...
docs/zh_cn/tutorials/customize_runtime.md
View file @
5b9eacdf
...
@@ -91,7 +91,7 @@ optimizer = dict(type='MyOptimizer', a=a_value, b=b_value, c=c_value)
...
@@ -91,7 +91,7 @@ optimizer = dict(type='MyOptimizer', a=a_value, b=b_value, c=c_value)
from
mmcv.utils
import
build_from_cfg
from
mmcv.utils
import
build_from_cfg
from
mmcv.runner.optimizer
import
OPTIMIZER_BUILDERS
,
OPTIMIZERS
from
mmcv.runner.optimizer
import
OPTIMIZER_BUILDERS
,
OPTIMIZERS
from
mm
det.utils
import
get_root_l
ogger
from
mm
engine.logging
import
MML
ogger
from
.my_optimizer
import
MyOptimizer
from
.my_optimizer
import
MyOptimizer
...
...
mmdet3d/datasets/transforms/dbsampler.py
View file @
5b9eacdf
...
@@ -131,8 +131,8 @@ class DataBaseSampler(object):
...
@@ -131,8 +131,8 @@ class DataBaseSampler(object):
db_infos
=
mmcv
.
load
(
info_path
)
db_infos
=
mmcv
.
load
(
info_path
)
# filter database infos
# filter database infos
from
mm
det3d.utils
import
get_root_l
ogger
from
mm
engine.logging
import
MML
ogger
logger
=
get_root_logger
()
logger
:
MMLogger
=
MMLogger
.
get_current_instance
()
for
k
,
v
in
db_infos
.
items
():
for
k
,
v
in
db_infos
.
items
():
logger
.
info
(
f
'load
{
len
(
v
)
}
{
k
}
database infos'
)
logger
.
info
(
f
'load
{
len
(
v
)
}
{
k
}
database infos'
)
for
prep_func
,
val
in
prepare
.
items
():
for
prep_func
,
val
in
prepare
.
items
():
...
...
mmdet3d/utils/__init__.py
View file @
5b9eacdf
...
@@ -2,16 +2,14 @@
...
@@ -2,16 +2,14 @@
from
.array_converter
import
ArrayConverter
,
array_converter
from
.array_converter
import
ArrayConverter
,
array_converter
from
.collect_env
import
collect_env
from
.collect_env
import
collect_env
from
.compat_cfg
import
compat_cfg
from
.compat_cfg
import
compat_cfg
from
.logger
import
get_root_logger
from
.misc
import
replace_ceph_backend
from
.misc
import
replace_ceph_backend
from
.setup_env
import
register_all_modules
,
setup_multi_processes
from
.setup_env
import
register_all_modules
,
setup_multi_processes
from
.typing
import
(
ConfigType
,
InstanceList
,
MultiConfig
,
OptConfigType
,
from
.typing
import
(
ConfigType
,
InstanceList
,
MultiConfig
,
OptConfigType
,
OptInstanceList
,
OptMultiConfig
,
OptSamplingResultList
)
OptInstanceList
,
OptMultiConfig
,
OptSamplingResultList
)
__all__
=
[
__all__
=
[
'get_root_logger'
,
'collect_env'
,
'setup_multi_processes'
,
'compat_cfg'
,
'collect_env'
,
'setup_multi_processes'
,
'compat_cfg'
,
'register_all_modules'
,
'find_latest_checkpoint'
,
'array_converter'
,
'register_all_modules'
,
'array_converter'
,
'ArrayConverter'
,
'ConfigType'
,
'ArrayConverter'
,
'ConfigType'
,
'OptConfigType'
,
'MultiConfig'
,
'OptConfigType'
,
'MultiConfig'
,
'OptMultiConfig'
,
'InstanceList'
,
'OptMultiConfig'
,
'InstanceList'
,
'OptInstanceList'
,
'OptInstanceList'
,
'OptSamplingResultList'
,
'replace_ceph_backend'
'OptSamplingResultList'
,
'replace_ceph_backend'
]
]
mmdet3d/utils/logger.py
deleted
100644 → 0
View file @
583c4acc
# Copyright (c) OpenMMLab. All rights reserved.
import
logging
from
mmcv.utils
import
get_logger
def
get_root_logger
(
log_file
=
None
,
log_level
=
logging
.
INFO
,
name
=
'mmdet3d'
):
"""Get root logger and add a keyword filter to it.
The logger will be initialized if it has not been initialized. By default a
StreamHandler will be added. If `log_file` is specified, a FileHandler will
also be added. The name of the root logger is the top-level package name,
e.g., "mmdet3d".
Args:
log_file (str, optional): File path of log. Defaults to None.
log_level (int, optional): The level of logger.
Defaults to logging.INFO.
name (str, optional): The name of the root logger, also used as a
filter keyword. Defaults to 'mmdet3d'.
Returns:
:obj:`logging.Logger`: The obtained logger
"""
logger
=
get_logger
(
name
=
name
,
log_file
=
log_file
,
log_level
=
log_level
)
# add a logging filter
logging_filter
=
logging
.
Filter
(
name
)
logging_filter
.
filter
=
lambda
record
:
record
.
find
(
name
)
!=
-
1
return
logger
mmdet3d/utils/misc.py
View file @
5b9eacdf
# Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import
glob
import
os.path
as
osp
import
warnings
def
find_latest_checkpoint
(
path
,
suffix
=
'pth'
):
"""Find the latest checkpoint from the working directory. This function is
copied from mmdetection.
Args:
path(str): The path to find checkpoints.
suffix(str): File extension.
Defaults to pth.
Returns:
latest_path(str | None): File path of the latest checkpoint.
References:
.. [1] https://github.com/microsoft/SoftTeacher
/blob/main/ssod/utils/patch.py
"""
if
not
osp
.
exists
(
path
):
warnings
.
warn
(
'The path of checkpoints does not exist.'
)
return
None
if
osp
.
exists
(
osp
.
join
(
path
,
f
'latest.
{
suffix
}
'
)):
return
osp
.
join
(
path
,
f
'latest.
{
suffix
}
'
)
checkpoints
=
glob
.
glob
(
osp
.
join
(
path
,
f
'*.
{
suffix
}
'
))
if
len
(
checkpoints
)
==
0
:
warnings
.
warn
(
'There are no checkpoints in the path.'
)
return
None
latest
=
-
1
latest_path
=
None
for
checkpoint
in
checkpoints
:
count
=
int
(
osp
.
basename
(
checkpoint
).
split
(
'_'
)[
-
1
].
split
(
'.'
)[
0
])
if
count
>
latest
:
latest
=
count
latest_path
=
checkpoint
return
latest_path
def
replace_ceph_backend
(
cfg
):
def
replace_ceph_backend
(
cfg
):
...
...
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