Problem about pix2pixHD

I was wondering when author convert instance map into boundary map, why is there a third dimension in instance tensor? why use bound[:,:,1:] to calculate boundary?instance map should be a two dimensional map,right?

Hi Gemini_vi!

That’s because the tensor is of the shape : (index, width, height) [For a 2D instance image] and a color image say RGB image would be of the form (index, width, height, channels).

Regards,
Nithin

Thank you, but I still don’t quiet follow, if numpy image is in shape of i,w,h after it converted to tensor it still has the shape of i,w,h? but input of tensor should be b,c,w,h? and what is this index dimension stands for? does it stands for instance classes? I thought one image only have one instance map?

Thank you, but I still don’t quiet follow, if numpy image is in shape of i,w,h after it converted to tensor it still has the shape of i,w,h? but input of tensor should be b,c,w,h? and what is this index dimension stands for? does it stands for instance classes? I thought one image only have one instance map?

When we access the dataset through the data-loaders, fundamentally the array of tensors has a shape like this :

Let’s say we have 1000 images each of size 256*256 (1 channel) in the folder and I load the data into a tensor called ‘data’ then the data[0,:,:] indicates the first image, data[1,:,:] indicates second image and so on. Here all the images in a batch are processed at the same time so the code might be of the form data[:,:,x:].

Hope this helps. If not feel free to post your queries.

Regards,
Nithin

I know that, but in this case, examples should be collection of all images in dataset,right? when you use examples[idx] to extract each image under getitem fucntion, and use Image.open it, each example should be only one image which has one instance map and one label,right?

I know that, but in this case, examples should be collection of all images in dataset,right? when you use examples[idx] to extract each image under getitem fucntion, and use Image.open it, each example should be only one image which has one instance map and one label,right?