MaskTextSpotterV3报错

报错1


(MaskTextSpotterV3) xuehp@haomeiya004:~/git/MaskTextSpotterV3$ python tools/demo.py
Traceback (most recent call last):
  File "tools/demo.py", line 6, in <module>
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from .nms import nms
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 6, in <module>
    from apex import amp
  File "/home/xuehp/anaconda3/envs/MaskTextSpotterV3/lib/python3.7/site-packages/apex/__init__.py", line 13, in <module>
    from pyramid.session import UnencryptedCookieSessionFactoryConfig
ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

原因:应该是apex安装失败导致的。
办法:重新安装apex;或者拷贝代码。
作者就是拷贝了maskrcnn_benchmark的代码,我删除了__init__.py文件,因为它引用了utils。

https://github.com/NVIDIA/apex
不支持mac

报错2


(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3/tools$ python demo.py
Traceback (most recent call last):
  File "demo.py", line 6, in <module>
[core]
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from .nms import nms
  File "/home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
    from maskrcnn_benchmark import _C
ImportError: /home/xuehp/git/MaskTextSpotterV3/tools/maskrcnn_benchmark/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2at7getTypeERKNS_6TensorE

这是因为torchvision没有安装好,可能是版本不对。
办法:重新安装torchvision

报错3

(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$ sh train.sh 
*****************************************
Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. 
*****************************************
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
  File "tools/train_net.py", line 19, in <module>
  File "tools/train_net.py", line 19, in <module>
  File "tools/train_net.py", line 19, in <module>
Traceback (most recent call last):
  File "tools/train_net.py", line 19, in <module>
            from maskrcnn_benchmark.modeling.detector import build_detection_modelfrom maskrcnn_benchmark.modeling.detector import build_detection_modelfrom maskrcnn_benchmark.modeling.detector import build_detection_model

  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>

  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from .detectors import build_detection_model
      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
from .detectors import build_detection_model    
from .detectors import build_detection_model  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>

  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from .generalized_rcnn import GeneralizedRCNN
      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
from .generalized_rcnn import GeneralizedRCNN
    from .generalized_rcnn import GeneralizedRCNN  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>

      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from ..backbone import build_backbone
      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from ..backbone import build_backbonefrom .backbone import build_backbone

  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform    
from maskrcnn_benchmark.layers import Conv2d  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>

      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from maskrcnn_benchmark.layers import Conv2d
      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
from .nms import nms
      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
from .nms import nms
    Traceback (most recent call last):
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
from .nms import nms  File "tools/train_net.py", line 19, in <module>

      File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
from .nms import nms    
from maskrcnn_benchmark import _C  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>

    from maskrcnn_benchmark import _C
ImportError: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)ImportError    
: from maskrcnn_benchmark import _Ccannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)

    from maskrcnn_benchmark import _CImportError
: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)
ImportError: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
Traceback (most recent call last):
  File "tools/train_net.py", line 19, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from .nms import nms
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from maskrcnn_benchmark import _C
ImportError: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from .nms import nms
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
    from maskrcnn_benchmark import _C
ImportError: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)
Traceback (most recent call last):
  File "tools/train_net.py", line 19, in <module>
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from .nms import nms
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
    from maskrcnn_benchmark import _C
ImportError: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)
Traceback (most recent call last):
  File "tools/train_net.py", line 19, in <module>
    from maskrcnn_benchmark.modeling.detector import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/__init__.py", line 2, in <module>
    from .detectors import build_detection_model
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/detectors.py", line 3, in <module>
    from .generalized_rcnn import GeneralizedRCNN
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 12, in <module>
    from ..backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/__init__.py", line 2, in <module>
    from .backbone import build_backbone
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/backbone/backbone.py", line 53, in <module>
    from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/modeling/make_layers.py", line 10, in <module>
    from maskrcnn_benchmark.layers import Conv2d
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/__init__.py", line 9, in <module>
    from .nms import nms
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/layers/nms.py", line 3, in <module>
    from maskrcnn_benchmark import _C
ImportError: cannot import name '_C' from 'maskrcnn_benchmark' (/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/__init__.py)
Traceback (most recent call last):
  File "/home/xuehp/anaconda3/envs/MaskTextSpotterV3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/xuehp/anaconda3/envs/MaskTextSpotterV3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/xuehp/anaconda3/envs/MaskTextSpotterV3/lib/python3.8/site-packages/torch/distributed/launch.py", line 263, in <module>
    main()
  File "/home/xuehp/anaconda3/envs/MaskTextSpotterV3/lib/python3.8/site-packages/torch/distributed/launch.py", line 258, in main
    raise subprocess.CalledProcessError(returncode=process.returncode,
subprocess.CalledProcessError: Command '['/home/xuehp/anaconda3/envs/MaskTextSpotterV3/bin/python', '-u', 'tools/train_net.py', '--local_rank=7', '--config-file', 'configs/pretrain/seg_rec_poly_fuse_feature.yaml
']' returned non-zero exit status 1.
(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$ 

办法:直接在命令行敲入运行命令及参数

(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$ python tools/train_net.py --config-file configs/pretrain/seg_rec_poly_fuse_feature.yaml

报错4


(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$ python tools/train_net.py --config-file configs/pretrain/seg_rec_poly_fuse_feature.yaml
2021-03-12 13:01:12,664 maskrcnn_benchmark INFO: Using 1 GPUs
2021-03-12 13:01:12,664 maskrcnn_benchmark INFO: Namespace(config_file='configs/pretrain/seg_rec_poly_fuse_feature.yaml', distributed=False, local_rank=0, opts=[], skip_test=False)
2021-03-12 13:01:12,664 maskrcnn_benchmark INFO: Collecting env info (might take some time)
2021-03-12 13:01:14,345 maskrcnn_benchmark INFO:
PyTorch version: 1.4.0
Is debug build: No
CUDA used to build PyTorch: 10.0

OS: Ubuntu 18.04.5 LTS
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CMake version: version 3.10.2

Python version: 3.8
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration:
GPU 0: Tesla T4
GPU 1: Tesla T4

Nvidia driver version: 440.64.00
cuDNN version: /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudnn.so.7.6.5

Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.4.0
[pip3] torchvision==0.5.0
[conda] blas                      1.0                         mkl
[conda] mkl                       2020.2                      256
[conda] mkl-service               2.3.0            py38he904b0f_0
[conda] mkl_fft                   1.3.0            py38h54f3939_0
[conda] mkl_random                1.1.1            py38h0573a6f_0
[conda] pytorch                   1.4.0           py3.8_cuda10.0.130_cudnn7.6.3_0    pytorch
[conda] torchvision               0.5.0                py38_cu100    pytorch
        Pillow (8.1.2)
2021-03-12 13:01:14,345 maskrcnn_benchmark INFO: Loaded configuration file configs/pretrain/seg_rec_poly_fuse_feature.yaml
2021-03-12 13:01:14,345 maskrcnn_benchmark INFO:
MODEL:
  META_ARCHITECTURE: "GeneralizedRCNN"
  WEIGHT: "catalog://ImageNetPretrained/MSRA/R-50"
  BACKBONE:
    CONV_BODY: "R-50-FPN"
    OUT_CHANNELS: 256
  RESNETS:
    BACKBONE_OUT_CHANNELS: 256
  RPN:
    USE_FPN: True
    ANCHOR_STRIDE: (4, 8, 16, 32, 64)
    PRE_NMS_TOP_N_TRAIN: 2000
    PRE_NMS_TOP_N_TEST: 1000
    POST_NMS_TOP_N_TEST: 1000
    FPN_POST_NMS_TOP_N_TEST: 1000
  SEG:
    USE_FPN: True
    USE_FUSE_FEATURE: True
    TOP_N_TRAIN: 1000
    TOP_N_TEST: 1000
    BINARY_THRESH: 0.1
    BOX_THRESH: 0.1
    MIN_SIZE: 5
    SHRINK_RATIO: 0.4
    EXPAND_RATIO: 3.0
  ROI_HEADS:
    USE_FPN: True
    BATCH_SIZE_PER_IMAGE: 512
  ROI_BOX_HEAD:
    POOLER_RESOLUTION: 7
    POOLER_SCALES: (0.25,)
    POOLER_SAMPLING_RATIO: 2
    FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
    PREDICTOR: "FPNPredictor"
    NUM_CLASSES: 2
    USE_MASKED_FEATURE: True
  ROI_MASK_HEAD:
    POOLER_SCALES: (0.25,)
    FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor"
    PREDICTOR: "SeqCharMaskRCNNC4Predictor"
    POOLER_RESOLUTION: 14
    POOLER_RESOLUTION_H: 32
    POOLER_RESOLUTION_W: 32
    POOLER_SAMPLING_RATIO: 2
    RESOLUTION: 28
    RESOLUTION_H: 64
    RESOLUTION_W: 64
    SHARE_BOX_FEATURE_EXTRACTOR: False
    CHAR_NUM_CLASSES: 37
    USE_WEIGHTED_CHAR_MASK: True
    MASK_BATCH_SIZE_PER_IM: 64
    USE_MASKED_FEATURE: True
  MASK_ON: True
  CHAR_MASK_ON: True
  SEG_ON: True
SEQUENCE:
  SEQ_ON: True
  NUM_CHAR: 38
  BOS_TOKEN: 0
  MAX_LENGTH: 32
  TEACHER_FORCE_RATIO: 1.0
DATASETS:
  TRAIN: ("synthtext_train",)
  # TRAIN: ("synthtext_train","icdar_2013_train","icdar_2015_train","scut-eng-char_train","total_text_train")
  # RATIOS: [0.25,0.25,0.25,0.125,0.125]
  TEST: ("icdar_2015_test",)
  # TEST: ("total_text_test",)
  AUG: True
  IGNORE_DIFFICULT: True
  MAX_ROTATE_THETA: 90
DATALOADER:
  SIZE_DIVISIBILITY: 32
  NUM_WORKERS: 4
  ASPECT_RATIO_GROUPING: False
SOLVER:
  BASE_LR: 0.02 #0.02
  WARMUP_FACTOR: 0.1
  WEIGHT_DECAY: 0.0001
  STEPS: (100000, 200000)
  MAX_ITER: 300000
  IMS_PER_BATCH: 8
  RESUME: True
  DISPLAY_FREQ: 20
OUTPUT_DIR: "./output/pretrain"
TEST:
  VIS: False
  CHAR_THRESH: 192
  IMS_PER_BATCH: 1
INPUT:
  MIN_SIZE_TRAIN: (600, 800)
  # MIN_SIZE_TRAIN: (800, 1000, 1200, 1400)
  MAX_SIZE_TRAIN: 2333
  MIN_SIZE_TEST: 1440
  MAX_SIZE_TEST: 4000

2021-03-12 13:01:14,346 maskrcnn_benchmark INFO: Running with config:
AMP_VERBOSE: False
DATALOADER:
  ASPECT_RATIO_GROUPING: False
  NUM_WORKERS: 4
  SIZE_DIVISIBILITY: 32
DATASETS:
  AUG: True
  CROP_SIZE: (512, 512)
  FIX_CROP: False
  FIX_ROTATE: False
  IGNORE_DIFFICULT: True
  MAX_ROTATE_THETA: 90
  RANDOM_CROP_PROB: 0.0
  RATIOS: []
  TEST: ('icdar_2015_test',)
  TRAIN: ('synthtext_train',)
DTYPE: float32
INPUT:
  MAX_SIZE_TEST: 4000
  MAX_SIZE_TRAIN: 2333
  MIN_SIZE_TEST: 1440
  MIN_SIZE_TRAIN: (600, 800)
  PIXEL_MEAN: [102.9801, 115.9465, 122.7717]
  PIXEL_STD: [1.0, 1.0, 1.0]
  STRICT_RESIZE: False
  TO_BGR255: True
MODEL:
  BACKBONE:
    CONV_BODY: R-50-FPN
    FREEZE_CONV_BODY_AT: 2
    OUT_CHANNELS: 256
  CHAR_MASK_ON: True
  DEVICE: cuda
  FPN:
    USE_GN: False
    USE_RELU: False
  MASK_ON: True
  META_ARCHITECTURE: GeneralizedRCNN
  RESNET34: False
  RESNETS:
    BACKBONE_OUT_CHANNELS: 256
    DEFORMABLE_GROUPS: 1
    LAYERS: (3, 4, 6, 3)
    NUM_GROUPS: 1
    RES2_OUT_CHANNELS: 256
    RES5_DILATION: 1
    STAGE_WITH_DCN: (False, False, False, False)
    STEM_FUNC: StemWithFixedBatchNorm
    STEM_OUT_CHANNELS: 64
    STRIDE_IN_1X1: True
    TRANS_FUNC: BottleneckWithFixedBatchNorm
    WIDTH_PER_GROUP: 64
    WITH_MODULATED_DCN: False
  ROI_BOX_HEAD:
    FEATURE_EXTRACTOR: FPN2MLPFeatureExtractor
    INFERENCE_USE_BOX: True
    MIX_OPTION:
    MLP_HEAD_DIM: 1024
    NUM_CLASSES: 2
    POOLER_RESOLUTION: 7
    POOLER_SAMPLING_RATIO: 2
    POOLER_SCALES: (0.25,)
    PREDICTOR: FPNPredictor
    SOFT_MASKED_FEATURE_RATIO: 0.0
    USE_MASKED_FEATURE: True
    USE_REGRESSION: True
  ROI_HEADS:
    BATCH_SIZE_PER_IMAGE: 512
    BBOX_REG_WEIGHTS: (10.0, 10.0, 5.0, 5.0)
    BG_IOU_THRESHOLD: 0.5
    DETECTIONS_PER_IMG: 100
    FG_IOU_THRESHOLD: 0.5
    NMS: 0.5
    POSITIVE_FRACTION: 0.25
    SCORE_THRESH: 0.0
    USE_FPN: True
  ROI_MASK_HEAD:
    CHAR_NUM_CLASSES: 37
    CONV_LAYERS: (256, 256, 256, 256)
    FEATURE_EXTRACTOR: MaskRCNNFPNFeatureExtractor
    MASK_BATCH_SIZE_PER_IM: 64
    MIX_OPTION:
    MLP_HEAD_DIM: 1024
    POOLER_RESOLUTION: 14
    POOLER_RESOLUTION_H: 32
    POOLER_RESOLUTION_W: 32
    POOLER_SAMPLING_RATIO: 2
    POOLER_SCALES: (0.25,)
    PREDICTOR: SeqCharMaskRCNNC4Predictor
    RESOLUTION: 28
    RESOLUTION_H: 64
    RESOLUTION_W: 64
    SHARE_BOX_FEATURE_EXTRACTOR: False
    SOFT_MASKED_FEATURE_RATIO: 0.0
    USE_MASKED_FEATURE: True
    USE_WEIGHTED_CHAR_MASK: True
  RPN:
    ANCHOR_SIZES: (32, 64, 128, 256, 512)
    ANCHOR_STRIDE: (4, 8, 16, 32, 64)
    ASPECT_RATIOS: (0.5, 1.0, 2.0)
    BATCH_SIZE_PER_IMAGE: 256
    BG_IOU_THRESHOLD: 0.3
    FG_IOU_THRESHOLD: 0.7
    FPN_POST_NMS_TOP_N_TEST: 1000
    FPN_POST_NMS_TOP_N_TRAIN: 2000
    MIN_SIZE: 0
    NMS_THRESH: 0.7
    POSITIVE_FRACTION: 0.5
    POST_NMS_TOP_N_TEST: 1000
    POST_NMS_TOP_N_TRAIN: 2000
    PRE_NMS_TOP_N_TEST: 1000
    PRE_NMS_TOP_N_TRAIN: 2000
    STRADDLE_THRESH: 0
    USE_FPN: True
  RPN_ONLY: False
  SEG:
    AUG_PROPOSALS: False
    BATCH_SIZE_PER_IMAGE: 256
    BINARY_THRESH: 0.1
    BOX_EXPAND_RATIO: 1.5
    BOX_THRESH: 0.1
    EXPAND_RATIO: 3.0
    IGNORE_DIFFICULT: True
    MIN_SIZE: 5
    MULTIPLE_THRESH: (0.2, 0.3, 0.5, 0.7)
    POSITIVE_FRACTION: 0.5
    SHRINK_RATIO: 0.4
    TOP_N_TEST: 1000
    TOP_N_TRAIN: 1000
    USE_FPN: True
    USE_FUSE_FEATURE: True
    USE_MULTIPLE_THRESH: False
    USE_PPM: False
    USE_SEG_POLY: False
  SEG_ON: True
  TRAIN_DETECTION_ONLY: False
  WEIGHT: catalog://ImageNetPretrained/MSRA/R-50
OUTPUT_DIR: ./output/pretrain
PATHS_CATALOG: /home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/config/paths_catalog.py
SEQUENCE:
  BOS_TOKEN: 0
  MAX_LENGTH: 32
  MEAN_SCORE: False
  NUM_CHAR: 38
  RESIZE_HEIGHT: 16
  RESIZE_WIDTH: 64
  SEQ_ON: True
  TEACHER_FORCE_RATIO: 1.0
  TWO_CONV: False
SOLVER:
  BASE_LR: 0.02
  BIAS_LR_FACTOR: 2
  CHECKPOINT_PERIOD: 5000
  DISPLAY_FREQ: 20
  GAMMA: 0.1
  IMS_PER_BATCH: 8
  MAX_ITER: 300000
  MOMENTUM: 0.9
  POW_SCHEDULE: False
  RESUME: True
  STEPS: (100000, 200000)
  USE_ADAM: False
  WARMUP_FACTOR: 0.1
  WARMUP_ITERS: 500
  WARMUP_METHOD: linear
  WEIGHT_DECAY: 0.0001
  WEIGHT_DECAY_BIAS: 0
TEST:
  CHAR_THRESH: 192
  EXPECTED_RESULTS: []
  EXPECTED_RESULTS_SIGMA_TOL: 4
  IMS_PER_BATCH: 1
  VIS: False
Selected optimization level O0:  Pure FP32 training.

Defaults for this optimization level are:
enabled                : True
opt_level              : O0
cast_model_type        : torch.float32
patch_torch_functions  : False
keep_batchnorm_fp32    : None
master_weights         : False
loss_scale             : 1.0
Processing user overrides (additional kwargs that are not None)...
After processing overrides, optimization options are:
enabled                : True
opt_level              : O0
cast_model_type        : torch.float32
patch_torch_functions  : False
keep_batchnorm_fp32    : None
master_weights         : False
loss_scale             : 1.0
Warning:  multi_tensor_applier fused unscale kernel is unavailable, possibly because apex was installed without --cuda_ext --cpp_ext. Using Python fallback.  Original ImportError was: ModuleNotFoundError("No module named 'amp_C'")
2021-03-12 13:01:17,745 maskrcnn_benchmark.utils.checkpoint INFO: Loading checkpoint from catalog://ImageNetPretrained/MSRA/R-50
2021-03-12 13:01:17,745 maskrcnn_benchmark.utils.checkpoint INFO: catalog://ImageNetPretrained/MSRA/R-50 points to https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/MSRA/R-50.pkl
2021-03-12 13:01:17,745 maskrcnn_benchmark.utils.checkpoint INFO: url https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/MSRA/R-50.pkl cached in /home/xuehp/.torch/models/R-50.pkl
/home/xuehp/.torch/models/R-50.pkl
Traceback (most recent call last):
  File "tools/train_net.py", line 153, in <module>
    main()
  File "tools/train_net.py", line 149, in main
    model = train(cfg, args.local_rank, args.distributed)
  File "tools/train_net.py", line 63, in train
    extra_checkpoint_data = checkpointer.load(cfg.MODEL.WEIGHT, resume=cfg.SOLVER.RESUME)
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/utils/checkpoint.py", line 61, in load
    checkpoint = self._load_file(f)
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/utils/checkpoint.py", line 134, in _load_file
    return load_c2_format(self.cfg, f)
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/utils/c2_model_loading.py", line 164, in load_c2_format
    state_dict = _load_c2_pickled_weights(f)
  File "/home/xuehp/git/MaskTextSpotterV3/maskrcnn_benchmark/utils/c2_model_loading.py", line 123, in _load_c2_pickled_weights
    data = pickle.load(f, encoding="latin1")
UnicodeDecodeError: 'latin1' codec can't decode byte 0x95 in position 6: illegal multibyte sequence
(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$

办法:这个文件下载错了,重新下载,https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/MSRA/R-50.pkl
放置到:/home/xuehp/.torch/models/R-50.pkl

运行起来了

(1)将dataset目录下的文件进行解压

(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$ ls datasets/
icdar2013      icdar2015      scut-eng-char	 SynthText_GT_E2E	  total_text_labels
icdar2013.zip  icdar2015.zip  scut-eng-char.zip  SynthText_GT_E2E.tar.gz  total_text_labels.zip

(2)修改了配置文件

DATASETS:
  TRAIN: ("icdar_2015_train",)  #这块儿和测试文件保持一样
  TEST: ("icdar_2015_test",)

(3)运行

(MaskTextSpotterV3) xuehp@haomeiya008:~/git/MaskTextSpotterV3$ python tools/train_net.py --config-file configs/pretrain/seg_rec_poly_fuse_feature.yaml

失败了

一张显卡不够用

参考:https://www.cnblogs.com/guweixin/p/11162200.html

原文地址:https://www.cnblogs.com/xuehuiping/p/14513317.html