From dbbed675efe5ae5e7859106519de8a69947f0766 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 15 Jul 2022 17:52:40 +0200 Subject: [PATCH] Update. --- picoclvr.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/picoclvr.py b/picoclvr.py index 6dd8114..26f53ab 100755 --- a/picoclvr.py +++ b/picoclvr.py @@ -90,6 +90,8 @@ def all_properties(height, width, nb_squares, square_i, square_j, square_c): return s +###################################################################### + def generate(nb, height = 6, width = 8, max_nb_squares = 5, max_nb_statements = 10, many_colors = False): @@ -152,13 +154,12 @@ def descr2img(descr, height = 6, width = 8): if __name__ == '__main__': descr = generate(nb = 5) - for d in descr: - print(d) - print() - img = descr2img(descr) - print(img.size()) + with open('picoclvr_example.txt', 'w') as f: + for d in descr: + f.write(f'{d}\n\n') + img = descr2img(descr) torchvision.utils.save_image(img / 255., 'picoclvr_example.png', nrow = 16, pad_value = 0.8) -- 2.39.5