GithubHelp home page GithubHelp logo

How to get score? about 3dunetcnn HOT 8 CLOSED

changchun-zhou avatar changchun-zhou commented on August 17, 2024
How to get score?

from 3dunetcnn.

Comments (8)

ellisdg avatar ellisdg commented on August 17, 2024

You can get the dice score with a function like this:

def dice_coefficient(truth, prediction):
    return 2 * np.sum(truth * prediction)/(np.sum(truth) + np.sum(prediction))

from 3dunetcnn.

changchun-zhou avatar changchun-zhou commented on August 17, 2024

You can get the dice score with a function like this:

def dice_coefficient(truth, prediction):
    return 2 * np.sum(truth * prediction)/(np.sum(truth) + np.sum(prediction))

Thank you for your kind reply. Your framework is quite useful. I have two questions:

  1. According to your reply, I insert the function into the function _batch_loss like follows:
    `def _batch_loss(model, images, target, criterion, regularized=False, vae=False):
    output = model(images)
    batch_size = images.size(0)
    if regularized:
    try:
    output, output_vae, mu, logvar = output
    loss = criterion(output, output_vae, mu, logvar, images, target)
    except ValueError:
    pred_y, pred_x = output
    loss = criterion(pred_y, pred_x, images, target)
    elif vae:
    pred_x, mu, logvar = output
    loss = criterion(pred_x, mu, logvar, target)
    else:
    loss = criterion(output, target)

    score

    iflat = output.view(-1).float()
    tflat = target.view(-1).float()
    intersection = (iflat * tflat).sum()
    smooth = 0
    score = 2. * intersection + smooth)/(iflat.sum() + tflat.sum() + smooth)
    return loss, batch_size, scoreI want to check whether the score isMead dice` in Table 1, in your paper Trialing U-Net Training Modifications
    for Segmenting Gliomas Using Open Source Deep Learning Framework
    ?
    image

  2. Can you provide some experimental results of IoU?

  3. Can this framework be used for general segmentation datasets, such as ShapeNet? If yes, how to modify the framework?

I appreciate your help!

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 17, 2024
  1. Yes, the dice score should be consistent with the reported dice scores. However, those dice scores were computed on the validation set by the BRATS challenge organizers. I do not have access to their validation dataset.
  2. I have not calculated any IoU scores for my experiments.
  3. The way my framework operates is that it requires a "Sequence" or "Loader" that reads the input and target data from file and then passes it to the model for 3D data. The sequences that I have made read in NIFTI files which are designed for medical imaging. I'm not familiar with ShapeNet, but to get it to work you would need to either convert the data set to NIFTI format or create a custom sequence to load the data.

from 3dunetcnn.

changchun-zhou avatar changchun-zhou commented on August 17, 2024

Thank you! I have another question: Why is the number of channels different between images and target? To verify this, I print the shapes in epoch_training function:
for i, (images, target) in enumerate(train_loader): print("images.shape: ", images.shape) print("target.shape: ", target.shape)
output:
images.shape: [1, **4**, 112, 112, 112] target.shape: [1, **3**, 112, 112, 112]
As the output is shown, the image has 4 channels, but the target has 3 channels. I thought that both image and target have 3 channels meaning RGB. Could you explain why the image has an extra channel?
Thanks for your kindness.
@ellisdg

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 17, 2024

I assume you are referring to the BRATS dataset and model.
The input channels refer to separate MR acquisition parameters. They are T1 weighted (T1w), T1w with contrast enhancing agent, FLAIR, and T2 weighted.
The output channels refer to separate labeled regions: whole tumor, enhancing tumor, and necrotic core.

from 3dunetcnn.

changchun-zhou avatar changchun-zhou commented on August 17, 2024

Thank you! Do output channel [0], output channel [1], and output channel [2] represent WT, TC, and ET, respectively? Because I get the score of dice decreasing from channel [0] to channel [2].

I assume you are referring to the BRATS dataset and model. The input channels refer to separate MR acquisition parameters. They are T1 weighted (T1w), T1w with contrast enhancing agent, FLAIR, and T2 weighted. The output channels refer to separate labeled regions: whole tumor, enhancing tumor, and necrotic core.

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 17, 2024

Do output channel [0], output channel [1], and output channel [2] represent WT, TC, and ET, respectively?

Yes, that is correct.

from 3dunetcnn.

stale avatar stale commented on August 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are still wanting followup to this issue, please ping the thread by leaving a comment. You may also contact [email protected] with questions.

from 3dunetcnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.