473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,401 developers and data experts.

K210 maixpy AI function: pedestrian detection

sipeed
1
582 data sets, 224*224

Video web address:
https://www.bilibili.com/video/BV1Ra4y1s7Ei

The code is as follows:
Expand|Select|Wrap|Line Numbers
  1. import sensor,image,lcd,time
  2. import KPU as kpu
  3. lcd.init(freq=15000000)
  4. sensor.reset(dual_buff=1)
  5. sensor.set_pixformat(sensor.RGB565)
  6. sensor.set_framesize(sensor.QVGA)
  7. sensor.set_hmirror(1)
  8. sensor.set_vflip(0)
  9. sensor.set_windowing((224, 224))
  10.  
  11.  
  12. sensor.run(1)
  13. clock = time.clock()
  14. classes = ['person']
  15. task = kpu.load(0x300000)
  16. anchor = (0.76,1.98, 1.20,3.06, 1.51,4.30, 2.06,5.32, 2.87,6.02)
  17. a = kpu.init_yolo2(task, 0.3, 0.3, 5, anchor)
  18. while(True):
  19.     clock.tick()
  20.     img = sensor.snapshot()
  21.     code = kpu.run_yolo2(task, img)
  22.     print(clock.fps())
  23.     fps =clock.fps()
  24.     img.draw_string(2,2, ("%2.1ffps" %(fps)), color=(0,255,0), scale=2)
  25.     if code:
  26.         for i in code:
  27.             a=img.draw_rectangle(i.rect())
  28.             a = lcd.display(img)
  29.             print(i.classid(),i.value())
  30.             for i in code:
  31.                 lcd.draw_string(i.x(), i.y(), classes[i.classid()], lcd.RED, lcd.WHITE)
  32.                 lcd.draw_string(i.x(), i.y()+12, '%.2f'%i.value(), lcd.RED, lcd.WHITE)
  33.     else:
  34.         a = lcd.display(img)
  35. a = kpu.deinit(task)
Mar 14 '21 #1
1 2904
Niheel
2,460 Expert Mod 2GB
Thank you for posting! This is pretty neat.
Is that the video of this AI function in action?
Mar 14 '21 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

60
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm ...
18
by: Mickey Segal | last post by:
On comp.lang.java.programmer we are discussing problems created for Java programs by pop-up blockers (in the thread "showDocument blocked by new microsoft pop-up blocker"). Our problem is that...
0
by: Stuart Ferguson | last post by:
I am currently writing an application for the Windows CE Platform and wish to add an admin only function to the main form which is hidden by only being activated by a specific keypress for example...
5
by: The Eclectic Electric | last post by:
I'm very noobish when it comes to Javascript, in fact I wasn't intending to use it at all, but I've got myself distracted by this "problem". I want to use an animated gif as my favicon. This...
0
by: origami.takarana | last post by:
Intrusion Detection Strategies ----------------------------------- Until now, we’ve primarily discussed monitoring in how it relates to intrusion detection, but there’s more to an overall...
7
by: Gregor Kofler | last post by:
What is the best practice for removing anonymous functions? Something like (function() { doSomething(); arguments.callee = null; })(); seems to work (at least it triggers no errors or...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
10
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations...
4
NeoPa
by: NeoPa | last post by:
Introduction Many developers within Access need to be able to detect when the user has been inactive for a while. It's quite common to have a requirement to run something if/when the system's not...
3
twinnyfo
by: twinnyfo | last post by:
Re : Inactivity Detection in Access. NeoPa, I just encountered a very strange occurrence with this code (using Access 2010). First off, this code works. Thanks much for the work you've...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.