Created by: daming-lu
When we set image sampling number to be 10 but only generate 5 images, it would throw an error. Once the total image amount is less than the sample amount, we should use the total amount or at least prompt a warning to inform the user.