Hi,
What does the density value represent? Can you bin up the values to change the floats into discrete categories?
Do you also have a number, the count of grapes, per target image in your training set?
Also, check out this post: Counting segmented objects. It suggests to use cv2 once you have your segmentation done, which seems like the way to go to me.
Steve