We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Board: m5stickv
Code:
import sensor import image import lcd import KPU as kpu
lcd.init() lcd.rotation(2) sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.set_windowing((224, 224)) sensor.set_vflip(0) sensor.set_hmirror(0) sensor.run(1) lcd.clear() #lcd.draw_string(135, 0, "MobileNetDemo") f = open('labels.txt', 'r') labels = f.readlines() f.close() #print(labels) task = kpu.load("/sd/model.kmodel")
#for image capturing path = "/sd/images/" ext=".jpg" cnt=0 img=image.Image()
while(True): img = sensor.snapshot() fmap = kpu.forward(task, img) plist = fmap[:] pmax = max(plist) max_index = plist.index(pmax) #a = lcd.display(img, roi=(0, 0, 135, 135), oft=(0, 0)) a=lcd.display(img) #lcd.draw_string(135, 100, "%s" % (labels[max_index].strip())) #lcd.draw_string(135, 119, "%.2f" % (pmax)) if max_index==1: lcd.draw_string(135,0,"Person",lcd.RED) cnt+=1 fname=path+str(cnt)+ext img.save(fname,quality=95) print("image saved as", fname) a = kpu.deinit(task)
May I know how to reduce the resolution of the image? I tried using img.resize() but it does not work. Thank you and hope to hear from you soon!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Board: m5stickv
Code:
import sensor
import image
import lcd
import KPU as kpu
lcd.init()
lcd.rotation(2)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((224, 224))
sensor.set_vflip(0)
sensor.set_hmirror(0)
sensor.run(1)
lcd.clear()
#lcd.draw_string(135, 0, "MobileNetDemo")
f = open('labels.txt', 'r')
labels = f.readlines()
f.close()
#print(labels)
task = kpu.load("/sd/model.kmodel")
#for image capturing
path = "/sd/images/"
ext=".jpg"
cnt=0
img=image.Image()
while(True):
img = sensor.snapshot()
fmap = kpu.forward(task, img)
plist = fmap[:]
pmax = max(plist)
max_index = plist.index(pmax)
#a = lcd.display(img, roi=(0, 0, 135, 135), oft=(0, 0))
a=lcd.display(img)
#lcd.draw_string(135, 100, "%s" % (labels[max_index].strip()))
#lcd.draw_string(135, 119, "%.2f" % (pmax))
if max_index==1:
lcd.draw_string(135,0,"Person",lcd.RED)
cnt+=1
fname=path+str(cnt)+ext
img.save(fname,quality=95)
print("image saved as", fname)
a = kpu.deinit(task)
May I know how to reduce the resolution of the image? I tried using img.resize() but it does not work. Thank you and hope to hear from you soon!
The text was updated successfully, but these errors were encountered: