Count # of Cookie Chocolate Chips
Mathematica 134 Bytes

Max@ComponentMeasurements[ArrayComponents[ImageData@ColorQuantize[RemoveAlphaChannel[#,White],4,Dithering-&gt;False],2],"Holes"][[All,2]]&amp;


Usage (applied to .png images)

%/@cookies


Output:

{8,8,10,7}


Here's the code to bring in the cookie examples:

cookieURLs={"https://i.stack.imgur.com/UCV1A.png","https://i.stack.imgur.com/5n7AY.png","https://i.stack.imgur.com/ZbZx6.png","https://i.stack.imgur.com/M8jTo.png"};
cookies=Import/@cookieURLs;


I'm sure this can be shortened, but I think it's fairly bullet-proof as is. The original images have many more colors than the eye can see.

Here are the original cookies:



Here are the cookies after cleanup to get them into a 4 component array:

ArrayPlot[ArrayComponents[ImageData@ColorQuantize[RemoveAlphaChannel[#,White],4,Dithering-&gt;False],2]]&amp;/@cookies//Row




After that, all is needed is to use ComponentMeasurements to count holes.
This will always report at least 1.  You could have one really big chocolate chip filling the cookie border, so the 0 or 1 case will always be ambiguous.