def test_right(self): OUTPUT = "C:\\myWork\\00_python\\output\\tmp\\unittest\\" (x, t) = gd.get_testdata_choiced(1) y = de.right(x[0], 4, 28) png.to_png(y, OUTPUT + "right", 28, 28) print(x) print(y)
def test_downto(self): OUTPUT = "C:\\myWork\\00_python\\output\\tmp\\unittest\\" (x, t) = gd.get_testdata_choiced(1) y = de.downto(x[0], 2, 28) png.to_png(y, OUTPUT + "downto", 28, 28) print(x) print(y)
def save_test(size, output_path): test_size = 10000 if (size <= 0): size = 1 if (size >= test_size): (xx, xt) = mt.get_testdata() else: (xx, xt) = mt.get_testdata_choiced(size) for i in range(len(xx)): # PNGファイル変換 to_png(xx[i], output_path + str(i + 1) + "_lv_" + str(xt[i]) + "_test.png", 28, 28)
def test_all(self): OUTPUT = "C:\\myWork\\00_python\\output\\tmp\\unittest\\" (x, t) = gd.get_testdata_choiced(1) png.to_png(x, OUTPUT + "orign02", 28, 28) y1 = de.downto(x[0], 4, 28) png.to_png(y1, OUTPUT + "downto02", 28, 28) y2 = de.upto(x[0], 4, 28) png.to_png(y2, OUTPUT + "upto02", 28, 28) y3 = de.left(x[0], 4, 28) png.to_png(y3, OUTPUT + "left02", 28, 28) y4 = de.right(x[0], 4, 28) png.to_png(y4, OUTPUT + "right02", 28, 28) y5 = de.rotate90(x[0], 28) png.to_png(y5, OUTPUT + "rotate90_02", 28, 28) y6 = de.rotate180(x[0], 28) png.to_png(y6, OUTPUT + "rotate180_02", 28, 28) y7 = de.rotate270(x[0], 28) png.to_png(y7, OUTPUT + "rotate270_02", 28, 28) y8 = de.noise(x[0], 4, 28) png.to_png(y8, OUTPUT + "noise02", 28, 28)
def test_test_choiced(self): (xt, xl) = gd.get_testdata_choiced(10) print(xt.shape) self.assertEquals(xt.shape[0], 10) self.assertEquals(xt.shape[1], 784)