예제 #1
0
def main_show():
    import matplotlib.pyplot as plt
    rng = np.random.RandomState(1)
    coords = prototype_coords(rng)
    img = render_coords(coords)
    img3 = render_coords(distort(coords, '3', rng))
    img6 = render_coords(distort(coords, '6', rng))
    plt.imshow(np.asarray([img, img3, img6]).T,
               cmap='gray',
               interpolation='nearest')
    plt.show()
예제 #2
0
파일: main.py 프로젝트: Afey/skdata
def main_show():
    import matplotlib.pyplot as plt
    rng = np.random.RandomState(1)
    coords = prototype_coords(rng)
    img = render_coords(coords)
    img3 = render_coords(distort(coords, '3', rng))
    img6 = render_coords(distort(coords, '6', rng))
    plt.imshow(np.asarray([img, img3, img6]).T,
               cmap='gray',
               interpolation='nearest')
    plt.show()
예제 #3
0
 def distortion_set(self, N, coords, level, rng):
     images = []
     labels = []
     assert len(coords) == self.n_prototypes
     for proto, coord in enumerate(coords):
         # --apply the same distortions to each example
         rng_copy = copy.deepcopy(rng)
         for i in range(N):
             dcoord = distort(coord, level, rng_copy)
             img = render_coords_uint8_channels(dcoord)
             images.append(img)
             labels.append(proto)
     rng.seed(int(rng_copy.randint(2**30)))
     return np.asarray(images), np.asarray(labels)
예제 #4
0
파일: view.py 프로젝트: Afey/skdata
 def distortion_set(self, N, coords, level, rng):
     images = []
     labels = []
     assert len(coords) == self.n_prototypes
     for proto, coord in enumerate(coords):
         # --apply the same distortions to each example
         rng_copy = copy.deepcopy(rng)
         for i in range(N):
             dcoord = distort(coord, level, rng_copy)
             img = render_coords_uint8_channels(dcoord)
             images.append(img)
             labels.append(proto)
     rng.seed(int(rng_copy.randint(2**30)))
     return np.asarray(images), np.asarray(labels)