简体   繁体   中英

Mask for neural network training

I am training a neural network and I found a dataset of pictures taken by drones. It says that it has 20 classes that should be detected. However the masks all looks like this (I'm sorry the image is really dark:): This is my mask

When I try to train the network it always says that the image only has 3 channels. (I figured it was probably RGB). The problem is that my network expects a 20 channels input for the mask (one for each category to detect like tree, car, human, etc.) Is there a way for me to transform the image in a 20 channels image? I looked if the mask only had 20 different values for the pixel colors but it has 254 so I do not think there is something to do with that...

Thank you: (It is my first question on StackOverflow so if there is a problem in the question just tell me! :-) )

I am not sure I understand your question correctly but yes, there is a way to upsample the image to make it a 20 channel input. All you have to do is take the original image (lets assume its size is [batch, height, width, #channels] ) and convolve it with a kernel ( [#channels, height, width, 20] ) while keeping the padding mode 'same'. This would convert your 3 channel image into a 20 channel array (wouldn't call it an image anymore).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM