# What does Predict for neural network give back?

1 visualizzazione (ultimi 30 giorni)
Zehao Pan il 22 Apr 2021
Commentato: Zehao Pan il 24 Apr 2021
I'm built a unet for segmentation purpose. I trained the network and now want test the accuracy of the network. For training I randomly extracted 32x32 patches with randomPatchExtractionDatastore. For testing I split the input image into ordered 32x32, so 516x516 images was split into 256 32x32 images. Then I run the following code
testdata = imageDatastore(testDir);
predictPatchSize = [32 32];
net = net.net;
YPred = predict(net,testdata);
And the result it give back to me is a 4D array of 32x32x2x516.
Now I get the 32x32 because that's the size of my images. the 516 is how many images I put in and now many I get out. However the 2 is confusing me and I can't extract out the 516 images to rebuild back into a 516x516 image to compare to the grand truth mask I have to see how accurate the network is. Anyone have any idea on this problem?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Jon Cherrie il 23 Apr 2021
I think that Ypred(i,j,k,n) is the score for class k for pixel i,j of the n-th image.
Often the score is the probability or similar. So you can think of this as the probability the pixel i,j of the n-th image is in class k.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Zehao Pan il 24 Apr 2021
Hmm but I'm trying to segment the image. Like it should just be giving me back just the mask of the area that suppose to be segmented?
Hmmm oh I see my mask has 2 class like either the background or the thing I'm trying ot find. So reason it has 2 probability is because there are 2 things it could be. So I would need to compare them to see which one is more likely and just set it myself?

Accedi per commentare.

### Categorie

Scopri di più su Semantic Segmentation in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by