Function to predict probability

hy every one, i have a question please:
first excuse me if i write with mistakes, because i dont speak english
I have annotatated image data, where i have the objects within the images and informations about it’s positions and classes. I want to use neural network to predict probabilities of each pixel in the image if it is corner of a box containing an object. I want to know if it is possible with neural network, and if there is function in pytorch that can help in the process.

You want to predict a probability for each pixel in the image (of whether it is corner of box) ? For that one would need to output a tensor that is of the same shape as the input (image) and that the last activation should be sigmoid (as it squishes the values to between 0 and 1). You can look up UNet for that.
Also, if I have understood correctly, you want to detect objects (it’s location) in the image, for that there are many pre-trained models available in pytorch Object Detection Models in Pytorch

thanks for your reply. Yes i want to detect the postion of object within the image.
if i inderstand i must give the network the coordinates of boxes and the image and it will predict the probabilities. but witch neural network should i use (VGG, Alexnet…) or i must create my one neural network?

You can incorporate any pre-trained classification model like (VGG, Alexnet, resnet, etc.) as an encoder and build the corresponding decoder. There is a good pytorch library for this Pytorch Segmentation Models

thank you very mutch

I was asking the last time, if we can use neural network to predict if each pixel in an image is a corner of a box. I want to know
1- if this code is correct or not:
2- whene i got the probabilities, how can i distinct the probability of the top left corner from the probability of bottom right corner or the auther
image input_size = 512

import torch
import torch.nn as nn
import torch.nn.functional as F
class corner_predict(nn.Module):
dim_out = 512*3 (3 if the pixel is Top left corner, bottom right corner, auther)
self.base_conv = nn.conv2D(512, 512, 3, 1, 1, bias=True)
self.class_pred = nn.conv2D( 512, dim_out, 1, 1, 0)
self.class_loss = 0
def forward (image, bbox):
conv1 = F.relu(self.base_conv(image), inplace=True)
conv2 = self.class_pred(conv1)
prob_corner = F.sigmoid(conv2)
------- loss calculations