mirror of
https://github.com/open-mmlab/mmocr.git
synced 2025-06-03 21:54:47 +08:00
[Fix] fix base name and dist_xx (#1253)
* fix base name and dist_xx * update registry
This commit is contained in:
parent
85d3344cf8
commit
37ff38e7aa
@ -1,6 +1,6 @@
|
|||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
from .abinet import ABINet
|
from .abinet import ABINet
|
||||||
from .base import BaseRecognizer
|
from .base_recognizer import BaseRecognizer
|
||||||
from .crnn import CRNN
|
from .crnn import CRNN
|
||||||
from .encoder_decoder_recognizer import EncoderDecoderRecognizer
|
from .encoder_decoder_recognizer import EncoderDecoderRecognizer
|
||||||
from .master import MASTER
|
from .master import MASTER
|
||||||
|
@ -8,7 +8,7 @@ from mmocr.registry import MODELS
|
|||||||
from mmocr.utils.typing import (ConfigType, InitConfigType, OptConfigType,
|
from mmocr.utils.typing import (ConfigType, InitConfigType, OptConfigType,
|
||||||
OptRecSampleList, RecForwardResults,
|
OptRecSampleList, RecForwardResults,
|
||||||
RecSampleList)
|
RecSampleList)
|
||||||
from .base import BaseRecognizer
|
from .base_recognizer import BaseRecognizer
|
||||||
|
|
||||||
|
|
||||||
@MODELS.register_module()
|
@MODELS.register_module()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
"""MMOCR provides 17 registry nodes to support using modules across projects.
|
"""MMDetection provides 17 registry nodes to support using modules across
|
||||||
Each node is a child of the root registry in MMEngine.
|
projects. Each node is a child of the root registry in MMEngine.
|
||||||
|
|
||||||
More details can be found at
|
More details can be found at
|
||||||
https://mmengine.readthedocs.io/en/latest/tutorials/registry.html.
|
https://mmengine.readthedocs.io/en/latest/tutorials/registry.html.
|
||||||
@ -8,13 +8,16 @@ https://mmengine.readthedocs.io/en/latest/tutorials/registry.html.
|
|||||||
|
|
||||||
from mmengine.registry import DATA_SAMPLERS as MMENGINE_DATA_SAMPLERS
|
from mmengine.registry import DATA_SAMPLERS as MMENGINE_DATA_SAMPLERS
|
||||||
from mmengine.registry import DATASETS as MMENGINE_DATASETS
|
from mmengine.registry import DATASETS as MMENGINE_DATASETS
|
||||||
|
from mmengine.registry import EVALUATOR as MMENGINE_EVALUATOR
|
||||||
from mmengine.registry import HOOKS as MMENGINE_HOOKS
|
from mmengine.registry import HOOKS as MMENGINE_HOOKS
|
||||||
|
from mmengine.registry import LOG_PROCESSORS as MMENGINE_LOG_PROCESSORS
|
||||||
from mmengine.registry import LOOPS as MMENGINE_LOOPS
|
from mmengine.registry import LOOPS as MMENGINE_LOOPS
|
||||||
from mmengine.registry import METRICS as MMENGINE_METRICS
|
from mmengine.registry import METRICS as MMENGINE_METRICS
|
||||||
from mmengine.registry import MODEL_WRAPPERS as MMENGINE_MODEL_WRAPPERS
|
from mmengine.registry import MODEL_WRAPPERS as MMENGINE_MODEL_WRAPPERS
|
||||||
from mmengine.registry import MODELS as MMENGINE_MODELS
|
from mmengine.registry import MODELS as MMENGINE_MODELS
|
||||||
from mmengine.registry import \
|
from mmengine.registry import \
|
||||||
OPTIM_WRAPPER_CONSTRUCTORS as MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS
|
OPTIM_WRAPPER_CONSTRUCTORS as MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS
|
||||||
|
from mmengine.registry import OPTIM_WRAPPERS as MMENGINE_OPTIM_WRAPPERS
|
||||||
from mmengine.registry import OPTIMIZERS as MMENGINE_OPTIMIZERS
|
from mmengine.registry import OPTIMIZERS as MMENGINE_OPTIMIZERS
|
||||||
from mmengine.registry import PARAM_SCHEDULERS as MMENGINE_PARAM_SCHEDULERS
|
from mmengine.registry import PARAM_SCHEDULERS as MMENGINE_PARAM_SCHEDULERS
|
||||||
from mmengine.registry import \
|
from mmengine.registry import \
|
||||||
@ -43,24 +46,29 @@ DATASETS = Registry('dataset', parent=MMENGINE_DATASETS)
|
|||||||
DATA_SAMPLERS = Registry('data sampler', parent=MMENGINE_DATA_SAMPLERS)
|
DATA_SAMPLERS = Registry('data sampler', parent=MMENGINE_DATA_SAMPLERS)
|
||||||
TRANSFORMS = Registry('transform', parent=MMENGINE_TRANSFORMS)
|
TRANSFORMS = Registry('transform', parent=MMENGINE_TRANSFORMS)
|
||||||
|
|
||||||
# mangage all kinds of modules inheriting `nn.Module`
|
# manage all kinds of modules inheriting `nn.Module`
|
||||||
MODELS = Registry('model', parent=MMENGINE_MODELS)
|
MODELS = Registry('model', parent=MMENGINE_MODELS)
|
||||||
# mangage all kinds of model wrappers like 'MMDistributedDataParallel'
|
# manage all kinds of model wrappers like 'MMDistributedDataParallel'
|
||||||
MODEL_WRAPPERS = Registry('model_wrapper', parent=MMENGINE_MODEL_WRAPPERS)
|
MODEL_WRAPPERS = Registry('model_wrapper', parent=MMENGINE_MODEL_WRAPPERS)
|
||||||
# mangage all kinds of weight initialization modules like `Uniform`
|
# manage all kinds of weight initialization modules like `Uniform`
|
||||||
WEIGHT_INITIALIZERS = Registry(
|
WEIGHT_INITIALIZERS = Registry(
|
||||||
'weight initializer', parent=MMENGINE_WEIGHT_INITIALIZERS)
|
'weight initializer', parent=MMENGINE_WEIGHT_INITIALIZERS)
|
||||||
|
|
||||||
# mangage all kinds of optimizers like `SGD` and `Adam`
|
# manage all kinds of optimizers like `SGD` and `Adam`
|
||||||
OPTIMIZERS = Registry('optimizer', parent=MMENGINE_OPTIMIZERS)
|
OPTIMIZERS = Registry('optimizer', parent=MMENGINE_OPTIMIZERS)
|
||||||
|
# manage optimizer wrapper
|
||||||
|
OPTIM_WRAPPERS = Registry('optim wrapper', parent=MMENGINE_OPTIM_WRAPPERS)
|
||||||
# manage constructors that customize the optimization hyperparameters.
|
# manage constructors that customize the optimization hyperparameters.
|
||||||
OPTIM_WRAPPER_CONSTRUCTORS = Registry(
|
OPTIM_WRAPPER_CONSTRUCTORS = Registry(
|
||||||
'optimizer constructor', parent=MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS)
|
'optimizer constructor', parent=MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS)
|
||||||
# mangage all kinds of parameter schedulers like `MultiStepLR`
|
# manage all kinds of parameter schedulers like `MultiStepLR`
|
||||||
PARAM_SCHEDULERS = Registry(
|
PARAM_SCHEDULERS = Registry(
|
||||||
'parameter scheduler', parent=MMENGINE_PARAM_SCHEDULERS)
|
'parameter scheduler', parent=MMENGINE_PARAM_SCHEDULERS)
|
||||||
|
|
||||||
# manage all kinds of metrics
|
# manage all kinds of metrics
|
||||||
METRICS = Registry('metric', parent=MMENGINE_METRICS)
|
METRICS = Registry('metric', parent=MMENGINE_METRICS)
|
||||||
|
# manage evaluator
|
||||||
|
EVALUATOR = Registry('evaluator', parent=MMENGINE_EVALUATOR)
|
||||||
|
|
||||||
# manage task-specific modules like anchor generators and box coders
|
# manage task-specific modules like anchor generators and box coders
|
||||||
TASK_UTILS = Registry('task util', parent=MMENGINE_TASK_UTILS)
|
TASK_UTILS = Registry('task util', parent=MMENGINE_TASK_UTILS)
|
||||||
@ -69,3 +77,6 @@ TASK_UTILS = Registry('task util', parent=MMENGINE_TASK_UTILS)
|
|||||||
VISUALIZERS = Registry('visualizer', parent=MMENGINE_VISUALIZERS)
|
VISUALIZERS = Registry('visualizer', parent=MMENGINE_VISUALIZERS)
|
||||||
# manage visualizer backend
|
# manage visualizer backend
|
||||||
VISBACKENDS = Registry('vis_backend', parent=MMENGINE_VISBACKENDS)
|
VISBACKENDS = Registry('vis_backend', parent=MMENGINE_VISBACKENDS)
|
||||||
|
|
||||||
|
# manage logprocessor
|
||||||
|
LOG_PROCESSORS = Registry('log_processor', parent=MMENGINE_LOG_PROCESSORS)
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ $# -lt 3 ]
|
|
||||||
then
|
|
||||||
echo "Usage: bash $0 CONFIG CHECKPOINT GPUS"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
CONFIG=$1
|
CONFIG=$1
|
||||||
CHECKPOINT=$2
|
CHECKPOINT=$2
|
||||||
GPUS=$3
|
GPUS=$3
|
||||||
|
@ -1,24 +1,14 @@
|
|||||||
|
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ $# -lt 3 ]
|
|
||||||
then
|
|
||||||
echo "Usage: bash $0 CONFIG WORK_DIR GPUS"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
CONFIG=$1
|
CONFIG=$1
|
||||||
WORK_DIR=$2
|
GPUS=$2
|
||||||
GPUS=$3
|
|
||||||
NNODES=${NNODES:-1}
|
NNODES=${NNODES:-1}
|
||||||
NODE_RANK=${NODE_RANK:-0}
|
NODE_RANK=${NODE_RANK:-0}
|
||||||
PORT=${PORT:-29500}
|
PORT=${PORT:-29500}
|
||||||
MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"}
|
MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"}
|
||||||
|
|
||||||
PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \
|
PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \
|
||||||
|
|
||||||
if [ ${GPUS} == 1 ]; then
|
|
||||||
python $(dirname "$0")/train.py $CONFIG --work-dir=${WORK_DIR} ${@:4}
|
|
||||||
else
|
|
||||||
python -m torch.distributed.launch \
|
python -m torch.distributed.launch \
|
||||||
--nnodes=$NNODES \
|
--nnodes=$NNODES \
|
||||||
--node_rank=$NODE_RANK \
|
--node_rank=$NODE_RANK \
|
||||||
@ -27,7 +17,4 @@ else
|
|||||||
--master_port=$PORT \
|
--master_port=$PORT \
|
||||||
$(dirname "$0")/train.py \
|
$(dirname "$0")/train.py \
|
||||||
$CONFIG \
|
$CONFIG \
|
||||||
--seed 0 \
|
--launcher pytorch ${@:3}
|
||||||
--work-dir=${WORK_DIR} \
|
|
||||||
--launcher pytorch ${@:4}
|
|
||||||
fi
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user