changeFilePaths function not working, all files are returned as unresolved paths

5 ビュー (過去 30 日間)
Heather Riley
Heather Riley 2019 年 9 月 17 日
コメント済み: Heather Riley 2019 年 9 月 17 日
I am using a ground truth object to store segmentation labels. I have a folder containing my images, the ground truth object, and the PixelMapLabels folder. I have moved this folder to a new directory and in order to get my matlab code to use the ground truth object in the new directory I need to change its file paths with the changeFilePaths(gTruth, alter_paths) function.
Below is my code:
% Set datapath
datapath = '/scratch/qbi/uqhrile1';
training_datapath = strcat(datapath,'/training_dataset');
% Get training and testing datasets
training_dataset = imageDatastore(strcat(training_datapath,'/images_rgb'));
% Change pixel map label datapath
load(strcat(training_datapath,'/pixel_maps/eye_segmentation_labels.mat'));
old_data_source = 'D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels';
new_data_source = strcat(training_datapath,'/labels');
old_pixellabel_path = 'D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\pixel_maps\PixelLabelData';
new_pixellabel_path = strcat(training_datapath,'/pixel_maps/PixelLabelData');
alter_paths = {[old_data_source new_data_source];[old_pixellabel_path new_pixellabel_path]};
unresolved_paths = changeFilePaths(gTruth,alter_paths)
Here is the output (I won't include all of it because it's a very long list of filenames):
[Warning: The data source points to one or more image files that cannot be
found. Update the DataSource filenames using <a
href="matlab:doc('changeFilePaths')">changeFilePaths</a> method.]
[> In groundTruth>checkImageFilenames (line 1375)
In groundTruth/checkIfSourceExists (line 1123)
In groundTruth.loadobj (line 988)
In segmentation_neural_network (line 21)]
unresolved_paths =
200x1 string array
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_106520_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_107415_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_107535_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_107590_segmentated.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_108070_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_108415_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_109390_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_110360_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_110380_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_111345_segmented.tif"
Etcetera. I know that the issue is not the difference between backslash (\) and slash (/) - the reason why the old pathways use slash and the new pathways use backslash is because I am moving my code and dataset from Windows to Linux.
Can anyone tell me why all of the pathways I am trying to change are coming back as unresolved?
  1 件のコメント
Heather Riley
Heather Riley 2019 年 9 月 17 日
Update: Based on my understanding of changePathFiles an unresolved path is a file that MATLAB couldn't locate in the new pathway.
I used
if exists(strcat(training_datapath,'/pixel_maps/PixelLabelData'), 'dir')
to check whether the folders for the new pathways could be found by MATLAB, and they could, so I'm not sure what the issue is.

サインインしてコメントする。

回答 (0 件)

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by