MhLiao / MaskTextSpotter

A PyTorch implementation of Mask TextSpotter
https://github.com/MhLiao/MaskTextSpotter
414 stars 96 forks source link

ICDAR datsets throw Index out of range error in segmentation_mask.py #51

Closed sarundel closed 4 years ago

sarundel commented 4 years ago

Hi @MhLiao,

Thanks so much for providing this excellent code base. My team at the US Geological Survey is using it to recognize character on historical topographic maps. When training, the ICDAR datasets throw an index out of range error in segmentation_mask. If we don't use those datasets (set ratio to zero in the config files), training proceeds normally. We downloaded those datasets from the place you indicate, and have them in the right spot with a train_list.txt file as directed. Please advise us if possible.

Thanks so much,

Sam

sarundel commented 4 years ago

chars_boxes.shape: 0

Traceback (most recent call last): File "tools/train_net.py", line 174, in main() File "tools/train_net.py", line 167, in main model = train(cfg, args.local_rank, args.distributed) File "tools/train_net.py", line 66, in train do_train( File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/engine/trainer.py", line 66, in do_train loss_dict = model(images, targets) File "/data/sams_projects/conda_envs/mts/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, kwargs) File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 52, in forward x, result, detector_losses = self.roi_heads(features, proposals, targets) File "/data/sams_projects/conda_envs/mts/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, *kwargs) File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/modeling/roi_heads/roi_heads.py", line 36, in forward x, detections, loss_mask = self.mask(mask_features, detections, targets) File "/data/sams_projects/conda_envs/mts/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(input, kwargs) File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/modeling/roi_heads/mask_head/mask_head.py", line 185, in forward mask_targets, char_mask_targets, char_mask_weights, decoder_targets, word_targets = self.prepare_targets(proposals, targets) File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/modeling/roi_heads/mask_head/mask_head.py", line 124, in prepare_targets matched_targets = self.match_targets_to_proposals( File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/modeling/roi_heads/mask_head/mask_head.py", line 113, in match_targets_to_proposals matched_targets = target[matched_idxs.clamp(min=0)] File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/structures/bounding_box.py", line 246, in getitem bbox.add_field(k, v[item]) File "/data/sams_projects/SpotElevationsOCR/MaskTextSpotter/maskrcnn_benchmark/structures/segmentation_mask.py", line 501, in getitem selected_chars_boxes.append(self.chars_boxes[i]) IndexError: list index out of range Traceback (most recent call last): File "/data/sams_projects/conda_envs/mts/lib/python3.8/runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "/data/sams_projects/conda_envs/mts/lib/python3.8/runpy.py", line 86, in _run_code exec(code, run_globals) File "/data/sams_projects/conda_envs/mts/lib/python3.8/site-packages/torch/distributed/launch.py", line 263, in main() File "/data/sams_projects/conda_envs/mts/lib/python3.8/site-packages/torch/distributed/launch.py", line 258, in main raise subprocess.CalledProcessError(returncode=process.returncode, subprocess.CalledProcessError: Command '['/data/sams_projects/conda_envs/mts/bin/python3', '-u', 'tools/train_net.py', '--local_rank=0', '--config-file', 'configs/finetune.yaml']' returned non-zero exit

sarundel commented 4 years ago

See issue #43 for resolution.