Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate invalid use of ground truth which leads to improved performances #23

Open
NathanMolinier opened this issue Jun 26, 2023 · 6 comments
Labels
invalid This doesn't seem right

Comments

@NathanMolinier
Copy link
Collaborator

NathanMolinier commented Jun 26, 2023

Description

Recently, I noticed that the post processing function applied during testing: extract_skeleton, used some information from the labels to know how many intervertebral discs were present in the image. Therefore, by doing this the performances of the hourglass are biased and less subject to false detection.

INVALID step: Images with a discs number higher than the number of discs the hourglass was trained to find were also removed from the testing and the training.

Conclusion

Further investigation need to be done in the function extract_skeleton and in create_skeleton to see how this post processing function could be improved/fixed to increase fairly the hourglass performances.

@NathanMolinier NathanMolinier added the invalid This doesn't seem right label Jun 26, 2023
@NathanMolinier NathanMolinier changed the title Investigate the skeleton file Investigate the skeleton related functions Jun 26, 2023
@NathanMolinier
Copy link
Collaborator Author

NathanMolinier commented Jun 26, 2023

By removing this ground truth use, I noticed that some issues and false detections started to appear. Indeed, one problem is that some classes corresponding to unseen discs during training are detected which is causing errors in the skeleton reconstruction. Here is an example of a mask returned by the hourglass network corresponding to the disc 15 which is not present in the training set.

Capture d’écran 2023-06-26 à 17 09 37

To further investigate these random generated masks, I will investigate the input training masks.

@NathanMolinier
Copy link
Collaborator Author

The best approach to avoid such false detections seems to be to reduce the number of class. Indeed, if we look at the spinegeneric dataset,

For T1w images:
T1w_distribution

For T2w images:
T2w_distribution

@jcohenadad
Copy link
Member

But the spine-generic dataset should not be used as an absolute representation of scans around the world. Some hospitals acquire only 4-5 vertebrae, others acquire 10-15. There is no general rule about the number of discs to expect in one MRI scan unfortunately.

@NathanMolinier
Copy link
Collaborator Author

Yes I agree, but I still need to choose a relevant number of class for the training to limit false detections caused by under-represented discs.

Moreover, I might need to rewrite some functions to handle images with a different FOV.

@NathanMolinier
Copy link
Collaborator Author

NathanMolinier commented Jun 30, 2023

The hourglass is performing poorly on new datasets when trained only on the spinegeneric dataset. Indeed, for most of the discs, several predictions are created. Further investigation need to be done regarding input parameters (resolution, FOV...) to detect potential differences in the input data.

Other solution: Retrain the hourglass network with more data

Number of predictions for each of the 11 classes (discs) followed by the number of combinations possible.
Capture d’écran 2023-06-30 à 12 46 18

@NathanMolinier NathanMolinier changed the title Investigate the skeleton related functions Investigate invalid use of ground truth which leads to improved performances Jun 30, 2023
@NathanMolinier
Copy link
Collaborator Author

I just noticed that the loss was only computed on non-empty GT masks resulting to a lot of false positive prediction.

if self.use_target_weight:
loss += 0.5 * self.criterion(
heatmap_pred.mul(target_weight[:, idx]),
heatmap_gt.mul(target_weight[:, idx])
)
else:
loss += 0.5 * self.criterion(heatmap_pred, heatmap_gt)

This feature should be removed, however, for now I will just set the variable use_target_weight to False.

class JointsMSELoss(nn.Module):
def __init__(self, use_target_weight=True):
super(JointsMSELoss, self).__init__()
self.criterion = nn.MSELoss(reduction='mean')
self.use_target_weight = use_target_weight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants