473,287 Members | 1,793 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,287 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 2890
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.