my own frontalface

I am using tf_Face_Recognition 1.py and are trying to build my own content

I use Cascade-Trainer-GUI (by Amin Ahmadi) to build my own version of the files

The result is: pos.lst, neg.lst and classifier folder containing: cascade.xml, log.txt, params.xml, stage0.xml to stage15.xml
all placed in the camera card

in the py file I reference “classifier/cascade.xml”
The result is a message there is not enough of memory, but I am using the plus model of the camera and the files is around 96 dpi, color, 48 pos files 558k and 51 neg 381k files.
And I use windows 10.
Do you have any idea.

You have convert the xml files: openmv/cascade_convert.py at master · openmv/openmv · GitHub

I inserted the code into visual studio and changed:
if name == ‘cascade.xml’:
main()

It run without errors
I placed the cascade.xml in the root of the camera
and run

# Face Recognition

import sensor, image, time, tf

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)

clock = time.clock()

net = tf.load("trained.tflite", load_to_fb=True)		[b][color=#FF0000]# why is this code used[/color][/b]
labels = [l.rstrip('\n') for l in open("labels.txt")]

while(True):
    clock.tick()

    # Take a picture and brighten things up for the frontal face detector.
    img = sensor.snapshot().gamma_corr(contrast=1.5)

    # Returns a list of rects (x, y, w, h) where faces are.
    faces = img.find_features(image.HaarCascade("cascade.xml"))

    for f in faces:

        # Classify a face and get the class scores list
        scores = net.classify(img, roi=f)[0].output()

        # Find the highest class score and lookup the label for that
        label = labels[scores.index(max(scores))]

        # Draw a box around the face
        img.draw_rectangle(f)

        # Draw the label above the face
        img.draw_string(f[0]+3, f[1]-1, label, mono_space=False)

    print(clock.fps())

it still say there is not enough memory.

Hi, I’m pretty sure our library doesn’t work with the XML files. We convert it into a binary format that is very small. Hence the script I linked to above.

Thanks,
How to convert to a binary format?

Please see the script I linked to above.