I try to Combine the example tf_person detection and spi to send the result to arduino but i always show the error message(valueerror: extinct vector 12 is already in use)
i dont know how to fix the problem ,CUZ this is my first time use Micropython plz help me
this is the ERROR img :Screenshot-1 — ImgBB
and my code :
import sensor, image, time, os, tf, pyb, ustruct, array
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((240, 240))
sensor.skip_frames(time=2000)
def nss_callback(line):
global spi, data
try:
spi.send(data, timeout=1000)
except OSError as err:
pass
A=[0]*1
net = tf.load(‘person_detection’)
labels = [‘unsure’, ‘person’, ‘no_person’]
text=str(A[0])
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
for obj in net.classify(img, min_scale=1.0, scale_mul=0.5, x_overlap=0.0, y_overlap=0.0):
A[0]=str(int(obj.output()[1]))
data = ustruct.pack(“<bi%ds” % len(text), 85, len(text), text)
spi = pyb.SPI(2, pyb.SPI.SLAVE, polarity=0, phase=0)
pyb.ExtInt(pyb.Pin(“P3”), pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_UP, nss_callback)
print(“**********\nDetections at [x=%d,y=%d,w=%d,h=%d]” % obj.rect())
for i in range(len(obj.output())):
print(“%s = %f” % (labels_, obj.output()))
img.draw_rectangle(obj.rect())
img.draw_string(obj.x()+3, obj.y()-1, labels[obj.output().index(max(obj.output()))], mono_space = False)
print(A[0],clock.fps(), “fps”)_