Another in pytorch for yolact

Hello I have this bug :

runfile('C:/Users/Sylvain ARD/Dropbox/Documents Sylvain/travail avec Boubacar/yolact/yolact-master/yolact-master/train.py', wdir='C:/Users/Sylvain ARD/Dropbox/Documents Sylvain/travail avec Boubacar/yolact/yolact-master/yolact-master')
Reloaded modules: data, data.config, backbone, data.coco, utils, utils.augmentations, utils.functions, layers, layers.functions, layers.functions.detection, layers.box_utils, utils.timer, layers.modules, layers.modules.multibox_loss, layers.interpolate, utils.logger, utils.nvinfo, yolact, eval, layers.output_utils
loading annotations into memory...
Done (t=0.05s)
creating index...
index created!
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
Initializing weights...
Begin training!

epoch :  0

C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\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 'dtype=object' when creating the ndarray.
  mode = random.choice(self.sample_options)
C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\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 'dtype=object' when creating the ndarray.
  mode = random.choice(self.sample_options)
C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\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 'dtype=object' when creating the ndarray.
  mode = random.choice(self.sample_options)
Traceback (most recent call last):

  File "C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\train.py", line 505, in <module>
    train()

  File "C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\train.py", line 271, in train
    for datum in data_loader:

  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\torch\utils\data\dataloader.py", line 819, in __next__
    return self._process_data(data)

  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\torch\utils\data\dataloader.py", line 846, in _process_data
    data.reraise()

  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\torch\_utils.py", line 369, in reraise
    raise self.exc_type(msg)

TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\torch\utils\data\_utils\worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\data\coco.py", line 94, in __getitem__
    im, gt, masks, h, w, num_crowds = self.pull_item(index)
  File "C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\data\coco.py", line 148, in pull_item
    masks = [self.coco.annToMask(obj).reshape(-1) for obj in target]
  File "C:\Users\Sylvain ARD\Dropbox\Documents Sylvain\travail avec Boubacar\yolact\yolact-master\yolact-master\data\coco.py", line 148, in <listcomp>
    masks = [self.coco.annToMask(obj).reshape(-1) for obj in target]
  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\pycocotools\coco.py", line 438, in annToMask
    rle = self.annToRLE(ann)
  File "C:\Users\Sylvain ARD\.conda\envs\yolact\lib\site-packages\pycocotools\coco.py", line 423, in annToRLE
    rles = maskUtils.frPyObjects(segm, h, w)
  File "pycocotools\_mask.pyx", line 292, in pycocotools._mask.frPyObjects
TypeError: object of type 'int' has no len()

please help me !
Thank you
bye

Hi,

It would be very helpful if you shared some information about what you’re doing when this happened?
When debugging issues happening in the dataloading, I would recommend setting the number of workers to 0 as well to get more helpful stack traces.

I use the code I cite in the other thread, I fixed this bug by correcting my mask json

Hi. Please, How did you do this?? I have the same problem. Thanks.

The segmentations are arrays of polygons and not polygons