Hello, I'm trying to train the model for 3 classes but I have been with problems in the process. I'm using the Balloon example with modifications according to the #372 . The problem I think are the annotations, I annotated in VIA 2.0.8 with polygons. The code that I used is:
def load_mineria(self, dataset_dir, subset):
"""Load a subset of the bottle dataset.
dataset_dir: Root directory of the dataset.
subset: Subset to load: train or val
"""
# Add classes. We have only one class to add.
self.add_class("mineria", 1, "rio")
self.add_class("mineria", 2, "piscina")
self.add_class("mineria", 3, "remocion")
# Train or validation dataset?
assert subset in ["train", "val"]
dataset_dir = os.path.join(dataset_dir, subset)
# We mostly care about the x and y coordinates of each region
annotations1 = json.load(open(os.path.join(dataset_dir, "train_val.json")))
#print(annotations)
annotations = list(annotations1.values()) # don't need the dict keys
# The VIA tool saves images in the JSON even if they don't have any
# annotations. Skip unannotated images.
annotations = [a for a in annotations if a['regions']]
# Add images
for a in annotations:
# print(a)
# Get the x, y coordinaets of points of the polygons that make up
# the outline of each object instance. There are stores in the
# shape_attributes (see json format above)
#polygons = [r['shape_attributes'] for r in a['regions'].values()]
polygons = [r['shape_attributes'] for r in a['regions']]
#print(polygons)
#objects = [s['region_attributes'] for s in a['regions'].values()]
objects = [s['region_attributes'] for s in a['regions']]
#print(objects)
# for n in multi_numbers:
#num_ids = [int(n['mineria']) for n in objects]
num_ids = []
for n in objects:
try:
if 'rio' in n.keys():
num_ids.append(1)
elif 'piscina' in n.keys():
num_ids.append(2)
elif 'remocion' in n.keys():
num_ids.append(3)
except:
pass
# load_mask() needs the image size to convert polygons to masks.
# Unfortunately, VIA doesn't include it in JSON, so we must read
# the image. This is only managable since the dataset is tiny.
image_path = os.path.join(dataset_dir, a['filename'])
image = skimage.io.imread(image_path)
height, width = image.shape[:2]
self.add_image(
"mineria", ## for a single class just add the name here
image_id=a['filename'], # use file name as a unique image id
path=image_path,
width=width, height=height,
polygons=polygons,
num_ids=num_ids)
def load_mask(self, image_id):
"""Generate instance masks for an image.
Returns:
masks: A bool array of shape [height, width, instance count] with
one mask per instance.
class_ids: a 1D array of class IDs of the instance masks.
"""
# If not a bottle dataset image, delegate to parent class.
info = self.image_info[image_id]
if info["source"] != "mineria":
return super(self.__class__, self).load_mask(image_id)
num_ids = info['num_ids']
# Convert polygons to a bitmap mask of shape
# [height, width, instance_count]
info = self.image_info[image_id]
mask = np.zeros([info["height"], info["width"], len(info["polygons"])],
dtype=np.uint8)
for i, p in enumerate(info["polygons"]):
# Get indexes of pixels inside the polygon and set them to 1
rr, cc = skimage.draw.polygon(p['all_points_y'], p['all_points_x'])
mask[rr, cc, i] = 1
# Return mask, and array of class IDs of each instance. Since we have
# one class ID only, we return an array of 1s
#return mask.astype(np.bool), np.ones([mask.shape[-1]], dtype=np.int32)
# Map class names to class IDs.
num_ids = np.array(num_ids, dtype=np.int32)
return mask, info['num_ids']
def image_reference(self, image_id):
"""Return the path of the image."""
info = self.image_info[image_id]
if info["source"] == "mineria":
return info["path"]
else:
super(self.__class__, self).image_reference(image_id)
def train(model):
"""Train the model."""
Training dataset.
dataset_train = MineriaDataset()
dataset_train.load_mineria(args.dataset, "train")
dataset_train.prepare()
# Validation dataset
dataset_val = MineriaDataset()
dataset_val.load_mineria(args.dataset, "val")
dataset_val.prepare()
# *** This training schedule is an example. Update to your needs ***
# Since we're using a very small dataset, and starting from
# COCO trained weights, we don't need to train too long. Also,
# no need to train all layers, just the heads should do it.
print("Training network heads")
model.train(dataset_train, dataset_val,
learning_rate=config.LEARNING_RATE,
epochs=10,
layers='heads')`
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt
class_ids = class_ids[_idx]
TypeError: only integer scalar arrays can be converted to a scalar index
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 641, in next_sample
return six.next(_SHARED_SEQUENCES[uid])
File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt
class_ids = class_ids[_idx]
TypeError: only integer scalar arrays can be converted to a scalar index
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "mineria.py", line 392, in
train(model)
File "mineria.py", line 228, in train
layers='heads')
File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 2374, in train
File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, *kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1658, in fit_generator
initial_epoch=initial_epoch)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_generator.py", line 181, in fit_generator
generator_output = next(output_generator)
File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 733, in get
six.reraise(sys.exc_info())
File "/usr/local/lib/python3.6/dist-packages/six.py", line 693, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 702, in get
inputs = future.get(timeout=30)
File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
TypeError: only integer scalar arrays can be converted to a scalar index`
Someone can help me, I have spent several time to fix this error but I don't know how to solve it.
Hello, I'm trying to train the model for 3 classes but I have been with problems in the process. I'm using the Balloon example with modifications according to the #372 . The problem I think are the annotations, I annotated in VIA 2.0.8 with polygons. The code that I used is:
`
############################################################
Dataset
############################################################
class MineriaDataset(utils.Dataset):
def train(model): """Train the model."""
Training dataset.
After run, I received this error:
` Epoch 1/10 ERROR:root:Error processing image {'id': '983.jpg', 'source': 'mineria', 'path': '/content/gdrive/My Drive/FACSAT-1/Mask_RCNN/samples/mineria/dataset/val/983.jpg', 'width': 600, 'height': 600, 'polygons': [{'name': 'polyline', 'all_points_x': [364, 352, 349, 346, 345, 343, 343, 343, 344, 347, 349, 349, 348, 341, 334, 332, 333, 337, 344, 348, 350, 364, 365, 368, 369, 370, 370, 368, 367, 367, 367, 366, 366, 366, 373, 376, 371, 363, 358, 349, 345, 345, 346, 349, 351, 351, 349, 334, 329, 323, 315, 315, 316, 317, 320, 320, 324, 332, 332, 332, 326, 323, 320, 314, 311, 311, 315, 316, 318, 320, 320, 320, 321, 324, 326, 327, 327, 329, 329, 329, 331, 331, 321, 317, 301, 298, 290, 289, 286, 283, 281, 276, 275, 272, 270, 263, 261, 259, 257, 255, 251, 249, 248, 246, 244, 237, 236, 232, 229, 225, 222, 218, 216, 200, 199, 187, 186, 177, 174, 169, 161, 172, 174, 177, 183, 187, 189, 193, 195, 198, 202, 207, 223, 223, 224, 225, 226, 226, 228, 229, 238, 255, 259, 269, 274, 270, 276, 289, 291, 299, 314, 330, 331, 338, 338, 329, 320, 317, 315, 320, 331, 335, 336, 331, 327, 318, 320, 323, 329, 338, 339, 351, 355, 355, 351, 349, 349, 354, 360, 365, 377, 379, 379, 380, 376, 374, 373, 371, 373, 372, 364, 359, 349, 341, 337, 339, 345, 350, 352, 352, 348, 345, 348, 360, 367, 366, 365, 364], 'all_points_y': [162, 168, 169, 170, 173, 178, 180, 182, 184, 190, 193, 197, 200, 204, 210, 215, 216, 218, 218, 217, 217, 219, 219, 219, 220, 222, 223, 229, 234, 237, 239, 246, 247, 249, 263, 267, 273, 272, 272, 273, 283, 289, 291, 295, 297, 299, 305, 314, 318, 319, 322, 326, 332, 335, 335, 336, 339, 344, 346, 349, 355, 356, 356, 357, 358, 366, 371, 374, 376, 379, 380, 381, 382, 385, 386, 387, 388, 392, 393, 394, 394, 402, 404, 404, 410, 410, 412, 412, 414, 416, 417, 417, 417, 415, 410, 405, 403, 403, 400, 399, 395, 394, 390, 387, 386, 381, 381, 379, 378, 378, 385, 395, 397, 402, 404, 407, 411, 414, 415, 415, 417, 421, 418, 420, 420, 415, 414, 412, 411, 410, 410, 410, 399, 397, 396, 391, 387, 384, 384, 384, 388, 406, 412, 417, 419, 419, 420, 420, 417, 414, 411, 409, 409, 400, 395, 382, 371, 367, 366, 362, 358, 358, 344, 339, 336, 332, 327, 325, 322, 319, 318, 309, 301, 295, 289, 285, 279, 276, 275, 276, 278, 272, 267, 266, 264, 259, 257, 250, 224, 217, 216, 216, 214, 215, 215, 209, 207, 206, 200, 190, 185, 177, 173, 167, 164, 164, 163, 162]}, {'name': 'polyline', 'all_points_x': [346, 349, 353, 353, 356, 359, 362, 365, 367, 370, 371, 374, 377, 379, 381, 384, 387, 388, 390, 390, 390, 389, 388, 388, 387, 387, 387, 387, 388, 388, 390, 393, 395, 404, 405, 407, 409, 410, 411, 412, 414, 416, 420, 423, 423, 423, 426, 431, 429, 427, 431, 435, 435, 432, 430, 430, 432, 433, 433, 428, 426, 421, 419, 417, 413, 409, 404, 398, 395, 390, 393, 392, 391, 389, 387, 386, 383, 382, 378, 377, 375, 373, 373, 371, 369, 367, 361, 357, 356, 356, 355, 349, 346], 'all_points_y': [314, 314, 315, 319, 320, 325, 323, 322, 321, 320, 321, 323, 325, 326, 328, 332, 333, 334, 335, 337, 339, 340, 342, 342, 343, 343, 344, 345, 347, 348, 349, 351, 351, 350, 349, 349, 350, 350, 351, 353, 353, 354, 354, 356, 356, 357, 359, 361, 369, 372, 376, 377, 376, 374, 372, 369, 368, 367, 363, 358, 357, 353, 353, 351, 351, 349, 347, 348, 348, 347, 338, 336, 334, 332, 330, 328, 325, 324, 322, 322, 319, 317, 317, 317, 317, 318, 320, 318, 316, 316, 313, 311, 313]}, {'name': 'polyline', 'all_points_x': [373, 379, 379, 378, 377, 376, 376, 376, 376, 378, 379, 381, 382, 384, 385, 385, 385, 385, 384, 383, 382, 382, 384, 386, 388, 391, 392, 393, 392, 392, 393, 394, 396, 398, 398, 398, 398, 403, 408, 407, 405, 401, 398, 397, 395, 392, 389, 389, 389, 389, 385, 384, 381, 380, 381, 382, 382, 380, 379, 381, 382, 382, 378, 374, 374, 375, 376, 373, 372, 372], 'all_points_y': [217, 213, 210, 210, 209, 210, 209, 207, 206, 205, 205, 207, 207, 206, 204, 203, 201, 199, 198, 199, 199, 197, 197, 197, 197, 197, 196, 194, 194, 193, 193, 193, 193, 193, 192, 192, 187, 181, 178, 176, 176, 181, 188, 191, 191, 191, 192, 193, 194, 195, 195, 195, 195, 196, 197, 198, 198, 199, 199, 201, 202, 204, 203, 205, 208, 209, 211, 214, 216, 217]}, {'name': 'polyline', 'all_points_x': [144, 146, 147, 149, 149, 149, 149, 151, 153, 157, 158, 160, 161, 162, 163, 166, 167, 167, 168, 171, 171, 172, 172, 173, 175, 175, 177, 178, 179, 180, 181, 184, 185, 186, 187, 188, 190, 192, 192, 194, 194, 193, 192, 193, 192, 191, 191, 189, 183, 183, 183, 182, 182, 182, 182, 182, 179, 178, 178, 177, 176, 174, 173, 172, 169, 167, 165, 163, 162, 160, 159, 158, 156, 155, 153, 153, 152, 151, 150, 150, 150, 149, 146, 146, 145], 'all_points_y': [302, 302, 302, 302, 303, 304, 305, 306, 307, 308, 307, 306, 306, 305, 305, 305, 305, 305, 305, 307, 307, 307, 307, 308, 309, 310, 311, 312, 312, 311, 311, 309, 309, 308, 306, 305, 305, 304, 303, 301, 300, 299, 298, 298, 297, 296, 296, 296, 298, 299, 301, 303, 304, 305, 306, 306, 309, 309, 309, 308, 308, 307, 306, 305, 304, 304, 304, 303, 304, 304, 305, 305, 305, 305, 306, 305, 304, 303, 302, 302, 301, 301, 301, 301, 303]}, {'name': 'polyline', 'all_points_x': [374, 374, 375, 378, 378, 380, 382, 383, 385, 384, 386, 387, 389, 387, 386, 386, 385, 383, 383, 379, 378, 377, 376, 374, 373, 373, 372, 373, 373, 373, 373, 373, 373], 'all_points_y': [256, 256, 256, 256, 258, 258, 258, 259, 256, 256, 253, 253, 252, 250, 249, 248, 247, 246, 246, 245, 246, 247, 248, 247, 247, 249, 250, 251, 252, 254, 255, 255, 256]}], 'num_ids': []} Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt class_ids = class_ids[_idx] TypeError: only integer scalar arrays can be converted to a scalar index ERROR:root:Error processing image {'id': '983.jpg', 'source': 'mineria', 'path': '/content/gdrive/My Drive/FACSAT-1/Mask_RCNN/samples/mineria/dataset/val/983.jpg', 'width': 600, 'height': 600, 'polygons': [{'name': 'polyline', 'all_points_x': [364, 352, 349, 346, 345, 343, 343, 343, 344, 347, 349, 349, 348, 341, 334, 332, 333, 337, 344, 348, 350, 364, 365, 368, 369, 370, 370, 368, 367, 367, 367, 366, 366, 366, 373, 376, 371, 363, 358, 349, 345, 345, 346, 349, 351, 351, 349, 334, 329, 323, 315, 315, 316, 317, 320, 320, 324, 332, 332, 332, 326, 323, 320, 314, 311, 311, 315, 316, 318, 320, 320, 320, 321, 324, 326, 327, 327, 329, 329, 329, 331, 331, 321, 317, 301, 298, 290, 289, 286, 283, 281, 276, 275, 272, 270, 263, 261, 259, 257, 255, 251, 249, 248, 246, 244, 237, 236, 232, 229, 225, 222, 218, 216, 200, 199, 187, 186, 177, 174, 169, 161, 172, 174, 177, 183, 187, 189, 193, 195, 198, 202, 207, 223, 223, 224, 225, 226, 226, 228, 229, 238, 255, 259, 269, 274, 270, 276, 289, 291, 299, 314, 330, 331, 338, 338, 329, 320, 317, 315, 320, 331, 335, 336, 331, 327, 318, 320, 323, 329, 338, 339, 351, 355, 355, 351, 349, 349, 354, 360, 365, 377, 379, 379, 380, 376, 374, 373, 371, 373, 372, 364, 359, 349, 341, 337, 339, 345, 350, 352, 352, 348, 345, 348, 360, 367, 366, 365, 364], 'all_points_y': [162, 168, 169, 170, 173, 178, 180, 182, 184, 190, 193, 197, 200, 204, 210, 215, 216, 218, 218, 217, 217, 219, 219, 219, 220, 222, 223, 229, 234, 237, 239, 246, 247, 249, 263, 267, 273, 272, 272, 273, 283, 289, 291, 295, 297, 299, 305, 314, 318, 319, 322, 326, 332, 335, 335, 336, 339, 344, 346, 349, 355, 356, 356, 357, 358, 366, 371, 374, 376, 379, 380, 381, 382, 385, 386, 387, 388, 392, 393, 394, 394, 402, 404, 404, 410, 410, 412, 412, 414, 416, 417, 417, 417, 415, 410, 405, 403, 403, 400, 399, 395, 394, 390, 387, 386, 381, 381, 379, 378, 378, 385, 395, 397, 402, 404, 407, 411, 414, 415, 415, 417, 421, 418, 420, 420, 415, 414, 412, 411, 410, 410, 410, 399, 397, 396, 391, 387, 384, 384, 384, 388, 406, 412, 417, 419, 419, 420, 420, 417, 414, 411, 409, 409, 400, 395, 382, 371, 367, 366, 362, 358, 358, 344, 339, 336, 332, 327, 325, 322, 319, 318, 309, 301, 295, 289, 285, 279, 276, 275, 276, 278, 272, 267, 266, 264, 259, 257, 250, 224, 217, 216, 216, 214, 215, 215, 209, 207, 206, 200, 190, 185, 177, 173, 167, 164, 164, 163, 162]}, {'name': 'polyline', 'all_points_x': [346, 349, 353, 353, 356, 359, 362, 365, 367, 370, 371, 374, 377, 379, 381, 384, 387, 388, 390, 390, 390, 389, 388, 388, 387, 387, 387, 387, 388, 388, 390, 393, 395, 404, 405, 407, 409, 410, 411, 412, 414, 416, 420, 423, 423, 423, 426, 431, 429, 427, 431, 435, 435, 432, 430, 430, 432, 433, 433, 428, 426, 421, 419, 417, 413, 409, 404, 398, 395, 390, 393, 392, 391, 389, 387, 386, 383, 382, 378, 377, 375, 373, 373, 371, 369, 367, 361, 357, 356, 356, 355, 349, 346], 'all_points_y': [314, 314, 315, 319, 320, 325, 323, 322, 321, 320, 321, 323, 325, 326, 328, 332, 333, 334, 335, 337, 339, 340, 342, 342, 343, 343, 344, 345, 347, 348, 349, 351, 351, 350, 349, 349, 350, 350, 351, 353, 353, 354, 354, 356, 356, 357, 359, 361, 369, 372, 376, 377, 376, 374, 372, 369, 368, 367, 363, 358, 357, 353, 353, 351, 351, 349, 347, 348, 348, 347, 338, 336, 334, 332, 330, 328, 325, 324, 322, 322, 319, 317, 317, 317, 317, 318, 320, 318, 316, 316, 313, 311, 313]}, {'name': 'polyline', 'all_points_x': [373, 379, 379, 378, 377, 376, 376, 376, 376, 378, 379, 381, 382, 384, 385, 385, 385, 385, 384, 383, 382, 382, 384, 386, 388, 391, 392, 393, 392, 392, 393, 394, 396, 398, 398, 398, 398, 403, 408, 407, 405, 401, 398, 397, 395, 392, 389, 389, 389, 389, 385, 384, 381, 380, 381, 382, 382, 380, 379, 381, 382, 382, 378, 374, 374, 375, 376, 373, 372, 372], 'all_points_y': [217, 213, 210, 210, 209, 210, 209, 207, 206, 205, 205, 207, 207, 206, 204, 203, 201, 199, 198, 199, 199, 197, 197, 197, 197, 197, 196, 194, 194, 193, 193, 193, 193, 193, 192, 192, 187, 181, 178, 176, 176, 181, 188, 191, 191, 191, 192, 193, 194, 195, 195, 195, 195, 196, 197, 198, 198, 199, 199, 201, 202, 204, 203, 205, 208, 209, 211, 214, 216, 217]}, {'name': 'polyline', 'all_points_x': [144, 146, 147, 149, 149, 149, 149, 151, 153, 157, 158, 160, 161, 162, 163, 166, 167, 167, 168, 171, 171, 172, 172, 173, 175, 175, 177, 178, 179, 180, 181, 184, 185, 186, 187, 188, 190, 192, 192, 194, 194, 193, 192, 193, 192, 191, 191, 189, 183, 183, 183, 182, 182, 182, 182, 182, 179, 178, 178, 177, 176, 174, 173, 172, 169, 167, 165, 163, 162, 160, 159, 158, 156, 155, 153, 153, 152, 151, 150, 150, 150, 149, 146, 146, 145], 'all_points_y': [302, 302, 302, 302, 303, 304, 305, 306, 307, 308, 307, 306, 306, 305, 305, 305, 305, 305, 305, 307, 307, 307, 307, 308, 309, 310, 311, 312, 312, 311, 311, 309, 309, 308, 306, 305, 305, 304, 303, 301, 300, 299, 298, 298, 297, 296, 296, 296, 298, 299, 301, 303, 304, 305, 306, 306, 309, 309, 309, 308, 308, 307, 306, 305, 304, 304, 304, 303, 304, 304, 305, 305, 305, 305, 306, 305, 304, 303, 302, 302, 301, 301, 301, 301, 303]}, {'name': 'polyline', 'all_points_x': [374, 374, 375, 378, 378, 380, 382, 383, 385, 384, 386, 387, 389, 387, 386, 386, 385, 383, 383, 379, 378, 377, 376, 374, 373, 373, 372, 373, 373, 373, 373, 373, 373], 'all_points_y': [256, 256, 256, 256, 258, 258, 258, 259, 256, 256, 253, 253, 252, 250, 249, 248, 247, 246, 246, 245, 246, 247, 248, 247, 247, 249, 250, 251, 252, 254, 255, 255, 256]}], 'num_ids': []} Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt class_ids = class_ids[_idx] TypeError: only integer scalar arrays can be converted to a scalar index ERROR:root:Error processing image {'id': '984.jpg', 'source': 'mineria', 'path': '/content/gdrive/My Drive/FACSAT-1/Mask_RCNN/samples/mineria/dataset/val/984.jpg', 'width': 600, 'height': 600, 'polygons': [{'name': 'polyline', 'all_points_x': [158, 160, 162, 165, 175, 181, 185, 187, 189, 197, 199, 203, 202, 205, 209, 213, 219, 216, 212, 211, 209, 209, 208, 208, 203, 202, 200, 199, 197, 196, 196, 195, 195, 199, 207, 211, 215, 218, 219, 220, 221, 223, 223, 223, 223, 226, 227, 229, 232, 232, 233, 234, 234, 233, 231, 229, 224, 222, 222, 221, 221, 221, 221, 221, 221, 221, 220, 216, 214, 215, 212, 207, 204, 202, 194, 194, 193, 191, 191, 193, 194, 199, 200, 200, 202, 203, 205, 207, 212, 215, 215, 212, 210, 209, 204, 203, 201, 198, 195, 191, 187, 185, 185, 185, 184, 180, 171, 171, 169, 167, 163, 160, 158, 157, 156], 'all_points_y': [352, 352, 352, 354, 360, 359, 357, 352, 347, 335, 336, 335, 338, 338, 340, 340, 335, 333, 332, 330, 329, 328, 327, 326, 318, 316, 315, 315, 313, 311, 310, 307, 305, 304, 299, 297, 295, 291, 290, 290, 287, 284, 281, 278, 274, 267, 267, 266, 271, 270, 270, 269, 266, 264, 261, 261, 265, 268, 268, 270, 272, 274, 276, 278, 279, 281, 284, 290, 292, 293, 293, 296, 297, 299, 303, 304, 304, 307, 307, 310, 312, 317, 318, 319, 323, 324, 326, 329, 333, 334, 336, 337, 338, 337, 337, 333, 332, 331, 335, 339, 348, 351, 352, 353, 355, 357, 355, 355, 354, 353, 352, 350, 350, 350, 350]}, {'name': 'polyline', 'all_points_x': [244, 245, 246, 249, 252, 252, 257, 258, 259, 260, 260, 260, 261, 261, 261, 261, 263, 264, 265, 266, 266, 267, 268, 268, 268, 270, 270, 272, 272, 274, 275, 276, 278, 282, 283, 284, 284, 287, 288, 291, 292, 296, 299, 301, 301, 307, 308, 309, 311, 312, 312, 312, 312, 312, 312, 312, 311, 311, 310, 310, 310, 312, 313, 315, 321, 324, 327, 331, 337, 338, 339, 340, 340, 341, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 343, 344, 344, 344, 345, 345, 346, 348, 349, 350, 353, 355, 355, 356, 357, 368, 371, 379, 383, 386, 389, 394, 396, 399, 402, 402, 402, 401, 399, 402, 404, 401, 401, 402, 402, 402, 403, 404, 408, 413, 419, 429, 432, 434, 454, 456, 456, 463, 462, 463, 463, 462, 458, 455, 453, 444, 440, 434, 429, 424, 419, 411, 407, 407, 408, 407, 407, 405, 404, 404, 403, 404, 405, 403, 395, 391, 382, 374, 369, 366, 362, 358, 354, 347, 343, 339, 338, 338, 338, 337, 337, 337, 334, 330, 321, 315, 306, 307, 308, 309, 302, 297, 288, 283, 279, 272, 266, 260, 259, 259, 259, 259, 259, 258, 256, 247, 244], 'all_points_y': [281, 284, 285, 285, 285, 285, 283, 282, 281, 280, 278, 278, 277, 276, 275, 274, 268, 265, 263, 262, 262, 262, 261, 261, 261, 261, 261, 261, 261, 262, 262, 262, 262, 264, 264, 264, 264, 265, 265, 266, 266, 269, 271, 271, 271, 271, 270, 270, 269, 268, 266, 265, 263, 261, 259, 257, 254, 253, 251, 249, 247, 244, 244, 243, 243, 245, 248, 250, 249, 248, 244, 242, 239, 238, 235, 233, 231, 230, 229, 226, 224, 224, 222, 221, 220, 218, 216, 215, 212, 210, 209, 207, 206, 204, 204, 204, 203, 204, 205, 206, 207, 217, 220, 224, 227, 228, 229, 231, 232, 233, 236, 238, 239, 242, 247, 261, 271, 282, 284, 285, 285, 289, 291, 293, 297, 296, 292, 292, 291, 292, 302, 303, 304, 304, 301, 301, 299, 298, 299, 298, 297, 293, 291, 289, 287, 287, 289, 294, 287, 275, 269, 263, 258, 254, 248, 245, 243, 238, 235, 233, 227, 226, 222, 218, 213, 210, 206, 204, 201, 202, 204, 217, 221, 225, 229, 233, 240, 243, 245, 244, 241, 235, 245, 249, 257, 264, 269, 266, 262, 261, 260, 258, 259, 263, 267, 268, 270, 272, 273, 277, 280, 282, 281]}, {'name': 'polyline', 'all_points_x': [277, 275, 275, 276, 276, 276, 273, 272, 268, 265, 264, 264, 264, 263, 263, 263, 263, 264, 265, 268, 271, 272, 272, 259, 258, 255, 253, 253, 256, 256, 260, 261, 264, 270, 270, 268, 265, 264, 262, 261, 261, 261, 263, 265, 270, 274, 275, 273, 273, 275, 275, 277, 277], 'all_points_y': [258, 256, 252, 247, 244, 241, 240, 239, 239, 238, 236, 230, 229, 225, 218, 214, 211, 209, 209, 208, 208, 207, 203, 188, 184, 180, 180, 180, 182, 185, 193, 194, 198, 205, 205, 206, 206, 206, 207, 211, 213, 231, 237, 240, 241, 243, 244, 249, 254, 258, 258, 259, 258]}, {'name': 'polyline', 'all_points_x': [137, 137, 140, 142, 144, 147, 149, 151, 152, 153, 154, 159, 159, 162, 163, 163, 163, 163, 164, 165, 165, 166, 166, 167, 167, 167, 169, 169, 170, 170, 171, 171, 172, 174, 173, 173, 175, 176, 175, 175, 174, 174, 175, 176, 178, 178, 178, 180, 182, 183, 184, 186, 184, 183, 184, 188, 191, 191, 192, 192, 191, 188, 187, 185, 184, 183, 182, 180, 179, 178, 178, 177, 176, 175, 173, 171, 170, 169, 169, 169, 167, 167, 166, 165, 165, 164, 163, 162, 162, 160, 159, 158, 156, 154, 153, 151, 148, 147, 146, 145, 144, 141, 139, 139, 138, 137, 136], 'all_points_y': [317, 314, 314, 314, 314, 312, 313, 313, 313, 311, 310, 313, 313, 314, 313, 313, 312, 312, 312, 312, 313, 314, 315, 316, 317, 317, 318, 318, 318, 318, 317, 315, 314, 315, 316, 316, 317, 317, 316, 314, 313, 312, 311, 312, 313, 314, 315, 316, 315, 314, 313, 312, 310, 309, 308, 309, 310, 310, 310, 310, 308, 308, 308, 307, 307, 312, 313, 313, 313, 312, 311, 310, 310, 310, 310, 312, 312, 312, 313, 314, 314, 313, 312, 311, 310, 310, 310, 310, 310, 312, 312, 310, 308, 309, 310, 311, 311, 311, 312, 312, 312, 312, 312, 312, 312, 312, 315]}, {'name': 'polyline', 'all_points_x': [211, 209, 207, 205, 207, 208, 210, 212, 214, 210, 210, 208, 207, 207, 206, 205, 206, 207, 207, 207, 207, 206, 205, 203, 204, 207, 209, 209, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 219, 220, 214, 213, 211], 'all_points_y': [290, 291, 293, 292, 288, 288, 289, 288, 287, 285, 284, 284, 283, 282, 283, 282, 280, 280, 279, 277, 276, 276, 276, 275, 274, 274, 272, 270, 271, 273, 274, 274, 276, 278, 278, 280, 280, 281, 282, 283, 283, 292, 291, 290]}, {'name': 'polyline', 'all_points_x': [235, 235, 233, 232, 233, 233, 235, 235, 235, 236, 238, 239, 239, 240, 241, 242, 243, 243, 243, 243, 241, 241, 240, 238, 238, 237, 237, 237, 236, 235, 235], 'all_points_y': [268, 268, 270, 271, 272, 273, 275, 276, 277, 278, 280, 281, 282, 282, 282, 283, 283, 284, 282, 280, 278, 278, 277, 275, 274, 271, 270, 270, 269, 268, 268]}, {'name': 'polyline', 'all_points_x': [370, 370, 371, 370, 370, 368, 368, 368, 368, 367, 365, 363, 361, 361, 360, 358, 360, 363, 364, 369, 371, 371, 373, 373, 374, 375, 377, 378, 378, 377, 376, 375, 375, 374, 373, 372, 372, 371, 371, 370], 'all_points_y': [386, 388, 390, 392, 392, 392, 390, 389, 389, 389, 390, 391, 395, 398, 399, 399, 401, 401, 401, 402, 402, 399, 396, 395, 394, 394, 392, 392, 392, 391, 390, 390, 390, 389, 389, 388, 387, 387, 387, 387]}, {'name': 'polyline', 'all_points_x': [377, 376, 375, 375, 376, 377, 379, 380, 381, 384, 386, 386, 389, 390, 390, 392, 394, 394, 395, 395, 399, 402, 404, 406, 406, 407, 407, 407, 408, 408, 408, 407, 408, 409, 412, 409, 409, 410, 410, 409, 408, 406, 405, 404, 403, 402, 402, 400, 399, 397, 397, 396, 396, 396, 396, 394, 392, 389, 387, 383, 381, 379, 378, 377], 'all_points_y': [375, 376, 378, 380, 382, 383, 383, 382, 382, 384, 384, 383, 381, 380, 379, 380, 380, 383, 385, 386, 391, 392, 394, 396, 397, 397, 399, 401, 401, 404, 405, 406, 407, 409, 408, 408, 405, 404, 401, 399, 397, 394, 393, 392, 391, 391, 389, 388, 387, 386, 385, 384, 382, 380, 379, 377, 377, 375, 374, 376, 375, 375, 375, 375]}], 'num_ids': []} Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt class_ids = class_ids[_idx] TypeError: only integer scalar arrays can be converted to a scalar index
Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt class_ids = class_ids[_idx] TypeError: only integer scalar arrays can be converted to a scalar index multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 641, in next_sample return six.next(_SHARED_SEQUENCES[uid]) File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1265, in load_image_gt class_ids = class_ids[_idx] TypeError: only integer scalar arrays can be converted to a scalar index """
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "mineria.py", line 392, in
train(model)
File "mineria.py", line 228, in train
layers='heads')
File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 2374, in train
File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, *kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1658, in fit_generator
initial_epoch=initial_epoch)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_generator.py", line 181, in fit_generator
generator_output = next(output_generator)
File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 733, in get
six.reraise(sys.exc_info())
File "/usr/local/lib/python3.6/dist-packages/six.py", line 693, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 702, in get
inputs = future.get(timeout=30)
File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
TypeError: only integer scalar arrays can be converted to a scalar index`
Someone can help me, I have spent several time to fix this error but I don't know how to solve it.