added logic to generate and store a unique label for a given image