For concatenating two images from CIFAR10 (Classnumber=10), what can be equal of these two lines in PyTorch?
tf.placeholder(tf.float32, [None, 32*2, 32, 3], 'input'),
tf.placeholder(tf.float32, [None, Classnumber*2], 'label')
For concatenating two images from CIFAR10 (Classnumber=10), what can be equal of these two lines in PyTorch?
tf.placeholder(tf.float32, [None, 32*2, 32, 3], 'input'),
tf.placeholder(tf.float32, [None, Classnumber*2], 'label')
hmmm… I dont know for sure this line in tensorflow. Its better if you explain the meaning of that line first, so another people that does not have experience in tensorflow can give you solution.
But anyway, for concate a tensor or image you can use
torch.cat([image_tensor1, image_tensor2])
This is the example
image_batch1 = torch.rand(16,3,32,32)
image_batch2 = torch.rand(16,3,32,32)
cat1 = torch.cat([image_batch1, image_batch2], dim=0)
print(cat1.shape)
# result is torch.Size([32, 3, 32, 32])
cat2 = torch.cat([image_batch1, image_batch2], dim=1)
print(cat2.shape)
# result is torch.Size([16, 6, 32, 32])
Thank you for your reply @nunenuh. In the examples, you are changing batch_size or number of channels. But the one that I am looking for is changing the 3x32x32 image to 3x64x32 (this is the first line of that code) on the CIFAR10 data, and the second line of code is giving the labels corresponding to these images, meaning instead of 1x10 label, now we have 2x10 labels. Overall, I want to put two images beside each other by considering their labels.