<p>I guess what you're supposed to do is <a href="https://en.wikipedia.org/wiki/Image_segmentation" rel="nofollow noreferrer">image segmentation</a> and in the shape of the labels you got, the last dimension of 200 corresponds to 200 possible categories of pixels (that sounds like a lot to me, but without more context I cannot judge). The problem of image segmentation is <em>way</em> too broad to explain in an SO answer, but I suggest you check resources such as <a href="https://tuatini.me/practical-image-segmentation-with-unet/" rel="nofollow noreferrer">this tutorial</a> and check out the <a href="https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Long_Fully_Convolutional_Networks_2015_CVPR_paper.pdf" rel="nofollow noreferrer">influential</a> <a href="https://arxiv.org/pdf/1505.04597.pdf" rel="nofollow noreferrer">papers</a> in this field.</p>
Using CNN for pixel classification,how?
<p>I have already learn about some classification using CNN like for Mnist. But recently I received a dataset which is consist of a vector set. The normal image dataset(mnist) is like nxcxwxh. The one I received is (w*h)x1xc. The goal is to train a network to classify these pixels(as I understand,is classification for pixels). The label length is groundtruth picture.</p>

<p>I am a little confused about this work. As I understand, for Image processing, we use the CNN with different receiption feld to make the convolution operations so that a feature can be obtained to represent the image. But in this case, the image is already expand to pixel-set. Why is the convolutional neural network still suitable?</p>

<p>Still I am not sure about the work but I started to try.I used the 1d convolution instead of 2d in the network. After 4-Conv1d,the output is connected to a softmax layer then fed to crossentropy loss function. It seems, I have some problems with the output dimensions so the network is not able to train.</p>

<p>I use pytorch to implement the work. Below is the network form I try to build. The dimensions do not match those need for crossentropyloss function. 122500 was set to be the sample numbers. So I think the convolution was performed along the 1-200 directions.</p>

<p>First I want to know,is that right to implement like this using conv1d when I want to classify the pixels?</p>

<p>If this thought was right, how can I continue to feed the features to the loss function?</p>

<p>If this is wrong,can I have some similar examples for this kind of work? I am new to python, so if there were some stupid mistakes, pls point out.</p>

<p>Thanks all.</p>

<pre><code>class network(nn.Module):
"""
    Building network

"""
def __init__(self):
    super(network, self).__init__()
    self.conv1 = nn.Conv1d(in_channels = 1,out_channels = 32,stride = 1,kernel_size = 3)
    self.conv2 = nn.Conv1d(in_channels = 32,out_channels = 64,stride = 1,kernel_size = 3)
    self.conv3 = nn.Conv1d(in_channels = 64,out_channels = 128,stride = 1,kernel_size = 3)
    self.conv4 = nn.Conv1d(in_channels = 128,out_channels = 256,stride = 1,kernel_size = 3)
    self.fc = nn.Linear(13, 2)

def forward(self,s):
    s = self.conv1(s)
    s = F.relu(F.max_pool1d(s, 2)) 
    s = self.conv2(s)
    s = F.relu(F.max_pool1d(s, 2)) 
    s = self.conv3(s)
    s = F.relu(F.max_pool1d(s, 2)) 
    s = self.conv4(s)
    s = F.relu(F.max_pool1d(s, 2)) 

    s = self.fc(s)

    s = F.softmax(s,1)


output = model(input)
loss = loss_fn(output, labels)
</code></pre>