0
$\begingroup$

So I have 3 Classes the model can output after veiwing an image, at the moment it has a 70% accuracy, however this is not an issue as the plan is unless it's 85%+ sure on the Probability of the class it will be marked as unsure and we will go back to classify in manually

I think using an Ifor := would work well just not sure how to extract the probabilies using Net[*image*,"Probabilities"] To create this option

$\endgroup$
8
  • 1
    $\begingroup$ Can you be more clear about what logic you're wanting? Like, what's the condition the "if" needs to evaluate and what is the result when "true" and what is the result when "false". $\endgroup$
    – lericr
    Commented Nov 3, 2023 at 14:31
  • $\begingroup$ so the net will classify the image into having 3 probabilities equalling how likely it is to be in each class. So for my example the classes are metal, plastic and other. Now most of the time it says 0.9->plasitc, 0.09->metal, and 0.01-> other. This shows the network is pretty sure it's plastic. however when it gets below a threshold that i want to set at 0.85. I want it to say the network is unsure and this is when i would check the image myself $\endgroup$ Commented Nov 3, 2023 at 15:23
  • $\begingroup$ So the "If" function should be true when no probabilities from the classifier are more than 0.85 and it should produce a new class where these results go into a class called unsure. $\endgroup$ Commented Nov 3, 2023 at 15:26
  • $\begingroup$ Okay, so are you sure you wanted a NetChain as opposed to a ClassifierFunction? $\endgroup$
    – lericr
    Commented Nov 3, 2023 at 15:59
  • $\begingroup$ Yes I’m not sure the classify function Is smart enough to classify images that are of particles only 40 micro meters in diameter, therefore I’m using quite a complex neural network to classify these particles $\endgroup$ Commented Nov 4, 2023 at 23:25

1 Answer 1

0
$\begingroup$

so i found an answer after coming back to my problem, After recieving the probabilities from probs=net[*listOfImages*,"Probabilities"].(net is a pre trained neural network using NetChain & NetTrain) You can create the thresholds you want with a simple list thresholds = {0.5, 0.75, 0.75}. Then use an If function to say if the these probabilties are less than these thresholds class them into their own class

predictedClasses = If[#[[1]] >= thresholds[[1]], "class1", If[#[[2]] >= thresholds[[2]], "class2", If[#[[3]] >= thresholds[[3]], "class3", "newClass"]]] & /@ probs

One thing to add, the images that you put into the neural net function to get the probabilities these must be images that have no class already applied, so brand new images.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.