Skip to content
New issue

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

Problem running kmodel for yolo 20 #130

Closed
beckmx opened this issue Feb 15, 2023 · 1 comment
Closed

Problem running kmodel for yolo 20 #130

beckmx opened this issue Feb 15, 2023 · 1 comment

Comments

@beckmx
Copy link

beckmx commented Feb 15, 2023

Hello guys, I am trying to run the project under https://github.com/sipeed/MaixPy_scripts/blob/master/machine_vision/yolov2_20class.py I already, I have updated maixPy to the latest version and also I had downgraded to the ones available under dl.sipeed.com but I am not able to make the project run, the URL related in the comment is not available anymore http://blog.sipeed.com/p/677.html and so I was researching and found the model for yolov2 20 items, which was in this repo: https://github.com/kendryte/nncase/blob/master/examples/20classes_yolo/k210/kpu_20classes_example I also noticed a lot of the things from the original python script are inside the main.c, however when I load the model it throws an error when on the run phase:

from fpioa_manager import *
import os, Maix, lcd, image
from Maix import FPIOA, GPIO

import sensor,image,lcd,time
import KPU as kpu
import network
import socket
from machine import UART

lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
#sensor.set_windowing((320, 240))
sensor.set_vflip(0)
sensor.run(1)
clock = time.clock()
classes = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor']
task = kpu.load(0x500000) #change to "/sd/name_of_the_model_file.kmodel" if loading from SD card
anchor = (1.08, 1.19, 3.42, 4.41, 6.63, 11.38, 9.42, 5.11, 16.62, 10.52)
kpu.set_outputs(task,10, 320, 240, 5)#<<<<<-----is this correct?
a = kpu.init_yolo2(task, 0.5, 0.3, 5, anchor)
print("is yolo loaded:")
print(a)

while(True):
    clock.tick()
    img = sensor.snapshot()
    code = kpu.run_yolo2(task, img)#<<<<<-----issue here

I also have the doubt about the set_outputs, because I have seen in other places they used it but I am not sure why or when and the error that gets thrown with this issue is this one:

Traceback (most recent call last):
  File "<stdin>", line 36, in <module>
OSError: ERR_OUTPUTS_SET: need kpu.set_outputs() to set shape
MicroPython 1f5d688 on 2020-11-26; Sipeed_M1 with kendryte-k210
Type "help()" for more information.
>>> 

The firmware used was:

maixpy_v0.6.0_0_g1f5d688_openmv_kmodel_v4_with_ide_support

and also

maixpy_v0.6.2_84_g8fcd84a58_openmv_kmodel_v4_with_ide_support

@beckmx
Copy link
Author

beckmx commented Feb 16, 2023

I am going to answer myself for other people that don't have the minor clue, and just keep reading without going anywhere. So basically most of the examples here work except those that are the most powerful, those models and examples are updated on the MaixHub website, you need to login there, and the models are there including the sample code. So after much reading, that's my path to go. Check the examples here, and then go to maixhub

@beckmx beckmx closed this as completed Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant