My own weed detection

I created a ‘p’ and a ‘n’ folder where the weed and other was placed
I run ‘Cascade trainer GUI’ with this settings

<cascade>
  <stageType>BOOST</stageType>
  <featureType>HAAR</featureType>
  <height>96</height>
  <width>96</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9500000476837158e-01</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-01</maxFalseAlarm>
    <weightTrimRate>9.4999998807907104e-01</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>0</maxCatCount>
    <featSize>1</featSize>
    <mode>BASIC</mode></featureParams>
  <stageNum>13</stageNum>
  <stages>

There was no error

then I run: Python cascade_convert.py C:\Users\Ulf\Desktop\bild2\classifier\cascade.xml

There was no error

Here is the modified face recognition

net = tf.load("trained.tflite", load_to_fb=True)
labels = [l.rstrip('\n') for l in open("labels.txt")]
while(True):
    clock.tick()
    img = sensor.snapshot().gamma_corr(contrast=1.5)
    faces = img.find_features(image.HaarCascade("cascade.cascade"))

But there is no ‘face’ or in my case weed

Can you see whats wrong?

It’s a lot easier to do classification with TF and EdgeImpulse and you’ll get much better results. Please see the tutorials around just google openmv+edgeimpulse. Otherwise you should try tuning the threshold and scale factor, see the comments in the face detection example.

I have used Edge impulse to classify p and n
but I can not see that Edge impulse can create a HaarCascade file like the one you use for face detection
can you guide me on how to produce the HaarCascade

Actually I meant use EdgeImpulse to train a neural network, it can’t train haar cascades, you can only do that with open-cv. If you already trained a cascade that works, just try to lower the threshold and/or increase the scaling step.