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