When I run train.py with YOLACT, I get the error KeyError: 0
I'm new to machine learning and program.
Now I'm trying to develop YOLACT AI using my own data.
However, when I run train.py, I get the following error and cannot learn.
What can I do to overcome this error?`
(yolact) tmori@tmori-Lenovo-Legion-Y740-15IRHg:~/yolact$ python train.py --config=can_config  --save_interval=2000



    loading annotations into memory...
    Done (t=0.00s)
    creating index...
    index created!
    loading annotations into memory...
    Done (t=0.00s)
    creating index...
    index created!
    Initializing weights...
    Begin training!
    
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    [  0]       0 || B: 4.840 | C: 16.249 | M: 4.682 | S: 2.749 | T: 28.521 || ETA: 9:18:44 || timer: 3.352
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    [  1]      10 || B: 4.535 | C: 9.228 | M: 4.379 | S: 1.867 | T: 20.008 || ETA: 3:25:24 || timer: 0.864
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    /home/tmori/yolact/utils/augmentations.py:309: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &apos;dtype=object&apos; when creating the ndarray
      mode = random.choice(self.sample_options)
    
    Computing validation mAP (this may take a while)...
    
    Traceback (most recent call last):
      File &quot;train.py&quot;, line 504, in &lt;module&gt;
        train()
      File &quot;train.py&quot;, line 371, in train
        compute_validation_map(epoch, iteration, yolact_net, val_dataset, log if args.log else None)
      File &quot;train.py&quot;, line 492, in compute_validation_map
        val_info = eval_script.evaluate(yolact_net, dataset, train_mode=True)
      File &quot;/home/tmori/yolact/eval.py&quot;, line 956, in evaluate
        prep_metrics(ap_data, preds, img, gt, gt_masks, h, w, num_crowd, dataset.ids[image_idx], detections)
      File &quot;/home/tmori/yolact/eval.py&quot;, line 427, in prep_metrics
        detections.add_bbox(image_id, classes[i], boxes[i,:],   box_scores[i])
      File &quot;/home/tmori/yolact/eval.py&quot;, line 315, in add_bbox
        &apos;category_id&apos;: get_coco_cat(int(category_id)),
      File &quot;/home/tmori/yolact/eval.py&quot;, line 293, in get_coco_cat
        return coco_cats[transformed_cat_id]
    KeyError: 0


I'm trying to develop an AI that finds cans and segments them.
First I annotated only one item of &quot;can&quot; with labelme, and then created a COCO format json file with labelme2coco.py.
After that, I modified config.py according to &quot;Custom Datasets&quot; on YOLACT's GitHub and ran train.py.
My development environment is as follows.
OS:Ubuntu20.04LTS　
Anaconda:4.8.3
Python: 3.6.12
Pytorch: 1.4.0
CUDA Toolkit: 10.1
cuDNN: 7.6.5　

Your class id in annotations.json should start from 1 not 0. If they are starting from 0, try this in config.py in your &quot;my_custom_dataset&quot; in label map add this
'label_map': { 0:  1, 1:  2, 2:  3... and so on}

In this case there 3 classes!
Also in yolact_base_config in same script num_classes should be 1 greater than your number of classes for example in this case it would be 4.
