The imdsValidation in your code is an augmentedImageDatastore, it is used to apply transformations to imageDatastore and does not have a 'labels' field.
Instead, you can proceed in this manner.
//refer to code
Here we have seperated the imageDatastore and augmentedImageDatastore and we can access the labels by
YValidation = imdsValidation.Labels; i.e referring the labels field of imageDataStore.
Also, when training the model and making predictions, please use the newly created augmentedImageDatastores (augdsTrain, augdsValidation).
Hope that helps! Thanks!!
[imdsTrain imdsValidation] = splitEachLabel(imds,0.7);
augdsTrain=augmentedImageDatastore(inputSize, imdsTrain,'ColorPreprocessing','RGB');
augdsValidation=augmentedImageDatastore(inputSize, imdsValidation,'ColorPreprocessing','RGB');