How can I fix an index error in my code for training a semantic segmentation network?
3 次查看(过去 30 天)
显示 更早的评论
I tweaked the existing semantic segmentation example so that I could use my own annotations and images. However, every time I run the code, I keep getting an error that an index of some sort is out of bounds (<=59 to be exact, see the screenshot attached). I traced the stack and found that the number of annotations was 59, while the number of images was 60. I was able to find that I had not annotated one of the images. After fixing this and reexporting the ground truth file, the index error was now <=60. I have attached my code and the groundTruth file I exported from the MATLAB imageLabeler tool. I was wondering if there is an index or list somewhere that I am missing. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1702366/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1702366/image.png)
2 个评论
Sai Pavan
2024-5-27
Please provide the dataset i.e., both the images and the labels so that we can run the modified example file as the "gTruth_fixed" MAT file only contains the path to images and not the images themselves.
回答(1 个)
Sachin Lodhi
2024-6-14
Hi Lamine,
I have identified the cause of the error you are encountering during the training of your semantic segmentation network. It appears that the 'groundTruth' file created with the MATLAB Image Labeler App contains labels for only up to 60 images. This discrepancy arises because the 'groundTruth' file was generated using just 60 images, but the total number of original images in your dataset are 120. In 'partitionCamVidData' function 'shuffledIndices' are a random permutation of indices from 1 to 120. Consequently, 'trainingIdx', 'valIdx' and 'testIdx' can have values greater than 60. Partiioning the ground truth data using these set of indices is not possible as it only has 60 labelled images.
To rectify this issue, you could either:
- Extend the groundTruth file to encompass all 120 images by utilizing the MATLAB Image Labeler App.
- Only include those 60 images in the image data which corresponds to the labelled images in ground truth.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!