How to grab intermediate feature maps to do deep supervision

Hello. I am doing a semantic segmentation task.I have super high resolution image and its corresponding mask.I downsampled the images so that the data could fit in the gpu memory. My network takes this downsampled image and output a score map. But there's more. My network keeps on upsampling to output a score map of the original super-high resolution. So how do I apply loss both between the intermediate score map and the down-sampled mask and the final score map and the orignal mask.(This is a technique called deep supervision)?
I read the document. There is "forward(dlNetwork)" function available. But that only supports one loss. I want the two loss combined together.

 Accepted Answer

3 Comments

I already checked these tutorials. They won't help. If I use layer, then there is only one data output. If I take care of the parameters myself and define model function,then everything is too messy. To be honest, it is really hard to customize using matlab.
The question is, when I build a layer graph, can I have multiple output.?And when I call forward, I get all of these outputs?
Refer to Multiple-Input and Multiple-Output Networks for defining network architectures with multiple outputs.
But in case of forward(dlnet), the document of dlnet = dlnetwork(lgraph) says that
"The layer graph must not contain output layers. When training the network, calculate the loss separately.
For a list of layers supported by dlnetwork, see Supported Layers."
Is there still no implementation of deep supervision?

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Asked:

on 27 Apr 2020

Commented:

RFC
on 14 Apr 2023

Community Treasure Hunt

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

Start Hunting!