# Find Probability that Image Is Text

I can find out whether an image is text:

ImageInstanceQ[img,Entity["Concept", "TextualMatter::m7642"]]


And if an image is most likely text, I can find out the probability that it is text:

ImageIdentify[img, All, 1, "Probability"]


But how do I find the probability that an image is text, even if it's, say, a picture of a lime? I'm looking for the fastest solution possible. My brightest idea at this point is to do a binary search over ImageInstanceQ with different recognition thresholds.

EDIT: I've found a method. Load the net:

imId = NetModel["Wolfram ImageIdentify Net V1"]


And then

imId[image, {"Probability",
Entity["Concept", "TextualMatter::m7642"]}]


But this takes on average 0.1 seconds for a 100x100 image. Is there any way to speed this up? I need to compute it about 20000 times.

• You can post answers to your own question, that way it will be more visible to future visitors. Jun 18, 2019 at 4:38

One method to achieve this is by loading the underlying neural network:

imId = NetModel["Wolfram ImageIdentify Net V1"]


And then

imId[image, {"Probability",
Entity["Concept", "TextualMatter::m7642"]}]


Although this is very slow. If anyone has a faster method I'd love to hear it.

Since I've trained a NN classifier in Wolfram Mathematica to identify a text image and get pretty good results.

I tell you that, you can use a lightweight net-structure like SqueezeNet

You can test the inference performance by NetModel["SqueezeNet V1 .1 Trained on ImageNet Competition Data"]

Maybe a LeNet is enough?