Skip to content

Commit

Permalink
Merge 4278198 into 0db4c9c
Browse files Browse the repository at this point in the history
  • Loading branch information
gheinrich committed Dec 23, 2015
2 parents 0db4c9c + 4278198 commit d69b31d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/torch/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,14 @@ function DBSource:lmdb_getSample(shuffle, idx)
y = image.decompress(x,msg.channels,'byte'):float()
else
x = x:narrow(1,1,total):view(msg.channels,msg.height,msg.width):float() -- using narrow() returning the reference to x tensor with the size exactly equal to total image byte size, so that view() works fine without issues
y = x -- make y see x's storage
if self.ImageChannels == 3 then
-- unencoded color images are stored in BGR order => we need to swap blue and red channels (BGR->RGB)
y = torch.FloatTensor(msg.channels,msg.height,msg.width)
y[1] = x[3]
y[2] = x[2]
y[3] = x[1]
else
y = x
end
end

Expand Down

0 comments on commit d69b31d

Please sign in to comment.