Closed shubhashis-k closed 8 years ago
First, as pointed out by @andreaskoepf on gitter, you must use torch.eq for an element-wise comparison (or equal if you use a version >= torch/torch7@ad65230).
That said i1
is a double tensor with range on [0, 255]:
> i1:type()
torch.DoubleTensor
> i1:min()
0
> i1:max()
247
With such a range you must convert it back to a byte tensor before saving, otherwise it will be saturated which is not what you want. In other words do:
i1 = testData.data[2]:byte()
image.save("1.png", i1)
Then:
i2 = image.load("1.png", 3, "byte")
if i1:eq(i2):all() then print("same") end
can you not post the same question at three different places (gitter, github issues and stackoverflow), as is we spend a lot of time helping out people, we cant spend 3x the time because you were creative.
I am using CIFAR-10 dataset. Simply I fetched data for an image from CIFAR-10 and then saved it in my directory. When I loaded that saved image, it was different.
Is this behavior expected? If so how this can be corrected?
Code for loading CIFAR-10 dataset