Study: Software(SW)/SW: Error Bug Fix

[Error Fix] Solved: KeyError: 'I' (feat. Yolact++)

DrawingProcess 2024. 1. 16. 17:30
반응형

# Problem

I'm trying to fine-tune Yolact on 2GPU machine and getting the following error:

$ python train.py --config=yolact_plus_base_config --batch_size=2 --save_interval 1000 --save_folder weights/resnet101_construct_0112_fcon3_yolactplus/
...
KeyError: 'I'

# Solution

I have two pieces of suggestions for this problem:

  • The first method, you can decrease the resolution of discard_mask_area.
  • The second method is giving zero loss when the maskiou_targets is None in moltibox_loss.py, say my repo for details.

I tried the second one and it has worked.

$ code yolact/layers/modules/multibox_loss.py 
...
        # Mask IoU Loss
        if cfg.use_maskiou:
            if maskiou_targets is not None:
                losses['I'] = self.mask_iou_loss(net, maskiou_targets)
            else:
                losses['I'] = torch.tensor(0, device=loc_data.device, dtype=loc_data.dtype)
...

# Reference

[Github Issue] KeyError: 'I' #442: https://github.com/dbolya/yolact/issues/442#issuecomment-744411350 

반응형