ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: zero-size array to reduction operation minimum which has no identity

nublanazqalani opened this issue · comments

I try to load my custom dataset annotated using labelme, but i got an error like this

ValueError                                Traceback (most recent call last)
<ipython-input-20-35f47737b308> in <module>
      3 
      4 vis_img = instance_custom_training()
----> 5 vis_img.load_dataset("labelikan_rata100")
      6 vis_img.visualize_sample()

9 frames
/usr/local/lib/python3.7/dist-packages/pixellib/custom_train.py in load_dataset(self, dataset)
     76 
     77         #conversion of individual labelme json files into a single json file
---> 78         labelme2coco.convert(labelme_folder2, save_json_path2)
     79 
     80         # Training dataset.

/usr/local/lib/python3.7/dist-packages/labelme2coco/__init__.py in convert(labelme_folder, save_json_path)
     12         save_json_path: oath for coco json to be saved
     13     """
---> 14     labelme2coco(labelme_folder, save_json_path)

/usr/local/lib/python3.7/dist-packages/labelme2coco/labelme2coco.py in __init__(self, labelme_folder, save_json_path)
     32         self.labelme_json = labelme_json
     33 
---> 34         self.save_json()
     35 
     36     def data_transfer(self):

/usr/local/lib/python3.7/dist-packages/labelme2coco/labelme2coco.py in save_json(self)
    143 
    144     def save_json(self):
--> 145         self.data_transfer()
    146         self.data_coco = self.data2coco()
    147 

/usr/local/lib/python3.7/dist-packages/labelme2coco/labelme2coco.py in data_transfer(self)
     48                         self.label.append(label)
     49                     points = shapes['points']
---> 50                     self.annotations.append(self.annotation(points, label, num))
     51                     self.annID += 1
     52 

/usr/local/lib/python3.7/dist-packages/labelme2coco/labelme2coco.py in annotation(self, points, label, num)
     82         annotation['image_id'] = int(num + 1)
     83 
---> 84         annotation['bbox'] = list(map(float, self.getbbox(points)))
     85 
     86         # coarsely from bbox to segmentation

/usr/local/lib/python3.7/dist-packages/labelme2coco/labelme2coco.py in getbbox(self, points)
    111         polygons = points
    112         mask = self.polygons_to_mask([self.height, self.width], polygons)
--> 113         return self.mask2box(mask)
    114 
    115     def mask2box(self, mask):

/usr/local/lib/python3.7/dist-packages/labelme2coco/labelme2coco.py in mask2box(self, mask)
    119         clos = index[:, 1]
    120 
--> 121         left_top_r = np.min(rows)  # y
    122         left_top_c = np.min(clos)  # x
    123 

<__array_function__ internals> in amin(*args, **kwargs)

/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py in amin(a, axis, out, keepdims, initial, where)
   2878     """
   2879     return _wrapreduction(a, np.minimum, 'min', axis, None, out,
-> 2880                           keepdims=keepdims, initial=initial, where=where)
   2881 
   2882 

/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
     84                 return reduction(axis=axis, out=out, **passkwargs)
     85 
---> 86     return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
     87 
     88 

ValueError: zero-size array to reduction operation minimum which has no identity