Added check for total number of features from image vs. requested number of samples from dataset.