Update with information about the convnets.
[pysvrt.git] / README.md
1 # Introduction #
2
3 This is the port of the Synthetic Visual Reasoning Test to the pytorch
4 framework.
5
6 The main function is
7
8 ```
9 torch.ByteTensor svrt.generate_vignettes(int problem_number, torch.LongTensor labels)
10 ```
11
12 where
13
14  * `problem_number` indicates which of the 23 problem to use
15  * `labels` indicates the boolean labels of the vignettes to generate
16
17 The returned ByteTensor has three dimensions:
18
19  * Vignette index
20  * Pixel row
21  * Pixel col
22
23 # Installation and test #
24
25 Executing
26
27 ```
28 make -j -k
29 ./test-svrt.py
30 ```
31
32 should generate an image example.png in the current directory.
33
34 Note that the image generation does not take advantage of GPUs or
35 multi-core, and can be as fast as 10,000 vignettes per second and as
36 slow as 40 on a 4GHz i7-6700K.
37
38 # Vignette compression #
39
40 The two additional functions
41
42 ```
43 torch.ByteStorage svrt.compress(torch.ByteStorage x)
44 ```
45
46 and
47
48 ```
49 torch.ByteStorage svrt.uncompress(torch.ByteStorage x)
50 ```
51
52 provide a lossless compression scheme adapted to the ByteStorage of
53 the vignette ByteTensor (i.e. expecting a lot of 255s, a few 0s, and
54 no other value).
55
56 This compression reduces the memory footprint by a factor ~50, and may
57 be usefull to deal with very large data-sets and avoid re-generating
58 images at every batch. It induces a little overhead for decompression,
59 and moving from CPU to GPU memory.
60
61 See vignette_set.py for a class CompressedVignetteSet using it.
62
63 # Testing convolution networks #
64
65 The file
66
67 ```
68 cnn-svrt.py
69 ```
70
71 provides the implementation of two deep networks, and use the
72 compressed vignette code to allow the training with several millions
73 vignettes on a PC with 16Gb and a GPU with 8Gb.
74
75 The networks were designed by Afroze Baqapuri during an internship at
76 Idiap.