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.
I inserted the code into visual studio and changed:
if name == ‘cascade.xml’:
It run without errors
I placed the cascade.xml in the root of the camera
# Face Recognition
import sensor, image, time, tf
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")]
# 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).output()
# Find the highest class score and lookup the label for that
label = labels[scores.index(max(scores))]
# Draw a box around the face
# Draw the label above the face
img.draw_string(f+3, f-1, label, mono_space=False)
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.
How to convert to a binary format?
Please see the script I linked to above.