Use Predict command for counting dots in images?

I deeply appreciate your time.

predict1-1.nb (84.7 KB)

If you assign the argument to Predict to data then

data // Map[Head]
(* {RightArrow, RightArrow, RightArrow, RightArrow, RightArrow, 
RightArrow, RightArrow, RightArrow, RightArrow, RightArrow, 
RightArrow, RightArrow, RightArrow, RightArrow, RightArrow, 
RightArrow, RightArrow, RightArrow, RightArrow, RightArrow} *)

Not sure how that argument list was generated, but it needs to be a list of Rule.

data = Rule @@@ data;
p = Predict[data]

test = {your list of test images}
p[test]
(* {5., 27., 73.}*)

You could try a different Method and/or have more examples to train on to improve accuracy.

If the dots in your image are so well defined then this is probably a better way to count them

test // Map[MorphologicalComponents /* Max]
{8, 25, 71}

Rohit, thank you so much :slight_smile: