X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=pysvrt.git;a=blobdiff_plain;f=test-svrt.py;h=ad3677a97e69d181a25d7035317e4c9085ad5ad2;hp=6b5f8264c28ca8ad63abcc930d521933863ee83c;hb=HEAD;hpb=44bd6cf57f00009c7049dcd3e5600f12f2f41de5 diff --git a/test-svrt.py b/test-svrt.py index 6b5f826..ad3677a 100755 --- a/test-svrt.py +++ b/test-svrt.py @@ -19,7 +19,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with selector. If not, see . +# along with svrt. If not, see . import time @@ -34,12 +34,19 @@ from torch.nn import functional as fn from torchvision import datasets, transforms, utils -from _ext import svrt +import svrt -train_set = svrt.generate_vignettes(12, 64) +labels = torch.LongTensor(12).zero_() +labels.narrow(0, 0, labels.size(0)//2).fill_(1) -print(str(type(train_set)), train_set.size()) +x = svrt.generate_vignettes(4, labels) -train_set.div_(255) +print('compression factor {:f}'.format(x.storage().size() / svrt.compress(x.storage()).size())) -torchvision.utils.save_image(train_set.view(train_set.size(0), 1, train_set.size(1), train_set.size(2)), 'example.png') +x = x.view(x.size(0), 1, x.size(1), x.size(2)) + +x.div_(255) + +torchvision.utils.save_image(x, 'example.png') + +print('Wrote example.png')