sipeed / MaixPy-v1

MicroPython for K210 RISC-V, let's play with edge AI easier
https://wiki.sipeed.com/maixpy
Other
1.68k stars 439 forks source link

Error kpu.run_yolo2() when load image from image.Image('sd/*.jpg') #453

Closed afgomesdev closed 2 years ago

afgomesdev commented 2 years ago

Steps to reproduce the behavior:

  1. Go to MaixPy IDE
  2. Past this script
    
    import image, time
    import KPU as kpu

task = kpu.load(0x300000) anchor = (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3658, 5.155437, 6.92275, 6.718375, 9.01025) kpu.init_yolo2(task, 0.5, 0.3, 5, anchor) while(True): img = image.Image("/sd/Andre2.jpg", size=(128, 128)) t = time.ticks_ms() objects = kpu.run_yolo2(task, img)



3. Run 
![image](https://user-images.githubusercontent.com/66983712/149060226-d67b6cec-7edc-4551-912e-50a56919c5a6.png)

4. See error
![image](https://user-images.githubusercontent.com/66983712/149060337-6efd693d-3747-4f8f-bcf8-005c5ff2447d.png)

**Expected behavior**
I need load image from SD not from sensor.

 - IDE version: [0.2.5]
 - Firmware version: [0.6.2]
 - Board: [Maix Bit]
 - OS: [Windows]
afgomesdev commented 2 years ago

I resolve it. Use fuction from img like pix_to_ai() image