Datastore Mask R-CNN for kidney segmentation

I have
  • several CT images 512x512 with normalized values between 0 and 1. Basically 2dimensional black white images
  • Kidney labels for each images with 0 or 1
  • for each image 2 boxes with x,y,height, width (for each kidney of the human)
  • and the labels I could generate (always 'kidney' I guess?)
How do I generate a datastore to train the network, as described here under "Create Datastore":
They convert it somehow from some MAT files with some custom function, hence I do not know how to assemble my own training data into a data store

 Accepted Answer

Hi,
Please read the "Create Datastore that Reads Data" section from the following documentation.
You can also read Datastores for deep learning for more understanding.
Hope this helps!

3 Comments

I have trouble understanding the needed sizes. I managed to put up a datastore but got following error:
Error using trainMaskRCNN
[net,info] = trainMaskRCNN(ds,net,options,FreezeSubNetwork="backbone");
Invalid argument at position 1. Expected input number 1, trainingData, to be of size 1x4, but it is of size 97x4.
Error in maskRcnnTest (line 25)
[net,info] = trainMaskRCNN(ds,net,options,FreezeSubNetwork="backbone");
As 1 CT Image consists of several images/slides and I used 1 CT image with 97 slieds, I have a 97x4 ds.
Nevertheless trainMaskRCNN expects 1x4 ? How is a network supposed to train on 1 image alone ?
Part of my ds preview:
ans =
97×4 cell array
{512×512 double} {0×0 double } {0×0 double} {512×512×2 logical}
{512×512 double} {0×0 double } {0×0 double} {512×512×2 logical}
{512×512 double} {0×0 double } {0×0 double} {512×512×2 logical}
{512×512 double} {0×0 double } {0×0 double} {512×512×2 logical}
{512×512 double} {0×0 double } {0×0 double} {512×512×2 logical}
{512×512 double} {[52 226 25 25]} {'kidney' } {512×512×2 logical}
{512×512 double} {[47 212 38 35]} {'kidney' } {512×512×2 logical}
{512×512 double} {2×4 double } {2×6 char } {512×512×2 logical}
{512×512 double} {2×4 double } {2×6 char } {512×512×2 logical}
{512×512 double} {2×4 double } {2×6 char } {512×512×2 logical}
I think you are not preparing the data properly.
Try to prepare the boxLabelDatastore properly. You can check the examples here : link
Then try to create combine the image datastore and box label datastore.
Thank you for your help!
I have a more concrete question regarding the image datastore and made a seperate question!
But you put me on the right track, lots of thanks!

Sign in to comment.

More Answers (0)

Asked:

on 2 Apr 2022

Commented:

on 11 Apr 2022

Community Treasure Hunt

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

Start Hunting!