MCPcopy
hub / github.com/matterport/Mask_RCNN / load_shapes

Method load_shapes

shapes.py:62–80  ·  view source on GitHub ↗

Generate the requested number of synthetic images. count: number of images to generate. height, width: the size of the generated images.

(self, count, height, width)

Source from the content-addressed store, hash-verified

60 """
61
62 def load_shapes(self, count, height, width):
63 """Generate the requested number of synthetic images.
64 count: number of images to generate.
65 height, width: the size of the generated images.
66 """
67 # Add classes
68 self.add_class("shapes", 1, "square")
69 self.add_class("shapes", 2, "circle")
70 self.add_class("shapes", 3, "triangle")
71
72 # Add images
73 # Generate random specifications of images (i.e. color and
74 # list of shapes sizes and locations). This is more compact than
75 # actual images. Images are generated on the fly in load_image().
76 for i in range(count):
77 bg_color, shapes = self.random_image(height, width)
78 self.add_image("shapes", image_id=i, path=None,
79 width=width, height=height,
80 bg_color=bg_color, shapes=shapes)
81
82 def load_image(self, image_id):
83 """Generate an image from the specs of the given image ID.

Callers

nothing calls this directly

Calls 3

random_imageMethod · 0.95
add_classMethod · 0.80
add_imageMethod · 0.80

Tested by

no test coverage detected