AIWintermuteAI / aXeleRate

Keras-based framework for AI on the Edge
MIT License
179 stars 71 forks source link

AttributeError: 'Image' object has no attribute 'rotation_corr' #8

Closed Purmpol closed 4 years ago

Purmpol commented 4 years ago

I tried running your script : example_scripts/k210/detector/person_detector_v4.py but it raised an error below....

[MAIXPY]: find ov2640 Traceback (most recent call last): File "", line 19, in AttributeError: 'Image' object has no attribute 'rotation_corr'

MicroPython v0.5.0-22-g7ac6b09 on 2020-03-04; Sipeed_M1 with kendryte-k210

AIWintermuteAI commented 4 years ago

You're using minimal version of firmware, which indeed doesn't include advanced OpenMV functions, such as rotation_corr. Rotation correction rotates the image, so if you don't need to do that (make sure that the image you're getting is properly rotated from the beginning though, if it is upside down or rotated +-90 degrees, the model trained on "normal" images will have hard time xD), just delete that line, together with pix_to_ai(). If you do need to use rotation_corr, you need to flash full version of firmware(2 Mb, that one). Please try and see if it solves your problem

Purmpol commented 4 years ago

Yes. You're right! That's error has gone.

I choose flashing full version. But there's a new issue. ( The size of kmodel which I trained from your colab is 1.9MB )

MicroPython v0.5.0-22-g7ac6b09 on 2020-03-04; Sipeed_M1 with kendryte-k210 Type "help()" for more information.

raw REPL; CTRL-B to exit OK init i2c2

[MAIXPY]: find ov2640 E (2977186844) SYSCALL: Out of memory

AIWintermuteAI commented 4 years ago

Anything else you use memory for? The full version now has a lot of stuff that is not needed by most users, like lvgl... For my own projects I build firmware from source and during config uncheck all the features that I don't need - the final size is 1.4 Mb after that, with full OpenMV functions. I have a binary somewhere on my home computer, let me check (it is holidays now here in China)

Purmpol commented 4 years ago

Ok I managed to build my own firmware. Its size is about 1.3MB and no problem of "Out of memory" anymore.

However, there's a new error .. ValueError: [MAIXPY]kpu: load error:2002, ERR_KMODEL_VERSION: only support kmodel V3/V4 now

I tried to both enable/disable "[ ] support v4 kmodel" in menuconfig, then rebuilt and flashed. But still got the error.

AIWintermuteAI commented 4 years ago

This is something new. Which commit did you build? It is known that versions after 5.0-29 have issues with running kmodel v4(albeit not the one that you have) - https://github.com/AIWintermuteAI/aXeleRate/issues/5 Can you try this firmware? I just tested my person detector and it worked normally. maixpy.zip

Purmpol commented 4 years ago

I used your firmware ( 5.0-31 ) and it worked with your script without problem. => OK !

and I also tried maixpy_v0.5.0_31_gd3e71c0_minimum_with_ide_support with comment out ... rotation_corr( ... line => OK !

The problem was solved. Thank you very much ! Btw, I have a noob question. How to build own firmware with specific downgraded version? (like your 5.0-31 )

AIWintermuteAI commented 4 years ago

Hardly a noob question. You need to git checkout the commit - for example if you do git checkout d3e71c0 you'll get 0.5.0_31 version. Anyways, glad your problem has resolved!

AIWintermuteAI commented 4 years ago

https://github.com/sipeed/MaixPy/issues/242#issuecomment-633937461

KuoEuran commented 3 years ago

This is something new. Which commit did you build? It is known that versions after 5.0-29 have issues with running kmodel v4(albeit not the one that you have) - #5 Can you try this firmware? I just tested my person detector and it worked normally. maixpy.zip

Hi, I have use your firmware to test my kmodel, unfortunately, I still get the ValueError: [MAIXPY]kpu: load error:2002, ERR_KMODEL_VERSION: only support kmodel V3/V4 now when I use the command task = kpu.load(0x0210000) or task = kpu.load_flash(0x210000 ,1 ,0x4000 , 40000000). And I use kpu.load(0x210000), the program is stuck when fps comes to 0. Can you give me some advice about the situation, tks.

AIWintermuteAI commented 3 years ago

hi @KuoEuran I'll need more details about what is the code, model and what have you tried so far. It is generally better to create a new issue. Additionally, since it is a problem with MaixPy firmware, consider asking this question in that repository. Thank you.

KuoEuran commented 3 years ago

@AIWintermuteAI Hi, thank you for your replying. I have ever posted an issue, like https://github.com/sipeed/MaixPy/issues/426. However, I haven't get a solution. My model is yolov4-tiny and it converted from tensorflow lite. I think my model size is small enough to run on k210. When I use SD or flash try to load my kmodel, it will show the error I mentioned. Can you give me some advice? thank you

AIWintermuteAI commented 3 years ago

@KuoEuran , hmmm, well, I didn't get to implementing yolov4 and do not plan to do that. YOLOv3 is in pipeline - training works, but K210 Micropython lacks decoder for YOLOv3 (or YOLOv4). Anyways, since this network is not trained with aXeleRate, I do not think it is an appropriate place for this question.