<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[running mobilenet on m5stickv]]></title><description><![CDATA[<p dir="auto">hello</p>
<p dir="auto">I'm trying to run the mobilenet classifier script:<br />
<a href="https://github.com/sipeed/MaixPy_scripts/tree/master/machine_vision/mobilenet_1000_class" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/sipeed/MaixPy_scripts/tree/master/machine_vision/mobilenet_1000_class</a></p>
<p dir="auto">The tutorial says we should use the minimum firmware:<br />
<a href="https://cn.maixpy.sipeed.com/maixpy/en/course/ai/image/1000_type_classifier.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://cn.maixpy.sipeed.com/maixpy/en/course/ai/image/1000_type_classifier.html</a></p>
<p dir="auto">So I compiled a minimum firmware with only support for video and k4. It ended up with 1.2Mb. I also change the gc heap size as the tutorial says. But when I run the script, it says it doesn't have enough memory.</p>
<p dir="auto">E (2704939464) SYSCALL: Out of memory</p>
<p dir="auto">The error happens before I feed the images the the kpu, in the line where I define the sensor.framesize</p>
<p dir="auto">Is it even possible to run this script on the m5stickV?</p>
<p dir="auto">import lcd, sensor<br />
import KPU as kpu</p>
<p dir="auto">def lcd_init():<br />
lcd.init(type=3)<br />
lcd.register(0x3A, 0x05)<br />
lcd.register(0xB2, [0x05, 0x05, 0x00, 0x33, 0x33])<br />
lcd.register(0xB7, 0x23)<br />
lcd.register(0xBB, 0x22)<br />
lcd.register(0xC0, 0x2C)<br />
lcd.register(0xC2, 0x01)<br />
lcd.register(0xC3, 0x13)<br />
lcd.register(0xC4, 0x20)<br />
lcd.register(0xC6, 0x0F)<br />
lcd.register(0xD0, [0xA4, 0xA1])<br />
lcd.register(0xD6, 0xA1)<br />
lcd.register(0xE0, [0x23, 0x70, 0x06, 0x0C, 0x08, 0x09, 0x27, 0x2E, 0x34, 0x46, 0x37, 0x13, 0x13, 0x25, 0x2A])<br />
lcd.register(0xE1,[0x70, 0x04, 0x08, 0x09, 0x07, 0x03, 0x2C, 0x42, 0x42, 0x38, 0x14, 0x14, 0x27, 0x2C])</p>
<p dir="auto">task = kpu.load(0x300000)<br />
f=open('/flash/labels.txt','r')<br />
labels=f.readlines()<br />
f.close()</p>
<p dir="auto">print ('ok load kpu and labels')</p>
<p dir="auto">lcd_init()<br />
lcd.rotation(2) #Rotate the lcd 180deg</p>
<p dir="auto">sensor.reset()<br />
sensor.set_pixformat(sensor.RGB565)<br />
sensor.set_framesize(sensor.QVGA)<br />
#sensor.set_framesize(sensor.B128X128)<br />
sensor.run(1)<br />
sensor.skip_frames()</p>
<p dir="auto">print ('ok sensor')</p>
<p dir="auto">while (True):</p>
<p dir="auto">img = sensor.snapshot()<br />
img.crop(x_size=224, y_size=224)</p>
<p dir="auto">fmap = kpu.forward(task, img)<br />
plist=fmap[:]<br />
pmax=max(plist)<br />
max_index=plist.index(pmax)</p>
<p dir="auto">img = img.draw_string(0, 0, "%.2f: %s" %(pmax, labels[max_index].strip()), color=(255, 0, 0))<br />
#lcd.display(img, oft=(0,0))<br />
print(fps)</p>
]]></description><link>https://community.m5stack.com/topic/3291/running-mobilenet-on-m5stickv</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Mar 2026 08:06:08 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/3291.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 May 2021 14:01:48 GMT</pubDate><ttl>60</ttl></channel></rss>