├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── errata.yml │ ├── improvement.yml │ └── other.yml ├── config │ └── markdownlink.json ├── pull_request_template.md └── workflows │ └── markdown_check.yml ├── .markdownlint.json ├── LICENSE ├── README.md ├── en ├── K510-CRB-KIT_AWS_Quick_Start_Guide.md ├── K510_AI_Application_Guides.md ├── K510_CRB_V1.2_Hardware_Guide.md ├── K510_Drm_Developer_Guides.md ├── K510_ISP_Adaptive_Tuning_Guides.md ├── K510_ISP_Tuning_Tool_Guides.md ├── K510_ISP_User_Property_Page_Guides.md ├── K510_Linux_Kernel_Driver_Developer_Guides.md ├── K510_Mailbox_Developer_Guides.md ├── K510_Multimedia_Developer_Guides.md ├── K510_SDK_Application_Guides.md ├── K510_SDK_Build_and_Burn_Guide.md ├── K510_SDK_DSP_CORE_Guide.md ├── K510_System_memory_map.md ├── K510_U-Boot_Developer_Guides.md ├── K510_V4l2_Developer_Guides.md ├── K510_V4l2_Sensor_Developer_Guides.md ├── K510_nncase_Developer_Guides.md └── README.md └── zh ├── K510_AI_Application_Guides.md ├── K510_CRB_V1.2_Hardware_Guide.md ├── K510_Drm_Developer_Guides.md ├── K510_ISP_Adaptive_Tuning_Guides.md ├── K510_ISP_Tuning_Tool_Guides.md ├── K510_ISP_User_Property_Page_Guides.md ├── K510_Linux_Kernel_Driver_Developer_Guides.md ├── K510_Mailbox_Developer_Guides.md ├── K510_Multimedia_Developer_Guides.md ├── K510_SDK_Application_Guides.md ├── K510_SDK_Build_and_Burn_Guide.md ├── K510_SDK_DSP_CORE_Guide.md ├── K510_System_memory_map.md ├── K510_U-Boot_Developer_Guides.md ├── K510_V4l2_Developer_Guides.md ├── K510_V4l2_Sensor_Developer_Guides.md ├── K510_nncase_Developer_Guides.md ├── README.md ├── images ├── ai_demo │ └── image-ai-demo.png ├── aws_quick_start │ ├── activity_log.png │ ├── attach_policies.png │ ├── aws_iot_config.png │ ├── aws_iot_test.png │ ├── aws_iot_test_log.png │ ├── board_back.png │ ├── board_front.png │ ├── boot_mode.png │ ├── certification_display.png │ ├── certs_folder.png │ ├── create_policy.png │ ├── create_single_thing.png │ ├── create_things.png │ ├── device_certificate.png │ ├── download_crts_keys.png │ ├── thing_properties.png │ └── troubleshooting.png ├── canaan-cover.png ├── canaan-logo.png ├── doc_dsp │ ├── demo_dsp.png │ ├── image-dsp_1.png │ └── image-dsp_log.png ├── hw_crb_v1_2 │ ├── canaan-board.png │ ├── clip_hw-3-18.jpg │ ├── clip_hw_3-10.jpg │ ├── clip_hw_3-13.jpg │ ├── clip_hw_3-16.jpg │ ├── clip_hw_3-17.jpg │ ├── clip_hw_3-3.jpg │ ├── clip_hw_3_11.jpg │ ├── clip_hw_3_12.jpg │ ├── clip_hw_3_14.jpg │ ├── clip_hw_3_15.jpg │ ├── clip_hw_3_5.jpg │ ├── clip_hw_3_7.jpg │ ├── clip_hw_3_8.jpg │ ├── clip_hw_3_9.jpg │ ├── clip_hw_4_1.jpg │ ├── image-K510_Core.png │ ├── image-eMMC.png │ ├── image-hw_1_2.png │ ├── image-hw_1_3.png │ ├── image-hw_2-4.png │ ├── image-hw_2_1.png │ ├── image-hw_2_2.png │ ├── image-hw_2_3.png │ ├── image-hw_3_1.png │ ├── image-hw_3_2.png │ └── image-hw_3_6.png ├── mailbox │ ├── 130101_frame_00.svg │ ├── 130102_data_structure.svg │ ├── 130103_frame_callback.svg │ ├── 130203_add_to_rbuf.svg │ ├── 130203_mbox_request_channel.svg │ ├── 130203_mbox_send_message.svg │ ├── 130203_msg_submit.svg │ ├── 130601_dsp_load.png │ ├── 130602_mailbox_async.png │ └── 130602_mailbox_poll.png ├── multimedia_guides │ ├── EasyDarwin_run.png │ ├── ffmpeg_block_diagram.png │ ├── ffmpeg_canaan_audio3a.png │ ├── hardware_block_diagram.png │ ├── multimedia_block_diagram.png │ └── sdp.png ├── package_app │ ├── image-ps.png │ ├── image-ps_list.png │ ├── image-rc.sysinit-b.png │ └── image-rc.sysinit-c.png ├── quick_start │ ├── balenaetcher.png │ └── k510_boot.png ├── sdk_application │ ├── clip_image001.png │ ├── clip_image002.jpg │ ├── clip_image003.png │ ├── clip_image004.jpg │ ├── clip_image005.png │ ├── clip_image006.jpg │ ├── clip_image007.png │ ├── clip_image008.jpg │ ├── clip_image009.png │ ├── clip_image010.jpg │ ├── clip_image011.png │ ├── clip_image012.jpg │ ├── clip_image013.jpg │ ├── clip_image014.jpg │ ├── clip_image015.png │ ├── clip_image016.jpg │ ├── clip_image017.png │ ├── clip_image018.jpg │ ├── clip_image019.jpg │ ├── clip_image020.jpg │ ├── clip_image021.png │ ├── clip_image022.jpg │ ├── clip_image023.png │ ├── clip_image024.jpg │ ├── clip_image025.png │ ├── clip_image026.png │ ├── clip_image028.png │ ├── clip_image029.png │ ├── clip_image030.jpg │ ├── clip_image031.png │ ├── clip_image032.jpg │ ├── clip_image033.png │ ├── demo_dsp.png │ ├── demo_dualcamera.jpg │ ├── demo_dualcamera.png │ ├── demo_h264.png │ ├── demo_nncase_qos_ctrl0.png │ ├── demo_nncase_qos_ctrl1.png │ ├── demo_nncase_qos_ctrl2.png │ ├── demo_nncase_qos_ctrl3.png │ ├── demo_nncase_qos_ctrl4.png │ ├── demo_rtsp.png │ ├── demo_videolib.jpg │ ├── demo_videolib_n.jpg │ ├── driver-twod-output-1080x1920.jpg │ ├── driver-twod-output-640x480.jpg │ ├── image-client.png │ ├── image-gpio-keys.png │ ├── image-imx385-dts.jpg │ ├── image-imx385-kernel-config.jpg │ ├── image-menu0.png │ ├── image-menu2.png │ ├── image-pwm.png │ ├── image-rtc.png │ ├── image-sdmmc.png │ ├── image-server.png │ ├── image-uart-mobaxterm.png │ ├── image-uart-shell.png │ ├── image-uart-telent.png │ ├── image-watchdog.png │ ├── image_crypto_cbc.png │ ├── image_crypto_ecb.png │ ├── image_crypto_help.png │ ├── image_crypto_sha256.png │ ├── image_drm_demo.png │ ├── image_lvgl.png │ ├── image_trng.png │ ├── image_v4l2_drm_demo.png │ ├── image_wifi_1.png │ ├── image_wifi_2.png │ ├── twod-osd2yuv-app.jpg │ └── twod-scaler-overlay-osd-app.jpg ├── sdk_build │ ├── clip_image_p1.jpg │ ├── clip_image_p2.jpg │ ├── image-app-build-2.png │ ├── image-app_build-1.png │ ├── image-build_make_def.png │ ├── image-build_menu.png │ ├── image-build_savedef.png │ ├── image-buildroot.png │ ├── image-config_list.png │ ├── image-dd.png │ ├── image-dev_sd.png │ ├── image-emmc3.png │ ├── image-emmc_1.png │ ├── image-emmc_2.png │ ├── image-enter_docker.png │ ├── image-extern_option.png │ ├── image-hello.png │ ├── image-linux_men.png │ ├── image-linux_menu.png │ ├── image-linux_rebuild.png │ ├── image-linux_savedefconfig.png │ ├── image-make.png │ ├── image-make_men.png │ ├── image-make_menu.png │ ├── image-make_savedef.png │ ├── image-make_u.png │ ├── image-makeout.png │ ├── image-makeresult.png │ ├── image-mdk_dts.png │ ├── image-pre1.png │ ├── image-pull_docker.png │ ├── image-riscv.png │ ├── image-sd_pre0.png │ ├── image-uboot-rebuild.png │ ├── image-uboot_men.png │ ├── image-uboot_menu.png │ ├── image-uboot_r.png │ ├── image-uboot_savedefconfig.png │ └── image-vi_config.png ├── sdk_guides │ ├── sdk_defconfig.png │ ├── sdk_dir1.png │ ├── sdk_dir2.png │ ├── sdk_images.png │ ├── sdk_knownissue1.png │ ├── sdk_menuconfig.png │ ├── sdk_nfsboot1.png │ ├── sdk_nfsboot2.png │ ├── sdk_nfsboot3.png │ ├── sdk_version.png │ └── sdk_win32disk.png ├── system_memory_map │ └── k510-system-memory-map.png └── uboot_guides │ └── build_out.png └── utils └── AI_Application └── aidemo_sdk ├── examples └── python_inference_on_PC │ ├── box_utils.py │ ├── data │ ├── bus.jpg │ └── bus_out.jpg │ └── yolov5_image.py ├── models ├── kmodel │ └── .gitkeep └── onnx │ └── .gitkeep └── scripts ├── gen_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py └── sim_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 贡献指南 2 | 3 | 首先感谢您参与本开源项目,在您提交issue和pull request之前请认真阅读本指南 4 | 5 | 在提交pull request时一定要关联相应的issue,如果没有相应issue,请先创建issue 6 | 关于pull request关联issue,GitHub支持自动和手动关联,具体操作请参考[Link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) 7 | 8 | issue和pull request填写时都支持Markdown,关于GitHub的Markdown语法和扩展请参考[GitHub Flavored Markdown](https://docs.github.com/en/get-started/writing-on-github) 9 | 10 | ## 提交issue 11 | 12 | 1. 打开issue界面 [isuue](https://github.com/kendryte/k510_docs/issues) 13 | 2. 查看issue列表中是否已经存在相似issue,如果没有请点击`New issue`按钮 14 | 3. 根据您的问题类型,选择不同的issue模板 15 | 4. 填写必须项后(带红色\*标记),点击`Submit new issue`按钮完成提交 16 | 17 | ## 提交pull request 18 | 19 | 1. Fork本仓库到您的github 20 | 2. Clone仓库到您本地 21 | 3. 您可以基于`main`或`dev`分支创建新分支并添加更改`git checkout -b newbranch -l main|dev` 22 | 4. 提交您的更改到您的github 23 | 5. 进入您的github仓库点击`Pull request`按钮后点击`New pull request`按钮 24 | 6. 选择`base repository`为`kendryte/k510_docs`,选择`base`为`dev`,选择`head repository`为`yourname/k510_docs`,选择`compare`为`newbranch` 25 | 7. 根据pull request模板要求填写您的描述 26 | 8. 点击`Create pull request`完成提交 27 | 28 | > 如果您对以上流程还有不清楚的地方请参考[GitHub PR Flow](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests) 29 | 30 | ## Markdown检查 31 | 32 | 本项目会对上传的Markdown文件进行格式化检查和内部引用链接检查,如果不符合格式要求或存在不能访问的链接,CI会报异常,导致PR不能被merge,因此提交PR前请确保您已在本地进行过检查 33 | 格式检查工具使用的是`markdownlint`,规则配置文件是[markdownlint.json](../.markdownlint.json)。本地可使用`vscode`安装`markdownlint`来进行在线检查和格式化 34 | 您也可以在提交PR之前,先push到您GitHub仓库的`check`分支进行CI检查,避免重复修改PR 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: kendryte Official Website 4 | about: kendryte 官方网站 5 | url: https://canaan-creative.com/product/%E5%8B%98%E6%99%BAk510 6 | - name: kendryte Community 7 | about: kendryte 开发者社区 8 | url: https://canaan-creative.com/developer 9 | - name: K510 CRB-KIT Link 10 | about: K510 CRB-KIT 购买链接 11 | url: https://item.taobao.com/item.htm?spm=a230r.1.14.1.22714815bDh5ei&id=673510674381&ns=1&abbucket=0&mt= 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/errata.yml: -------------------------------------------------------------------------------- 1 | name: Errata 2 | description: 向我们反馈错误 3 | title: "[Errata]: " 4 | labels: ["errata"] 5 | assignees: 6 | - wycwyhwyq 7 | body: 8 | - type: textarea 9 | id: errata 10 | attributes: 11 | label: Errata 12 | description: 勘误 13 | placeholder: | 14 | Please describe the wrong document and location. (请您描述一下错误的文档及位置) 15 | Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. (您能点击这个区域然后拖动文件来添加图片或文件) 16 | validations: 17 | required: true 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/improvement.yml: -------------------------------------------------------------------------------- 1 | name: Improvement 2 | description: 向我们提出改进 3 | title: "[Improvement]: " 4 | labels: ["improvement"] 5 | assignees: 6 | - wycwyhwyq 7 | body: 8 | - type: textarea 9 | id: improvement 10 | attributes: 11 | label: Improvement 12 | description: 改进 13 | placeholder: | 14 | You can suggest to us to add some content or modify the typography. (您可以向我们建议新增某些内容或修改排版) 15 | Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. (您能点击这个区域然后拖动文件来添加图片或文件) 16 | validations: 17 | required: true 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.yml: -------------------------------------------------------------------------------- 1 | name: Other 2 | description: 其它问题 3 | title: "[other]: " 4 | labels: [] 5 | assignees: 6 | - wycwyhwyq 7 | body: 8 | - type: textarea 9 | id: other 10 | attributes: 11 | label: Other 12 | description: 其它问题 13 | placeholder: | 14 | If you have any other questions you can describe them here. (如果您有任何其它问题可以在这里描述) 15 | Tip: You can attach images or files by clicking this area to highlight it and then dragging files in. (您能点击这个区域然后拖动文件来添加图片或文件) 16 | validations: 17 | required: true 18 | -------------------------------------------------------------------------------- /.github/config/markdownlink.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": [ 3 | { 4 | "pattern": "^https://docs.github.com" 5 | }, 6 | { 7 | "pattern": "^/", 8 | "replacement": "{{BASEURL}}/" 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ## PR描述: 10 | 11 | 12 | ## 关联issue: 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/markdown_check.yml: -------------------------------------------------------------------------------- 1 | name: markdown check 2 | on: 3 | pull_request: 4 | branches: 5 | - main 6 | - dev 7 | push: 8 | branches: 9 | - check 10 | jobs: 11 | markdown_check: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out repository code 15 | uses: actions/checkout@v3 16 | - name: Check markdown format 17 | uses: avto-dev/markdown-lint@v1.5.0 18 | with: 19 | config: ".markdownlint.json" 20 | args: "**/*.md" 21 | - name: Check markdown link 22 | uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 23 | with: 24 | use-quiet-mode: "yes" 25 | folder-path: "./" 26 | config-file: '.github/config/markdownlink.json' 27 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "first-line-h1": false, 4 | "no-alt-text": false, 5 | "no-inline-html": false, 6 | "header-style": { 7 | "style": "consistent" 8 | }, 9 | "ul-indent": { 10 | "indent": 2 11 | }, 12 | "line-length": false, 13 | "no-duplicate-header": { 14 | "allow_different_nesting": true 15 | }, 16 | "ul-style": { 17 | "style": "consistent" 18 | } 19 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022, Canaan Bright Sight Co., Ltd 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 14 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 15 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Gitee repository](https://img.shields.io/badge/gitee-repository-blue?logo=gitee&style=plastic)](https://gitee.com/kendryte/k510_docs) 2 | [![GitHub release](https://img.shields.io/github/v/release/kendryte/k510_docs?color=brightgreen&display_name=tag&logo=github&style=plastic)](https://github.com/kendryte/k510_docs/releases) 3 | 4 | * [English](en/README.md) 5 | * [简体中文](zh/README.md) 6 | 7 | # Documentation overview 8 | 9 | K510 related documentation is as follows: 10 | 11 | | Document name | Document description | 12 | |----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| 13 | | [K510_CRB_V1.2_Hardware_Guide.md](en/K510_CRB_V1.2_Hardware_Guide.md) | K510 CRB Version 1.2 hardware resource description documentation | 14 | | [K510_SDK_Build_and_Burn_Guide.md](en/K510_SDK_Build_and_Burn_Guide.md) | The K510 SDK compiles and burns the documentation | 15 | | [K510_System_memory_map.md](en/K510_System_memory_map.md) | K510 SDK system memory division documentation | 16 | | [K510_SDK_Application_Guides.md](en/K510_SDK_Application_Guides.md) | K510 Refer to the sample program documentation | 17 | | [K510_nncase_Developer_Guides.md](en/K510_nncase_Developer_Guides.md) | K510 compiler usage documentation | 18 | | [K510_AI_Application_Guides.md](en/K510_AI_Application_Guides.md) | k510 AI app deployment process documentation | 19 | | [K510_U-Boot_Developer_Guides.md](en/K510_U-Boot_Developer_Guides.md) | K510 SDK uboot documentation | 20 | | [K510_Linux_Kernel_Driver_Developer_Guides.md](en/K510_Linux_Kernel_Driver_Developer_Guides.md) | K510 SDK kernel documentation | 21 | | [K510_SDK_DSP_CORE_Guide.md](en/K510_SDK_DSP_CORE_Guide.md) | K510 DSP Core Usage Documentation | 22 | | [K510_V4l2_Developer_Guides.md](en/K510_V4l2_Developer_Guides.md) | K510 V4L2 application example documentation | 23 | | [K510_V4l2_Sensor_Developer_Guides.md](en/K510_V4l2_Sensor_Developer_Guides.md) | K510 sensor development documentation | 24 | | [K510_Drm_Developer_Guides.md](en/K510_Drm_Developer_Guides.md) | K510 DRM API interface documentation | 25 | | [K510_Multimedia_Developer_Guides.md](en/K510_Multimedia_Developer_Guides.md) | K510 Multimedia application example documentation | 26 | | [K510_Mailbox_Developer_Guides.md](en/K510_Mailbox_Developer_Guides.md) | K510 Multiprocessor Communication Documentation | 27 | | [K510_ISP_Tuning_Tool_Guides.md](en/K510_ISP_Tuning_Tool_Guides.md) | [K510 ISP Tuning Tool documentation](https://github.com/kendryte/k510_isp_tuning_tool/releases) | 28 | | [K510_CRB_SCH_MECH_FILE.zip](https://github.com/kendryte/k510_docs/releases/download/v1.8/K510_CRB_SCH_MECH_FILE.zip) | Schematic and Mechanical dimension drawing of K510 Core module and K510 CRB | 29 | 30 | ## Contribute this project 31 | 32 | If you are interested in this project and would like feedback or submit documentation, please refer to[CONTRIBUTING](/.github/CONTRIBUTING.md) 33 | 34 | ## Contact us 35 | 36 | Canaan Inc. 37 | Website:[canaan-creative.com](https://www.canaan-creative.com/) 38 | Business Inquiry:[salesAI@canaan-creative.com](mailto:salesAI@canaan-creative.com) 39 | -------------------------------------------------------------------------------- /en/K510-CRB-KIT_AWS_Quick_Start_Guide.md: -------------------------------------------------------------------------------- 1 | # K510-CRB-KIT AWS Quick Start Guide 2 | 3 | ## 1. Document information 4 | 5 | ### 1.1 Product name 6 | 7 | K510-CRB-KIT 8 | 9 | ### 1.2 Version 10 | 11 | |Version|Date|Description|Author| 12 | | :- | :- | :- | :- | 13 | |1.0.0|2022-06-13|First version|Wanghao Zhangtao Shiwentao| 14 | 15 | ## 2. Overview 16 | 17 | Kendryte K510 is the second-generation AI edge-side inference chip launched by Canaan, providing high-performance image and voice processing capabilities. It integrates the latest generation image processor ISP, supports TOF depth signal access. 18 | 19 | K510-CORE is the core module, with a K510 chip onboard, with a dual-core 64bit RISC-V architecture. K510 is equipped with the second-generation neural network processor KPU 2.0, using independent computing data-flow technology. Compared with the previous generation, it has improved computing power significantly while reducing power consumption. The onboard memory is 512MB LPDDR3@1600MHz. It supports two MIPI serial image inputs and one DVP parallel image input, and supports one MIPI image output. 20 | 21 | K510 CRB-KIT is a developer kit based on the K510 chip. It adopts a hierarchical design and is based on the K510 core module. 22 | 23 | ## 3. Hardware Description 24 | 25 | ### 3.1 DataSheet 26 | 27 | 28 | 29 | ### 3.2 Standard Kit Contents 30 | 31 | - K510 Customer Reference Board KIT x1 32 | - USB to typeC cable x2 33 | - USB to micro OTG cable x1 34 | 35 | ### 3.3 User Provided items 36 | 37 | - 5V@2A USB power adapter 38 | 39 | ### 3.4 Additional Hardware References 40 | 41 | NO 42 | 43 | ## 4. Set up your Development Environment 44 | 45 | 1. Install Docker Desktop on Ubuntu 46 | Download the Installation package: [Download](https://desktop.docker.com/linux/main/amd64/docker-desktop-4.9.1-amd64.deb?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-linux-amd64) 47 | 48 | Install Docker Desktop: 49 | 50 | ```shell 51 | sudo apt-get install ./docker-desktop-4.9.1-amd64.deb 52 | ``` 53 | 54 | Reference: 55 | 56 | 2. Download K510 SDK: 57 | 58 | ```shell 59 | git clone https://github.com/kendryte/k510_buildroot.git 60 | ``` 61 | 62 | 3. Start Docker environment: 63 | 64 | ```shell 65 | sh k510_buildroot/tools/docker/run_k510_docker.sh 66 | ``` 67 | 68 | 4. Generate firmware: 69 | 70 | ```shell 71 | make 72 | ``` 73 | 74 | __(On the docker env)__ 75 | 5. Burn the firmware to TF Card: 76 | 77 | ```shell 78 | sudo dd if=k510_buildroot/k510_crb_lp3_v1_2_defconfig/image/sysimage-sdcard.img of=/dev/sdx oflag=sync bs=1M 79 | ``` 80 | 81 | __(Use your actual device path instead of '/dev/sdx')__ 82 | 83 | ## 5. Set up your hardware 84 | 85 | - Front view of the hardware 86 | 87 | ![](/zh/images/aws_quick_start/board_front.png) 88 | 89 | - Back view of the hardware 90 | 91 | ![](/zh/images/aws_quick_start/board_back.png) 92 | 93 | - 5V@2A USB power adaptor, USB to type-C cable 94 | - Run your application 95 | - Follow the section 4.5 to burn your code to TF card, then put that card into TF card slot of board 96 | - Make sure the boot mode is on TF card mode (BOOT0=OFF, BOOT1=ON). Refer to blew boot setting table 97 | - Connect power adapter to Type-C port of board (refer to front view picture) 98 | - Turn the power switch from OFF to ON and wait system up 99 | - Boot mode setting table 100 | 101 | ![](/zh/images/aws_quick_start/boot_mode.png) 102 | 103 | - Uart driver download page: [Download](https://www.wch.cn/downloads/CH341SER_EXE.html) 104 | 105 | ## 6. Setup your AWS account and Permissions 106 | 107 | ### 6.1 Sign up for an AWS account 108 | 109 | 1. Open 110 | 2. Follow the online instructions. 111 | 112 | __Note:Save your AWS account number, because you need it for the next task.__ 113 | 114 | ### 6.2 Create a user and grant permissions 115 | 116 | 1. Sign in to the [IAM console](https://console.aws.amazon.com/iam/) as the account owner by choosing Root user and entering your AWS account email address. On the next page, enter your password. 117 | 2. In the navigation pane, choose Users and then choose Add users. 118 | 3. For User name, enter iot_test 119 | 4. Select the check box next to AWS Management Console access. Then select Custom password, and then enter your new password in the text box. 120 | 5. (Optional) By default, AWS requires the new user to create a new password when first signing in. You can clear the check box next to User must create a new password at next sign-in to allow the new user to reset their password after they sign in. 121 | 6. Choose Next: Permissions. 122 | 7. Under Set permissions, choose Add user to group. 123 | 8. Choose Create group. 124 | 9. In the Create group dialog box, for Group name enter iot_test 125 | 10. Choose Filter policies, and then select AWS managed - job function to filter the table contents. 126 | 11. In the policy list, select the check box for AWSIoTDataAccess and AWSIoTConfigAccess. Then choose Create group. 127 | 12. Back in the list of groups, select the check box for your new group. Choose Refresh if necessary to see the group in the list. 128 | 13. Choose Next: Tags. 129 | 14. (Optional) Add metadata to the user by attaching tags as key-value pairs. For more information about using tags in IAM, see [Tagging IAM entities](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) in the *IAM User Guide*. 130 | 15. Choose Next: Review to see the list of group memberships to be added to the new user. When you are ready to proceed, choose Create user. 131 | 132 | ## 7. Create Resources in AWS IoT 133 | 134 | ### 7.1 Create an AWS IoT Policy 135 | 136 | Create an AWS IoT Policy document for your device to interact with AWS IoT services 137 | 138 | Navigate to IoT Core console > Manage > Security > Policy and click on “Create policy” 139 | 140 | __Note: A new policy must have a name and policy document.__ 141 | 142 | ![](/zh/images/aws_quick_start/create_policy.png) 143 | 144 | Then chose Policy statements > Policy document > JSON and add policy. 145 | 146 | Sample Policy: 147 | 148 | ```json 149 | { 150 | "Version": "2012-10-17", 151 | "Statement": [ 152 | { 153 | "Effect": "Allow", 154 | "Action": [ 155 | "iot:Publish", 156 | "iot:Receive", 157 | "iot:Subscribe" 158 | ], 159 | "Resource": [ 160 | "*" 161 | ] 162 | }, 163 | { 164 | "Effect": "Allow", 165 | "Action": [ 166 | "iot:Connect" 167 | ], 168 | "Resource": [ 169 | "arn:aws:iot:region:AWS-account-ID:client/*" 170 | ] 171 | } 172 | ] 173 | } 174 | ``` 175 | 176 | __NOTE – The examples in this document are intended only for dev environments. All devices in your production fleet must have credentials with privileges that authorize only intended actions on specific resources. The specific permission policies can vary for your use case. Identify the permission policies that best meet your business and security requirements. For more information, refer to Example policies and Security Best practices.__ 177 | 178 | ### 7.2 Create a new Device 179 | 180 | Navigate to IoT Core console > Manage > All Devices > Things and click on “Create Things” 181 | 182 | ![](/zh/images/aws_quick_start/create_things.png) 183 | 184 | Then click Create single thing 185 | 186 | ![](/zh/images/aws_quick_start/create_single_thing.png) 187 | 188 | Then add the name of new device 189 | 190 | ![](/zh/images/aws_quick_start/thing_properties.png) 191 | 192 | Then choose Auto-generate a new certificate (recommended) 193 | 194 | ![](/zh/images/aws_quick_start/device_certificate.png) 195 | 196 | Then choose your policy 197 | 198 | ![](/zh/images/aws_quick_start/attach_policies.png) 199 | 200 | Download the certificate, public key, and private key for the device. Next, download the root CA for AWS IoT. Finally, click Done. 201 | 202 | ![](/zh/images/aws_quick_start/download_crts_keys.png) 203 | 204 | ## 8. Provision the Device with credentials 205 | 206 | Make sure you have downloaded the k510_buildroot file in step four, put the file generated in step 7 into the certs folder, as shown in the figure 207 | 208 | ![](/zh/images/aws_quick_start/certs_folder.png) 209 | 210 | Change variable name in `k510_buildroot/package/aws_iot_test/subscribe_publish_sample/aws_iot_config.h` file 211 | 212 | ![](/zh/images/aws_quick_start/aws_iot_config.png) 213 | 214 | After all changes are completed, run the compiler on the premise that the build_root has been compiled 215 | 216 | ```shell 217 | cd k510_buildroot/k510_crb_lp3_v1_2_defconfig 218 | make aws_iot_test-rebuild 219 | ``` 220 | 221 | After compilation, you can see the file in the `k510_buildroot/k510_crb_lp3_v1_2_defconfig/target/app/aws_iot_test` folder 222 | 223 | ## 9. Build the demo 224 | 225 | Compile k510_buildreoot, aws_iot_test has been compiled in package, and the generated executable file is in `/app/aws_iot_test` 226 | 227 | ## 10. Run the demo 228 | 229 | To verify MQTT messages are being received by AWS IoT Core: 230 | Follow the instructions at 231 | 232 | Please enter the command on the serial port debugging page 233 | 234 | ```shell 235 | cd /app/aws_iot_test 236 | ./aws_iot_test 237 | ``` 238 | 239 | Display on the development k510 board 240 | 241 | ![](/zh/images/aws_quick_start/aws_iot_test.png) 242 | 243 | AWS IoT MQTT Test Client display 244 | 245 | ![](/zh/images/aws_quick_start/certification_display.png) 246 | 247 | Each time an individual item is verified, just run aws_iot_test directly, and the final result is displayed 248 | 249 | ![](/zh/images/aws_quick_start/activity_log.png) 250 | 251 | ## 11. Debugging 252 | 253 | During debugging, all logs will be printed on the serial port debugging interface, as shown in the figure 254 | 255 | ![](/zh/images/aws_quick_start/aws_iot_test_log.png) 256 | 257 | ## 12. Troubleshooting 258 | 259 | In case of network fluctuation, the link fails. Just rerun the test program 260 | 261 | ![](/zh/images/aws_quick_start/troubleshooting.png) 262 | -------------------------------------------------------------------------------- /en/K510_AI_Application_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 AI Application Guide** 4 | 5 | Document version: V1.0.0 6 | 7 | Published: 2022-03-07 8 | 9 |
10 | 11 | **Disclaimer** 12 | The products, services or features you purchase shall be subject to the commercial contracts and terms of Beijing Canaan Jiesi Information Technology Co., Ltd. ("the Company", the same hereinafter), and all or part of the products, services or features described in this document may not be within the scope of your purchase or use. Except as otherwise agreed in the contract, the Company disclaims all representations or warranties, express or implied, as to the accuracy, reliability, completeness, marketing, specific purpose and non-aggression of any representations, information, or content of this document. Unless otherwise agreed, this document is provided solely as a guide to reasoning. 13 | Due to product version upgrades or other reasons, the contents of this document may be updated or modified from time to time without any notice. 14 | 15 | **Trademark Notices** 16 | 17 | "", "Canaan" icon, Canaan and other trademarks of Canaan and other trademarks of Canaan are trademarks of Beijing Canaan Jiesi Information Technology Co., Ltd. All other trademarks or registered trademarks that may be mentioned in this document are owned by their respective owners. 18 | 19 | **Copyright ©2022 Beijing Canaan Jiesi Information Technology Co., Ltd** 20 | This document is only applicable to the development and design of the K510 platform, without the written permission of the company, no unit or individual may disseminate part or all of the content of this document in any form. 21 | 22 | **Beijing Canaan Jiesi Information Technology Co., Ltd** 23 | URL: canaan-creative.com 24 | Business Enquiries: salesAI@canaan-creative.com 25 | 26 |
27 | # preface 28 | **Document purpose** 29 | This document is a companion document for the K510 AI application and is designed to help engineers understand the writing and application of k510 AI applications. 30 | 31 | **Reader Objects** 32 | 33 | The main people to whom this document (this guide) applies: 34 | 35 | - Software developers 36 | - Technical support personnel 37 | 38 | **Revision history** 39 | The revision history accumulates a description of each document update. The latest version of the document contains updates for all previous versions. 40 | 41 | | The version number | Modified by | Date of revision | Revision Notes | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | AI Products Division | 2022-03-07 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **Contents** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 Introduction 58 | 59 | This document describes the writing and application of K510 AI applications. Based on the K510 AI chip, AI application development has the following stages: 60 | 61 | Model preparation: The trained model is validated on the PC side (static picture inference can be used) to ensure the correctness of the model 62 | 63 | Model generation: The trained model is compiled using the nncase compiler to generate a kmodel 64 | 65 | Model Validation: The generated kmodel is validated with precision using the nncase simulator 66 | 67 | Write AI applications: complete video/image reading, input preprocessing, model inference, model post-processing 68 | 69 | Compile AI applications: Use the cross-compilation toolchain to compile K510 AI applications 70 | 71 | Deployment and co-commissioning: The compiled AI application is deployed to the K510 hardware product, and the functional co-debugging is carried out in the actual scenario 72 | 73 | The overall architecture of AI application development on the K510 AI chip is shown in the following figure: 74 | 75 | ![](../zh/images/ai_demo/image-ai-demo.png) 76 | 77 | This document will take the onnx model of 320x320 resolution YOLOV5s as an example to introduce the entire process of writing and applying K510 AI applications. 78 | 79 | # 2 Model preparation 80 | 81 | The onnx model for YOLOV5s for inference is located in the /docs/utils/AI_Application/aidemo_sdk/models/onnx subdirectory (download models if no files are available[](https://github.com/kendryte/k510_docs/releases/download/v1.5/models.tar.gz).) and unzip), the static image is located in the /docs/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/data subdirectory, and the script is located in the /docs/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC subdirectory. 82 | 83 | Follow the script command prompt to run the yolov5_image.py script to obtain the inference result of the static picture. Detect the correctness of the model by verifying that the detection box of the output picture is correct or not. 84 | 85 | ```shell 86 | usage: yolov5_image.py [-h] [--image_path IMAGE_PATH] 87 | [--image_out_path IMAGE_OUT_PATH] 88 | [--onnx_path ONNX_PATH] 89 | [--confidence_threshold CONFIDENCE_THRESHOLD] 90 | [--nms_threshold NMS_THRESHOLD] 91 | 92 | object detect 93 | 94 | optional arguments: 95 | -h, --help show this help message and exit 96 | --image_path IMAGE_PATH 97 | input image path 98 | --image_out_path IMAGE_OUT_PATH 99 | output image path 100 | --onnx_path ONNX_PATH 101 | onnx model path 102 | --confidence_threshold CONFIDENCE_THRESHOLD 103 | confidence_threshold 104 | --nms_threshold NMS_THRESHOLD 105 | nms_threshold 106 | ``` 107 | 108 | # 3 Model generation 109 | 110 | Model generation depends on the nncase compiler, and the specific rules for using the nncase compiler can be found[K510_nncase_Developer_Guides.md](./K510_nncase_Developer_Guides.md). The script that generates the kmodel for YOLOV5s is located in the /docs/utils/AI_Application/aidemo_sdk/scripts subdirectory. 111 | 112 | At the command prompt of the script, run the gen_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py to generate the corresponding kmodel. 113 | 114 | ```shell 115 | usage: gen_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py [-h] [--target TARGET] [--dump_dir DUMP_DIR] [--onnx ONNX] [--kmodel KMODEL] 116 | 117 | optional arguments: 118 | -h, --help show this help message and exit 119 | --target TARGET target to run 120 | --dump_dir DUMP_DIR temp folder to dump 121 | --onnx ONNX onnx model path 122 | --kmodel KMODEL kendryte model path 123 | ``` 124 | 125 | It should be noted that in order to minimize preprocessing on the CPU, the compilation options in the script are configured as follows: 126 | 127 | ```python 128 | compile_options.input_type = 'uint8' 129 | compile_options.preprocess = True 130 | compile_options.input_layout = 'NCHW' 131 | compile_options.output_layout = 'NHWC' 132 | compile_options.input_shape = [1, 3, 320, 320] 133 | compile_options.mean = [0, 0, 0] 134 | compile_options.std = [255, 255, 255] 135 | compile_options.input_range = [0, 255] 136 | ``` 137 | 138 | # 4 Model validation 139 | 140 | Model validation depends on nncase simulator, and the specific rules for using nncase simulator can be found[in K510_nncase_Developer_Guides.md](./K510_nncase_Developer_Guides.md). Verify that yolov5s' kmodel script is located in the /docs/utils/AI_Application/aidemo_sdk/scripts subdirectory. 141 | 142 | At the script command prompt, run simu_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py to verify that the corresponding kmodel is generated correctly. 143 | 144 | ```shell 145 | usage: sim_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py [-h] [--onnx ONNX] [--kmodel KMODEL] 146 | 147 | optional arguments: 148 | -h, --help show this help message and exit 149 | --onnx ONNX original model file 150 | --kmodel KMODEL kmodel file 151 | ``` 152 | 153 | If the cosine similarity is close to 1 or equal to 1, the correctness of the generated kmodel is ensured. 154 | 155 | ```text 156 | output 0 cosine similarity : 0.9999450445175171 157 | output 1 cosine similarity : 0.9999403953552246 158 | output 2 cosine similarity : 0.9999019503593445 159 | ``` 160 | 161 | # 5 Write AI applications 162 | 163 | Model validation depends on the nncase runtime, and the specific rules for using the nncase runtime can be found[K510_nncase_Developer_Guides.md](./K510_nncase_Developer_Guides.md). AI Application Reference`k510_buildroot/package/ai/code/object_detect`. First, you need to create an object detection instance and allocate space for the kmodel input and output. 164 | 165 | ```c++ 166 | objectDetect od(obj_thresh, nms_thresh, net_len, {valid_width, valid_height}); 167 | od.load_model(kmodel_path); // load kmodel 168 | od.prepare_memory(); // memory allocation 169 | ``` 170 | 171 | To implement zero memory copy, associate the ISP output address with the kmodel input address 172 | 173 | ```c++ 174 | // define cv::Mat for ai input 175 | // padding offset is (valid_width - valid_height) / 2 * valid_width 176 | cv::Mat rgb24_img_for_ai(net_len, net_len, CV_8UC3, od.virtual_addr_input[0] + (valid_width - valid_height) / 2 * valid_width); 177 | ``` 178 | 179 | Configures the width and height of the ISP output 180 | 181 | ```c++ 182 | /****fixed operation for video operation****/ 183 | mtx.lock(); 184 | cv::VideoCapture capture; 185 | capture.open(5); 186 | // video setting 187 | capture.set(cv::CAP_PROP_CONVERT_RGB, 0); 188 | capture.set(cv::CAP_PROP_FRAME_WIDTH, net_len); 189 | capture.set(cv::CAP_PROP_FRAME_HEIGHT, net_len); 190 | // RRRRRR....GGGGGGG....BBBBBB, CHW 191 | capture.set(cv::CAP_PROP_FOURCC, V4L2_PIX_FMT_RGB24); 192 | mtx.unlock(); 193 | ``` 194 | 195 | Configure the appropriate video configuration file, video_height_r the true output height of the ISP, and the video_height the height offset between the different channels of the ISP 196 | 197 | ```json 198 | "/dev/video5":{ 199 | "video5_used":1, 200 | "video5_width":320, 201 | "video5_height":320, 202 | "video5_height_r":240, 203 | "video5_out_format":0 204 | } 205 | ``` 206 | 207 | Associate the input and output addresses with the input_tensor and output_tensor of the kmodel 208 | 209 | ```c++ 210 | od.set_input(0); 211 | od.set_output(); 212 | ``` 213 | 214 | Run the kmodel, get the output result, and perform post-processing 215 | 216 | ```c++ 217 | { 218 | ScopedTiming st("od run", enable_profile); 219 | od.run(); 220 | } 221 | 222 | { 223 | ScopedTiming st("od get output", enable_profile); 224 | od.get_output(); 225 | } 226 | std::vector result; 227 | { 228 | ScopedTiming st("post process", enable_profile); 229 | od.post_process(result); 230 | } 231 | ``` 232 | 233 | Finally, draw the detection box on the OSD to display the output 234 | 235 | ```c++ 236 | { 237 | ScopedTiming st("draw osd", enable_profile); 238 | obj_cnt = 0; 239 | for (auto r : result) 240 | { 241 | if (obj_cnt < 32) 242 | { 243 | struct vo_draw_frame frame; 244 | frame.crtc_id = drm_dev.crtc_id; 245 | frame.draw_en = 1; 246 | frame.frame_num = obj_cnt; 247 | frame.line_y_start = r.x2 * DRM_INPUT_WIDTH / valid_width; 248 | frame.line_x_start = r.x1 * DRM_INPUT_WIDTH / valid_width; 249 | frame.line_x_end = r.y1 * DRM_INPUT_HEIGHT / valid_height + DRM_OFFSET_HEIGHT; 250 | frame.line_y_end = r.y2 * DRM_INPUT_HEIGHT / valid_height + DRM_OFFSET_HEIGHT; 251 | draw_frame(&frame); 252 | 253 | cv::Point origin; 254 | origin.x = (int)(r.x1 * DRM_INPUT_WIDTH / valid_width); 255 | origin.y = (int)(r.y1 * DRM_INPUT_HEIGHT / valid_height + 10); 256 | std::string text = od.labels[r.label] + ":" + std::to_string(round(r.score * 100) / 100.0).substr(0,4); 257 | cv::putText(img_argb, text, origin, cv::FONT_HERSHEY_COMPLEX, 1.5, cv::Scalar(0, 0, 255, 255), 1, 8, 0); 258 | } 259 | obj_cnt += 1; 260 | } 261 | } 262 | ``` 263 | 264 | # 6 Compile AI applications 265 | 266 | Using the cross-compilation toolchain, the specific rules for the compilation of AI applications can be referred to[K510_SDK_Build_and_Burn_Guide](./K510_SDK_Build_and_Burn_Guide.md). 267 | 268 | **Translation Disclaimer** 269 | For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail. 270 | 271 | If you would like to report a translation error or inaccuracy, please feel free to contact us by mail. 272 | -------------------------------------------------------------------------------- /en/K510_ISP_Tuning_Tool_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 ISP Tuning Tool Guides** 4 | 5 | Document version: V1.0.0 6 | 7 | Published: 2022-03-31 8 | 9 |
10 | 11 | **Disclaimer** 12 | The products, services or features you purchase shall be subject to the commercial contracts and terms of Beijing Canaan Jiesi Information Technology Co., Ltd. ("the Company", the same hereinafter), and all or part of the products, services or features described in this document may not be within the scope of your purchase or use. Except as otherwise agreed in the contract, the Company disclaims all representations or warranties, express or implied, as to the accuracy, reliability, completeness, marketing, specific purpose and non-aggression of any representations, information, or content of this document. Unless otherwise agreed, this document is provided as a guide for use only. 13 | Due to product version upgrades or other reasons, the contents of this document may be updated or modified from time to time without any notice. 14 | 15 | **Trademark Notices** 16 | 17 | "", "Canaan" icon, Canaan and other trademarks of Canaan and other trademarks of Canaan are trademarks of Beijing Canaan Jiesi Information Technology Co., Ltd. All other trademarks or registered trademarks that may be mentioned in this document are owned by their respective owners. 18 | 19 | **Copyright ©2022 Beijing Canaan Jiesi Information Technology Co., Ltd** 20 | This document is only applicable to the development and design of the K510 platform, without the written permission of the company, no unit or individual may disseminate part or all of the content of this document in any form. 21 | 22 | **Beijing Canaan Jiesi Information Technology Co., Ltd** 23 | URL: canaan-creative.com 24 | Business Enquiries: salesAI@canaan-creative.com 25 | 26 |
27 | # preface 28 | **Document purpose** 29 | This document is an ISP Tuning Tool documentation. 30 | 31 | **Reader Objects** 32 | 33 | The primary audience for this document is experienced software engineers, image algorithm engineers, system designers, and system integrators who want to implement proprietary applications and drivers. 34 | 35 | **Revision history** 36 | The revision history accumulates a description of each document update. The latest version of the document contains updates for all previous versions. 37 | 38 | | The version number | Modified by | Date of revision | Revision Notes | 39 | | :----- |------- | ------ | ------ | 40 | | V1.0.0 | System software groups | 2022-03-31 | SDK V1.6 released | 41 | 42 |
43 | **Contents** 44 | 45 | [TOC] 46 | 47 |
48 | 49 | # Introduction to the ISP Tuning Tool Framework 50 | 51 | This section describes the ISP tuning tools and descriptions of the data streams that are provided to the upper-level processors to control the overall ISP image optimization. 52 | 53 | ```text 54 | +----------------------------------------------------+ 55 | | | 56 | | K510 | 57 | | | 58 | | +-------+ +--------------------------+ | 59 | | | | | | | 60 | | | ISP +------> | v4l2_drm.out | | 61 | | | | | | | 62 | | +-------+ +-------------+------------+ | 63 | | | | 64 | | | | 65 | | +-----------------+ | | 66 | | | | | | 67 | | | isp-tuningd | <----------+ | 68 | | | | | 69 | | +^-+--------------+ | 70 | | | | | 71 | | | | | 72 | +----------------------------------------------------+ 73 | | | 74 | | | 75 | +-------------------------------+ 76 | | | | | 77 | | | | PC | 78 | | | | | 79 | | ++-v------------------+ | 80 | | | | | 81 | | | ISP Tuning Tool | | 82 | | | | | 83 | | +---------------------+ | 84 | | | 85 | +-------------------------------+ 86 | ``` 87 | 88 | ## Tune the tool traffic 89 | 90 | The communication protocol can be found in the documentation in the client code repository, and the tool consists of two parts, one is the client isp-tuningd running on the PC, the program is located in the /app/mediactl_lib/isp-tuningd, and the other part is the server running on the K510. By default, TCP's port 9982 is used for communication. 91 | 92 | ### client 93 | 94 | The ISP Tuning Tool is an application that runs on a PC. In addition to being able to set registers, AWB calibration and CCM calibration are also supported. 95 | 96 | ### Server-side 97 | 98 | isp-tuningd receives a yuv image (NV12) in size of 3133440 bytes from the standard input and broadcasts it to all clients, we can use v4l2_drm, it will automatically start isp-tuningd and send in the image data, the specific usage is consistent with the v4l2_drm. We can run it with the following command 99 | 100 | ```shell 101 | cd /app/mediactl_lib 102 | # use camera 0 103 | ./v4l2_drm.out -t 0 -f video_drm_1080x1920.conf 104 | 105 | # use camera 1 106 | ./v4l2_drm.out -t 1 -f video_drm_1080x1920_r2k.conf 107 | ``` 108 | 109 | If you don't need to view the picture, just launch isp-tuningd 110 | 111 | ```shell 112 | /app/mediactl_lib/isp-tuningd 113 | ``` 114 | 115 | # ISP tuning options 116 | 117 | Many registers and tables are provided in the K510 ISP for control and tuning. The setting of the ISP hardware registers is very important for image quality. At present, on the K510 platform, the image tuning process is only implemented through TCP Socket. 118 | 119 | ## Tuning tool main window 120 | 121 | This section describes the features of these panels on the tuning window. 122 | 123 | Figure 3-1 shows the entire operator panel on the tuning window 124 | 125 | - Panel 1 is the**menu**that can optionally load the configured ISP file or perform calibration. 126 | - Panel 2 is the **connection control panel**, fill in the IP address and port number of the development board (default port 9982) and click the green connect button to connect. 127 | - Panel 3 is the**register panel**, if you need to set or read the register is not in this one, you can use this panel to set and read. 128 | - Panel 4 is a tuning **parameter selection panel**, the user can select various parameters or groups of parameters according to the panel prompt text, the registers of these selections will be displayed on panel 5. 129 | - Panel 5 is the **Tuning Parameter Settings panel**, which is used to set or obtain parameter values from the tuning server. 130 | - Panel 6 is an **image display panel**, which displays the image output by the ISP and can click the pause button in the middle when it is not necessary to play all the time. 131 | 132 | ![Figure 3-1 Tuning tool main window](../zh/images/sdk_application/clip_image033.png) 133 | 134 | THE ISP Tuning Tool **does not**automatically acquire all register values after connecting, and if you need to get all register values, you can click the**Read button on the right side of the connection control panel** to pull all the current register values. 135 | 136 | # Calibration & Calibration 137 | 138 | This section describes instructions for calibration and calibration using ISP tuning tools, including Automatic White Balance (AWB), Color Correction Matrix (CCM), Gamma, and Lens Shadows (LSC). 139 | 140 | ## AWB 141 | 142 | ### Preparations 143 | 144 | 1. Standard light box with standard D65 light source 145 | 2. Standard 24 color card, currently only X-RITE color card is supported 146 | 3. A camera ready for calibration can output a sensor original image or a processed image 147 | 4. ISP also only open the black level correction and de-mosaic algorithm module, CSC and other format conversion modules must pay attention to symmetry (matrix is inverse matrix), in addition to noise reduction, sharpening and other modules have little impact, but also try to close, nonlinear modules and color processing modules (GAMMA, wide dynamic, AWB, CCM, saturation adjustment, etc.) must be turned off 148 | 149 | ### Gets the image 150 | 151 | 1. The camera is aimed at the 24 color card, make sure the 24 color card fills the entire picture, and then grab the image, which can be clicked to pause playback without guaranteeing accuracy, as shown in the following figure 152 | 153 | ![Figure 4-1 24 color cards are taken](../zh/images/sdk_application/clip_image014.jpg) 154 | 155 | 2. The captured image should pay attention to moderate brightness and darkness, and too bright and too dark will affect the calibration 156 | 157 | ### demarcate 158 | 159 | Click "Calibration" in the menu bar, select "AWB" to perform calibration, and the program will automatically select the color card 160 | 161 | ![Figure 4-2 Auto Box Color Selector](../zh/images/sdk_application/clip_image016.jpg) 162 | 163 | Press any key to continue, popping up the image after white balance is complete 164 | 165 | ![Figure 4-3 Complete AWB calibration](../zh/images/sdk_application/clip_image018.jpg) 166 | 167 | If there is no problem, continue to press any key, the tool will pop up a dialog box asking whether the parameter is reasonable, yes will fill it into the main interface related registers, otherwise abandon the calibration result, if so, the tool will continue to ask whether to write to the device register. 168 | 169 | ## CC 170 | 171 | Consistent with AWB calibration, it will not be repeated. 172 | 173 | ## Gamma 174 | 175 | The formula for the standard gamma curve is 176 | $$ 177 | Y=aX^b 178 | $$ 179 | Where $b$ is the Gamma coefficient, which is generally less than 1 at the imaging end and greater than 1 at the display end. The value of $a$ can be calculated based on the value of $b$ 180 | 181 | $$ 182 | a=\frac{256}{256^b} 183 | $$ 184 | The principle of the formula is that the input is 256, which is still 256 after Gamma correction. 185 | 186 | When the gamma coefficient b is 0.5, the curve is shown in the following figure 187 | 188 | ![](../zh/images/sdk_application/clip_image025.png) 189 | 190 | ## LSC 191 | 192 | ### Preparations 193 | 194 | - A shot captures a photograph in RAW format 195 | 196 | ### principle 197 | 198 | Because the center of the lens is inconsistent with the surrounding light transmission, the image brightness is uneven, so the curve fit generates a corrective surface to compensate for this problem. 199 | 200 | The correction is shown in the figure below 201 | 202 | ![Before correction](../zh/images/sdk_application/clip_image029.png) 203 | 204 | After correction, it is shown in the following figure 205 | 206 | ![After correction](../zh/images/sdk_application/clip_image031.png) 207 | 208 | **Translation Disclaimer** 209 | For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail. 210 | 211 | If you would like to report a translation error or inaccuracy, please feel free to contact us by mail. 212 | -------------------------------------------------------------------------------- /en/K510_System_memory_map.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 System memory map** 4 | 5 | Document version: V1.0.0 6 | 7 | Published: 2022-03-09 8 | 9 |
10 | 11 | **Disclaimer** 12 | The products, services or features you purchase shall be subject to the commercial contracts and terms of Beijing Canaan Jiesi Information Technology Co., Ltd. ("the Company", the same hereinafter), and all or part of the products, services or features described in this document may not be within the scope of your purchase or use. Except as otherwise agreed in the contract, the Company disclaims all representations or warranties, express or implied, as to the accuracy, reliability, completeness, marketing, specific purpose and non-aggression of any representations, information, or content of this document. Unless otherwise agreed, this document is provided as a guide for use only. 13 | Due to product version upgrades or other reasons, the contents of this document may be updated or modified from time to time without any notice. 14 | 15 | **Trademark Notices** 16 | 17 | "", "Canaan" icon, Canaan and other trademarks of Canaan and other trademarks of Canaan are trademarks of Beijing Canaan Jiesi Information Technology Co., Ltd. All other trademarks or registered trademarks that may be mentioned in this document are owned by their respective owners. 18 | 19 | **Copyright ©2022 Beijing Canaan Jiesi Information Technology Co., Ltd** 20 | This document is only applicable to the development and design of the K510 platform, without the written permission of the company, no unit or individual may disseminate part or all of the content of this document in any form. 21 | 22 | **Beijing Canaan Jiesi Information Technology Co., Ltd** 23 | URL: canaan-creative.com 24 | Business Enquiries: salesAI@canaan-creative.com 25 | 26 |
27 | # preface 28 | **Document purpose** 29 | This document is a description document for the K510 SDK application example. 30 | 31 | **Reader Objects** 32 | 33 | The main people to whom this document (this guide) applies: 34 | 35 | - Software developers 36 | - Technical support personnel 37 | 38 | **Revision history** 39 | The revision history accumulates a description of each document update. The latest version of the document contains updates for all previous versions. 40 | 41 | | The version number | Modified by | Date of revision | Revision Notes | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | System software groups | 2022-03-09 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **Contents** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 K510 System Memory Planning 58 | 59 | The memory plan of the K510 is shown in the following figure: 60 | 61 | ![](../zh/images/system_memory_map/k510-system-memory-map.png) 62 | 63 | There is a 512MB DDR on the K510 crb reference board, with a total of four areas planned: 64 | 65 | - 0~240M planning for Linux kernel 66 | - 240M~496MB is planned for share memory, using the method of reserving the CMA memory pool, so that the Linux kernel memory management subsystem can also allocate memory from the CMA pool in the absence of use of Share memory 67 | - 496M~510M is planned for DSP use 68 | - 510M~512M is planned for logo use 69 | 70 | # 2 Device tree description 71 | 72 | The memory planning of the K510 is described in a reserved-meory manner, through the reserved-memory nodes of the device tree. The relevant device tree node information is as follows: 73 | 74 | ```text 75 | ddr_memory: memory@0 { 76 | status = "okay"; 77 | device_type = "memory"; 78 | reg = <0x0 0x00000000 0x0 0x20000000>; 79 | }; 80 | 81 | sharem_cma:sharem_cma@8000000 { 82 | compatible = "k510-share-memory-cma"; 83 | reg = <0x0 0xf000000 0x0 0x10000000>; /*240M~496M*/ 84 | }; 85 | 86 | reserved-memory { 87 | #address-cells = <2>; 88 | #size-cells = <2>; 89 | ranges; 90 | 91 | cma_buffer: buffer@f000000 { 92 | compatible = "shared-dma-pool"; 93 | reusable; 94 | linux,cma-default; 95 | reg = <0x0 0xf000000 0x0 0x10000000>; 96 | }; 97 | 98 | dsp_buffer: buffer@1f000000 { 99 | no-map; 100 | reg = <0x0 0x1f000000 0x0 0xe00000>; 101 | }; 102 | 103 | logo_buffer: buffer@1fe00000 { 104 | no-map; 105 | reg = <0x0 0x1fe00000 0x0 0x200000>; 106 | }; 107 | }; 108 | ``` 109 | 110 | # 3 Buildroot related configuration 111 | 112 | The system memory plan is all described in dts of the Linux kernel, but the loading address of the dsp firmware needs to be configured in buildroot: 113 | 114 | configs/k510_crb_lp3_v0_1_defconfig: 115 | 116 | configs/k510_crb_lp3_v1_2_defconfig: 117 | 118 | BR2_TARGET_EVB_FIRMWARE_LOAD_ADD=0x1f000000 119 | 120 | **Translation Disclaimer** 121 | For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail. 122 | 123 | If you would like to report a translation error or inaccuracy, please feel free to contact us by mail. 124 | -------------------------------------------------------------------------------- /en/K510_U-Boot_Developer_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 U-boot Developer's Guide** 4 | 5 | Document version: V1.0.0 6 | 7 | Published: 2022-03-09 8 | 9 |
10 | 11 | **Disclaimer** 12 | The products, services or features you purchase shall be subject to the commercial contracts and terms of Beijing Canaan Jiesi Information Technology Co., Ltd. ("the Company", the same hereinafter), and all or part of the products, services or features described in this document may not be within the scope of your purchase or use. Except as otherwise agreed in the contract, the Company disclaims all representations or warranties, express or implied, as to the accuracy, reliability, completeness, marketing, specific purpose and non-aggression of any representations, information, or content of this document. Unless otherwise agreed, this document is provided as a guide for use only. 13 | Due to product version upgrades or other reasons, the contents of this document may be updated or modified from time to time without any notice. 14 | 15 | **Trademark Notices** 16 | 17 | "", "Canaan" icon, Canaan and other trademarks of Canaan and other trademarks of Canaan are trademarks of Beijing Canaan Jiesi Information Technology Co., Ltd. All other trademarks or registered trademarks that may be mentioned in this document are owned by their respective owners. 18 | 19 | **Copyright ©2022 Beijing Canaan Jiesi Information Technology Co., Ltd** 20 | This document is only applicable to the development and design of the K510 platform, without the written permission of the company, no unit or individual may disseminate part or all of the content of this document in any form. 21 | 22 | **Beijing Canaan Jiesi Information Technology Co., Ltd** 23 | URL: canaan-creative.com 24 | Business Enquiries: salesAI@canaan-creative.com 25 | 26 |
27 | # preface 28 | **Document purpose** 29 | This document is a K510 demo board sdk supporting document, mainly introducing uboot related content, such as k510 demo board configuration file, device tree, driver location and other information under uboot. 30 | 31 | **Reader Objects** 32 | 33 | The main people to whom this document (this guide) applies: 34 | 35 | - Software developers 36 | - Technical support personnel 37 | 38 | **Revision history** 39 | The revision history accumulates a description of each document update. The latest version of the document contains updates for all previous versions. 40 | 41 | | The version number | Modified by | Date of revision | Revision Notes | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | System software groups | 2022-03-09 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **Contents** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 Introduction to U-Boot 58 | 59 | U-boot is part of sdk, and the u-boot version currently used by the SDK is 2020.01. Uboot is a bootloader program developed by the German DENX group for a variety of embedded CPUs, UBoot not only supports the boot of embedded Linux systems, currently, it also supports NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS embedded operating system. In addition to supporting the PowerPC series of processors, UBoot can also support MIPS, x86, ARM, NIOS, RISICV, etc., the main functions are initializing memory, booting Linux systems, more u-boot introduction, please refer to 60 | 61 | # 2 Introduction to the development environment 62 | 63 | - operating system 64 | 65 | | numbering | Software resources | illustrate | 66 | | ---- | -------- | ----------- | 67 | | 1 | Ubuntu | 18.04/20.04 | 68 | 69 | - Software environment 70 | 71 | The software environment requirements are shown in the following table: 72 | 73 | | numbering | Software resources | illustrate | 74 | | ---- | -------- | ---- | 75 | | 1 | K510 SDK | | 76 | 77 | # 3 How to get it 78 | 79 | Download and compile the sdk, the sdk will download the uboot code when compiling, and compile the uboot code. For more information about how to download and compile the SDK, see[K510_SDK_Build_and_Burn_Guide.md](./K510_SDK_Build_and_Burn_Guide.md) 80 | 81 | # 4 Important directories and file descriptions 82 | 83 | This chapter uses compiled k510_evb_lp3_v1_1_defconfig as an example. The corresponding sdk compilation method is make CONF=k510_evb_lp3_v1_1_defconfig, and the directory after compilation is as follows: 84 | 85 | ![image-20210930135634105](../zh/images/uboot_guides/build_out.png) 86 | 87 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom --- uboot's code and compilation directory; 88 | 89 | board/canaan/k510/uboot-sdcard.env--- uboot default environment variable configuration file 90 | 91 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom/configs/k510_evb_lp3_v1_1_defconfig --uboot configuration file; 92 | 93 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom/arch/riscv/dts/k510_evb_lp3_v1_1.dts---- device tree file; 94 | 95 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom/include/configs/k510_evb_lp3_v1_1.h--- header file; 96 | 97 | k510_evb_lp3_v1_1_defconfig/images/u-boot_burn.bin ---uboot flashes the firmware 98 | 99 | buildroot-2020.02.11/boot/uboot ----buildroot in the compilation script about uboot, generally does not need to be modified; 100 | 101 | Configs/k510_evb_lp3_v1_1_defconfig---sdk configuration file, BR2_TARGET_UBOOT_BOARD_DEFCONFIG specify the configuration file of uboot; 102 | 103 | # 5 uboot starts the process 104 | 105 | _start(arch/riscv/cpu/start. S, line 43) 106 | 107 | board_init_f(common/board_f.c, line 1013) 108 | 109 | board_init_r(common/board_r.c, line 845) 110 | 111 | run_main_loop(common/board_r.c, line 637) 112 | 113 | # 6 uboot under driver description 114 | 115 | ## 6.1 ddr driver 116 | 117 | board/Canaan/k510_evb_lp3/ddr_init.c 118 | 119 | ## 6.2 eth drive 120 | 121 | drivers/net/macb.c 122 | 123 | Device Tree: 124 | 125 | ```text 126 | ethernet@93030000 { 127 | compatible = "cdns,macb"; 128 | reg = <0x0 0x93030000 0x0 0x10000>; 129 | phy-mode = "rmii"; 130 | interrupts = <0x36 0x4>; 131 | interrupt-parent = <0x4>; 132 | clocks = <0x5 0x5>; 133 | clock-names = "hclk", "pclk"; 134 | }; 135 | ``` 136 | 137 | ## 6.3 Serial port drive 138 | 139 | drivers/serial/ns16550.c 140 | 141 | Device Tree: 142 | 143 | ```text 144 | serial@96000000 { 145 | compatible = "andestech,uart16550", "ns16550a"; 146 | reg = <0x0 0x96000000 0x0 0x1000>; 147 | interrupts = <0x19 0x4>; 148 | clock-frequency = <0x17d7840>; 149 | reg-shift = <0x2>; 150 | reg-io-width = <0x4>; 151 | no-loopback-test = <0x1>; 152 | interrupt-parent = <0x4>; 153 | }; 154 | ``` 155 | 156 | ## 6.4 iomux 157 | 158 | drivers/pinctrl/pinctrl-single.c 159 | 160 | Device Tree: 161 | 162 | ```text 163 | iomux@97040000 { 164 | compatible = "pinctrl-single"; 165 | reg = <0x0 0x97040000 0x0 0x10000>; 166 | #address-cells = <0x1>; 167 | #size-cells = <0x0>; 168 | #pinctrl-cells = <0x1>; 169 | pinctrl-single,register-width = <0x20>; 170 | pinctrl-single,function-mask = <0xffffffff>; 171 | pinctrl-names = "default"; 172 | pinctrl-0 = <0x6 0x7 0x8 0x9 0xa>; 173 | 174 | iomux_uart0_pins { 175 | pinctrl-single,pins = <0x1c0 0x540ca8 0x1c4 0x5a0c69>; 176 | phandle = <0x6>; 177 | }; 178 | 179 | iomux_emac_pins { 180 | pinctrl-single,pins = <0x8c 0x4e 0x90 0xce 0x88 0x8e 0x98 0x4e 0x80 0x8e 0xb8 0x4e 0xb4 0x4e 0xa8 0x8e 0xa4 0x8e 0x74 0x8e>; 181 | phandle = <0x7>; 182 | }; 183 | 184 | iomux_spi0_pins { 185 | pinctrl-single,pins = <0x158 0x4e 0x15c 0x4e 0x160 0xce 0x164 0xce 0x168 0xce 0x16c 0xce 0x170 0xce 0x174 0xce 0x178 0xce 0x17c 0xce 0x180 0x8e>; 186 | phandle = <0x8>; 187 | }; 188 | 189 | iomux_mmc0_pins { 190 | pinctrl-single,pins = <0x1c 0x4e 0x20 0xce 0x24 0xce 0x28 0xce 0x2c 0xce 0x30 0xce 0x34 0xce 0x38 0xce 0x3c 0xce 0x40 0xce>; 191 | phandle = <0x9>; 192 | }; 193 | 194 | iomux_mmc2_pins { 195 | pinctrl-single,pins = <0x5c 0x4e 0x60 0xce 0x64 0xce 0x68 0xce 0x6c 0xce 0x70 0xce>; 196 | phandle = <0xa>; 197 | }; 198 | }; 199 | ``` 200 | 201 | ## 6.5 mmc and sd card drive 202 | 203 | drivers/mmc/sdhci-cadence.c 204 | 205 | Device tree 206 | 207 | ```text 208 | mmc0@93000000 { 209 | compatible = "socionext,uniphier-sd4hc", "cdns,sd4hc"; 210 | reg = <0x0 0x93000000 0x0 0x400>; 211 | interrupts = <0x30 0x4>; 212 | interrupt-parent = <0x4>; 213 | clocks = <0xb 0x4>; 214 | max-frequency = <0xbebc200>; 215 | cap-mmc-highspeed; 216 | bus-width = <0x8>; 217 | }; 218 | 219 | mmc2@93020000 { 220 | compatible = "socionext,uniphier-sd4hc", "cdns,sd4hc"; 221 | reg = <0x0 0x93020000 0x0 0x400>; 222 | interrupts = <0x32 0x4>; 223 | interrupt-parent = <0x4>; 224 | clocks = <0xb 0x4>; 225 | max-frequency = <0xbebc200>; 226 | cap-sd-highspeed; 227 | bus-width = <0x1>; 228 | }; 229 | ``` 230 | 231 | # 7 Uboot default environment variable 232 | 233 | The default environment variable for uboot is in the SDK's board/canaan/k510 directory, predefined as a text file: 234 | 235 | uboot-emmc.env 236 | 237 | uboot-nfs.env 238 | 239 | uboot-sdcard.env 240 | 241 | The POST script of the SDK will call mkenvimage at compile time to compile the text environment variable definition into a binary image that uboot can load and place in the boot partition. 242 | 243 | Here are some examples: 244 | 245 | uboot-sdcard.env 246 | 247 | ```text 248 | bootm_size=0x2000000 249 | bootdelay=3 250 | 251 | stderr=serial@96000000 252 | stdin=serial@96000000 253 | stdout=serial@96000000 254 | arch=riscv 255 | baudrate=115200 256 | 257 | ipaddr=10.100.226.221 258 | netmask=255.255.255.0 259 | gatewayip=10.100.226.254 260 | serverip=10.100.226.63 261 | bootargs=root=/dev/mmcblk1p2 rw console=ttyS0,115200n8 debug loglevel=7 262 | 263 | bootcmd=fatload mmc 1:1 0x600000 bootm-bbl.img;fatload mmc 1:1 0x2000000 k510.dtb;bootm 0x600000 - 0x2000000 264 | bootcmd_nfs=tftp 0x600000 bootm-bbl.img;tftp 0x2000000 k510_nfsroot.dtb;bootm 0x600000 - 0x2000000 265 | ``` 266 | 267 | Note: The kernel boot parameter bootargs are set by the default environment variable of uboot, and the bootargs in dts will be overwritten. See FAQ - Where did bootargs get and pass to the kernel? 268 | 269 | # 8 Uboot program updates 270 | 271 | ## 8.1 Flashing sdk mirror method 272 | 273 | The sdk image already contains a uboot program, directly flashing the sdk image, such as: k510_evb_lp3_v1_1_defconfig/images/sysimage-sdcard.img file 274 | 275 | ## 8.2 Linux update the uboot program inside the sD card 276 | 277 | Put the u-boot_burn.bin file in the tftp directory, configure the ip address of the device Network port, and enter the /root/sd/p1 directory; Execute the tftp -gr u-boot_burn.bin xxx.xxx.xxx.xxx.xx command; 278 | 279 | ## 8.3 Linux updates the uboot program inside emmc 280 | 281 | Put the u-boot_burn.bin file in the tftp directory, configure the device's network port IP address, and download the file to the device via tftp -gr u-boot_burn.bin xxx.xxx.xxx.xxx.xx; 282 | 283 | Execute the dd if=u-boot_burn.bin of=/dev/mmcblk0p1 command to write the file to the mmc card. 284 | 285 | # 9 Frequently Asked Questions 286 | 287 | ## 9.1 How is the DDR frequency configured? 288 | 289 | A: At present, the EVB can only run 800, and the CRB can set 800 or 1600. CrB board ddr frequency setting method see uboot board\Canaan\k510_crb_lp3\ddr_param.h file, 800M corresponds to #define DDR_800 1, 1600M corresponds to #define DDR_1600 1. 290 | 291 | ## 9.2 Where did bootargs get and pass to the kernel? 292 | 293 | A: Obtained from the uboot environment variable bootargs, uboot will modify the bootargs parameters in the memory device tree according to the bootargs environment variable value when booting the kernel. The relevant code is as follows: 294 | 295 | ```c 296 | int fdt_chosen(void *fdt) 297 | { 298 | int nodeoffset; 299 | int err; 300 | char *str; /* used to set string properties */ 301 | 302 | err = fdt_check_header(fdt); 303 | if (err < 0) { 304 | printf("fdt_chosen: %s\n", fdt_strerror(err)); 305 | return err; 306 | } 307 | 308 | /* find or create "/chosen" node. */ 309 | nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen"); 310 | if (nodeoffset < 0) 311 | return nodeoffset; 312 | 313 | str = env_get("bootargs"); 314 | if (str) { 315 | err = fdt_setprop(fdt, nodeoffset, "bootargs", str, 316 | strlen(str) + 1); 317 | if (err < 0) { 318 | printf("WARNING: could not set bootargs %s.\n", 319 | fdt_strerror(err)); 320 | return err; 321 | } 322 | } 323 | 324 | return fdt_fixup_stdout(fdt, nodeoffset); 325 | } 326 | ``` 327 | 328 | ## 9.3 Are the startup parameters inconsistent with the compiled device tree file? 329 | 330 | A: uboot dynamically obtains the environment variables according to the boot mode, and updates the device tree in memory according to the bootargs environment variables when booting the kernel. After the modified boot parameters, see the /sys/firmware/devicetree/base/chosen node. 331 | 332 | ## 9.4 Where are uboot environment variables saved? 333 | 334 | Answer: 335 | 336 | | Startup mode | uboot read and save location | Compile-time corresponding files | 337 | | :-: | :-: | :-: | 338 | | EMMC boots | Emmc the uboot-emmc.env file for the second partition | board\canaan\k510\uboot-emmc.env | 339 | | Sd card boot | The uboot-sd.env file of the first partition of the sd card | board\canaan\k510\uboot-sd.env | 340 | 341 | ## 9.5 How to set up qos? 342 | 343 | A: QOS-related registers are QOS_CTRL0 QOS_CTRL1 QOS_CTRL2 QOS_CTRL3 QOS_CTRL4. Example: 344 | After setting qos, nncase demo performance has improved 345 | 346 | ```c 347 | *(uint32_t *)0x970E00FC = (0x2 << 8) | (0x2 << 12) | (0x2 << 16) | (0x2 << 20) | (0x2 << 24); 348 | *(uint32_t *)0x970E0100 = (0x3 << 4) | 0x3; 349 | *(uint32_t *)0x970E00F4 = (0x5 << 16) | (0x5 << 20); 350 | ``` 351 | 352 | **Translation Disclaimer** 353 | For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail. 354 | 355 | If you would like to report a translation error or inaccuracy, please feel free to contact us by mail. 356 | -------------------------------------------------------------------------------- /en/K510_V4l2_Developer_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 V4L2 Developer's Guide** 4 | 5 | Document version: V1.0.0 6 | 7 | Published: 2022-03-09 8 | 9 |
10 | 11 | **Disclaimer** 12 | The products, services or features you purchase shall be subject to the commercial contracts and terms of Beijing Canaan Jiesi Information Technology Co., Ltd. ("the Company", the same hereinafter), and all or part of the products, services or features described in this document may not be within the scope of your purchase or use. Except as otherwise agreed in the contract, the Company disclaims all representations or warranties, express or implied, as to the accuracy, reliability, completeness, marketing, specific purpose and non-aggression of any representations, information, or content of this document. Unless otherwise agreed, this document is provided as a guide for use only. 13 | Due to product version upgrades or other reasons, the contents of this document may be updated or modified from time to time without any notice. 14 | 15 | **Trademark Notices** 16 | 17 | "", "Canaan" icon, Canaan and other trademarks of Canaan and other trademarks of Canaan are trademarks of Beijing Canaan Jiesi Information Technology Co., Ltd. All other trademarks or registered trademarks that may be mentioned in this document are owned by their respective owners. 18 | 19 | **Copyright ©2022 Beijing Canaan Jiesi Information Technology Co., Ltd** 20 | This document is only applicable to the development and design of the K510 platform, without the written permission of the company, no unit or individual may disseminate part or all of the content of this document in any form. 21 | 22 | **Beijing Canaan Jiesi Information Technology Co., Ltd** 23 | URL: canaan-creative.com 24 | Business Enquiries: salesAI@canaan-creative.com 25 | 26 |
27 | # preface 28 | **Document purpose** 29 | This document is an explanatory document for the K510 V4L2 application example. 30 | 31 | **Reader Objects** 32 | 33 | The main people to whom this document (this guide) applies: 34 | 35 | - Software developers 36 | - Technical support personnel 37 | 38 | **Revision history** 39 | The revision history accumulates a description of each document update. The latest version of the document contains updates for all previous versions. 40 | 41 | | The version number | Modified by | Date of revision | Revision Notes | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | System software groups | 2022-03-09 | SDK V1.5 released | 44 | | v1.0.1 | Zhu Dalei | 2022-03-11 | SDK V1.5 released | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **Contents** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 V4L2 mediactl library 58 | 59 | ## 1.1 Header File Description 60 | 61 | \#include “media_ctl.h” 62 | 63 | ## 1.2 API function descriptions 64 | 65 | ### ◆ mediactl_init 66 | 67 | ```c 68 | struct video_info { 69 | unsigned int video_used; 70 | char *video_name[4]; 71 | unsigned int enable[4]; 72 | unsigned int video_width[4]; 73 | unsigned int video_height[4]; 74 | unsigned int video_out_format[4]; 75 | }; 76 | 77 | int mediactl_init(char *video_cfg_file,struct video_info *dev_info); 78 | ``` 79 | 80 | Initialize media. 81 | 82 | #### parameter 83 | 84 | ```text 85 | parameter: 86 | [in] video_cfg_file: The video configuration file, the content of this file only needs to care about the content explained below, the specific explanation is as follows. 87 | sensor0_name: the name of the sensor driver only set in the V4L2 driver. 88 | sensor0_cfg_file: the name of the isp parameter configuration file corresponding to the sensor, such as imx219_0.conf. 89 | sensor0_total_width: the total pixels in the horizontal direction output by the sensor are used to generate the VSYNC signal, such as 3476 90 | sensor0_total_height: the total number of lines output by sensor, used to generate HSYNC signal, such as 1166 91 | sensor0_active_width: the effective pixels in the horizontal direction of the sensor output, such as 1920 92 | sensor0_active_height: number of valid lines of sensor output, such as 1080 93 | video2_used: 1 -- enable, 0 -- not use. 94 | video2_width: video output width, such as 1920. 95 | video2_height: video output height, such as 1080. 96 | video2_out_format: 1--YUV420,NV21. 97 | video3_used: 1 -- enable,0 -- not use. 98 | video3_width: video output width, such as 1080. 99 | video3_height: video output height, such as 720. 100 | video3_out_format: 1--YUV420,NV21. 101 | video4_used: 1 -- enable,0 -- not use. 102 | video4_width: video output width, such as 640. 103 | video4_height: video output height, such as 480. 104 | video4_out_format: 1--YUV420,NV21. 105 | video5_used: 1 -- enable,0 -- not use. 106 | video5_width: video output width, such as 320. 107 | video5_height: the height of video storage, such as 320. 108 | video5_height_r: video output height, such as 240. 109 | video5_out_format: 0--Separate RGB, 1--ARGB. 110 | sensor1_name: the name of the sensor driver only set in the V4L2 driver. 111 | sensor1_cfg_file: the name of the isp parameter configuration file corresponding to the sensor, such as imx219_0.conf. 112 | sensor1_total_width: the total pixels in the horizontal direction output by the sensor are used to generate the VSYNC signal, such as 3476. 113 | sensor1_total_height: the total number of lines output by sensor, used to generate HSYNC signal, such as 1166. 114 | sensor1_active_width: the effective pixels in the horizontal direction output by the sensor, such as 1920. 115 | sensor1_active_height: the number of valid lines output by sensor, such as 1080 116 | video6_used: 1 -- enable,0 -- not use. 117 | video6_width: video output width, such as 1920. 118 | video6_height: video output height, such as 1080. 119 | video6_out_format: 1--YUV420,NV21. 120 | video7_used: 1 -- enable,0 -- not use. 121 | video7_width: video output width, such as 1080. 122 | video7_height: video output height, such as 720. 123 | video7_out_format: 1--YUV420,NV21. 124 | video8_used: 1 -- enable,0 -- not use. 125 | video8_width: video output width, such as 640. 126 | video8_height: video output height, such as 480. 127 | video8_out_format: 1--YUV420,NV21. 128 | video9_used: 1 -- enable,0 -- not use. 129 | video9_width: video output width, such as 320. 130 | video9_height: the width of video storage, such as 320. 131 | video9_height_r: video output height, such as 240. 132 | video9_out_format: 0--Separate RGB, 1--ARGB. 133 | [out] dev_info: mediactl_lib returns the video information obtained from the video configuration file, the specific explanation is as follows. 134 | video_used: this refers to the ISP's pipeline, if it is used, it will return 1, otherwise 0. K510 supports two pipelines, ISP_F2K/ISP_R2K, and each pipeline supports up to 4 video outputs. 135 | video_name[4]: the name of the returned video. The four videos of f2k are video2/video3/video4/video5; the four videos of r2k are video6/video7/video8/video9. 136 | enable[4]: whether each video returned is enable, 1 -- enable, 0 -- not use. 137 | video_width[4]: the width of each video returned. 138 | video_height[4]: the height of each video returned. 139 | video_out_format[4]: the output image format of each video returned, see the explanation of "Video Configuration File" for details. 140 | The specific usage is as follows: 141 | char *video_cfg_file = "video_cfg"; 142 | struct video_info dev_info[2] 143 | mediactl_init(video_cfg_file,&dev_info) 144 | ``` 145 | 146 | #### The return value 147 | 148 | ```text 149 | 0 success, -1 fail. 150 | ``` 151 | 152 | ### ◆ mediactl_exit 153 | 154 | Shut down the media device and free up the requested share memory memory. 155 | 156 | #### parameter 157 | 158 | ```text 159 | parameter: 160 | N/A 161 | ``` 162 | 163 | ### ◆ adaptive_enable 164 | 165 | ```c 166 | enum adaptive_enable_select_e 167 | { 168 | ADAPTIVE_SELECT_DISABLE, 169 | ADAPTIVE_SELECT_ENABLE, 170 | }; 171 | int adaptive_enable(int scl); 172 | ``` 173 | 174 | Configuring the ISP Adaptive Function Switch 175 | 176 | #### parameter 177 | 178 | ```text 179 | parameter 180 | ADAPTIVE_SELECT_DISABLE: disable adaptive calc function 181 | ADAPTIVE_SELECT_ENABLE: disable adaptive calc function(default) 182 | ``` 183 | 184 | ### ◆ ae_select_init 185 | 186 | ```c 187 | enum ae_select_e 188 | { 189 | AE_SELECT_SW_MODE, 190 | AE_SELECT_HW_MODE, 191 | }; 192 | int ae_select_init(int scl); 193 | 194 | ``` 195 | 196 | configure sw/hw AE switch function 197 | 198 | #### parameter 199 | 200 | ```text 201 | parameter 202 | AE_SELECT_SW_MODE: enable sw AE(default) 203 | AE_SELECT_HW_MODE: enable hw AE 204 | ``` 205 | 206 | ### ◆ anti_flicker_init 207 | 208 | ```c 209 | enum anti_flicker_scl_e 210 | { 211 | ANTI_FLICKER_ALL_DSIABLE, 212 | ANTI_FLICKER_F2K_ENABLE, 213 | ANTI_FLICKER_R2K_ENABLE, 214 | ANTI_FLICKER_ALL2K_ENABLE, 215 | }; 216 | int anti_flicker_init(int scl); 217 | ``` 218 | 219 | configure antiflicker correction function 220 | 221 | #### parameter 222 | 223 | ```text 224 | parameter 225 | ANTI_FLICKER_ALL_DSIABLE: disable antiflicker correction function 226 | ANTI_FLICKER_F2K_ENABLE: enable F2K antiflicker50Hz correction function 227 | ANTI_FLICKER_R2K_ENABLE: enable R2K antiflicker50Hz correction function 228 | ANTI_FLICKER_ALL2K_ENABLE: enableF2K/R2K antiflicker50Hz correction function(default) 229 | ``` 230 | 231 | ### ◆ mediactl_rect 232 | 233 | ```c 234 | /** 235 | * @brief Use ISP to draw rect. 236 | * @param pipeline 237 | * @param layer 0: main out, 1: DS0, 2: DS1. 238 | * @param area support 32 area, 0 to 31 239 | * @param x 240 | * @param y 241 | * @param width 242 | * @param height 243 | * @param line_width 0 to 63 pixels 244 | * @param color AYCbCr, Alpha as hight bits, Cr as low bits 245 | * @param border_mask up/right/bottom/left, up as low bit, left as hight bit 246 | * @return return 0 if success, -1 if failed. 247 | */ 248 | int mediactl_rect(enum isp_pipeline_e pipeline, unsigned layer, unsigned area, unsigned x, unsigned y, unsigned width, unsigned height, unsigned line_width, unsigned color, unsigned border_mask); 249 | ``` 250 | 251 | Draw rectangles. 252 | 253 | ### ◆ mediactl_disable_ae 254 | 255 | ```c 256 | enum isp_pipeline_e { 257 | ISP_F2K_PIPELINE, 258 | ISP_R2K_PIPELINE, 259 | ISP_TOF_PIPELINE 260 | }; 261 | int mediactl_set_ae(enum isp_pipeline_e pipeline); 262 | ``` 263 | 264 | Disable specific ISP AE. 265 | 266 | #### parameter 267 | 268 | ```text 269 | parameter: 270 | ISP_F2K_PIPELINE: configure f2k pipeline AE 271 | ISP_R2K_PIPELINE: configure r2k pipeline AE 272 | ISP_TOF_PIPELINE:not use. 273 | ``` 274 | 275 | ### ◆ mediactl_get_isp_modules 276 | 277 | ```c 278 | enum isp_modules { 279 | ISP_TPG, 280 | ISP_BLC, 281 | ISP_LSC, 282 | ISP_AE, 283 | ISP_AWB, 284 | ISP_AWB_D65, 285 | ISP_AWB_CCM, 286 | ISP_WDR, 287 | ISP_RGB_GAMMA, 288 | ISP_YUV_GAMMA, 289 | ISP_ADA, 290 | ISP_ADA_SBZ, 291 | ISP_ADA_CCR, 292 | ISP_RGBIR, 293 | ISP_RAW_2DNR, 294 | ISP_YUV_Y_2DNR, 295 | ISP_YUV_UV_2DNR, 296 | ISP_3DNR, 297 | ISP_LTM, 298 | ISP_SHARP, 299 | ISP_CC, 300 | ISP_CTRST, 301 | ISP_LUMA, 302 | ISP_SATURATION, 303 | ISP_LDC, 304 | ISP_AF, 305 | }; 306 | 307 | unsigned int mediactl_get_isp_modules(enum isp_pipeline_e pipeline,enum isp_modules module); 308 | ``` 309 | 310 | Gets the enable status of each module of the ISP. 311 | 312 | #### parameter 313 | 314 | ```text 315 | parameter: 316 | isp_pipeline_e: more details see notes in mediactl_set_ae 317 | isp_modules: 318 | ISP_TPG -- Test Pattern Control moudel 319 | ISP_BLC -- Black Level Correction moudel 320 | ISP_LSC -- Lens Shading Correction moudel 321 | ISP_AE -- AUTO Exposure Gain moudel 322 | ISP_AWB -- AUTO white balance moudel 323 | ISP_AWB_D65 -- AUTO white balance d65 moudel 324 | ISP_AWB_CCM -- AUTO white balance ccm moudel 325 | ISP_WDR -- wide dynamic range moudel 326 | ISP_RGB_GAMMA -- rgb gamma moudel 327 | ISP_YUV_GAMMA -- yuv gamma moudel 328 | ISP_ADA -- Adaptive dynamic range adjust moudel 329 | ISP_ADA_SBZ -- Image stabilization moudel 330 | ISP_ADA_CCR -- Color correction moudel 331 | ISP_RGBIR -- rgbir rectify moudel 332 | ISP_RAW_2DNR -- raw domain 2DNR moudel 333 | ISP_YUV_Y_2DNR -- yuv domain 2D YNR moudel 334 | ISP_YUV_UV_2DNR -- yuv domain 2D uvNR moudel 335 | ISP_3DNR -- yuv domain 3DNR moudel 336 | ISP_LTM -- local tone mapping moudel 337 | ISP_SHARP -- sharpness moudel 338 | ISP_CC -- color correction moudel 339 | ISP_CTRST -- contrast adjust moudel 340 | ISP_LUMA -- luma adjust moudel 341 | ISP_SATURATION -- saturation adjust moudel 342 | ISP_LDC -- lens Distortion Correction moudel 343 | ISP_AF -- ATUO FOCUS moudel 344 | ``` 345 | 346 | #### The return value 347 | 348 | ```text 349 | 0 -- moudel disable 1 -- moudel enable 350 | ``` 351 | 352 | # 2 Demo app 353 | 354 | ## 2.1 v4l2_drm 355 | 356 | The program is placed`/app/mediactl_lib` in the directory: 357 | 358 | - `v4l2_drm.out`:v4l2 and drm linkage case, added -f to modify the name of the input configuration file, -e to open the isp ae function. You can use -h to view help. 359 | 360 | Run v4l2_drm.out 361 | 362 | - -e:0 turns off all aes, 1 turns on f-2k ae, 2 turns on r-2k ae, and 3 turns on all aes. By default, you can leave -e to turn off all aes. 363 | - -x:0 switch to sw ae provided by lib3actl, 1 switch to hardware AE. By default, you can not specify -x, will use sw ae. 364 | - -a:0 disable antiflicker correction, 1 enable f-2k 50Hz correction, 2 enable r-2k correction, 3 enable all antiflicker 50Hz correction. By default, you can not specify -a, will enable f2k/r2k 50Hz correction functions. 365 | - -l:0 disable the ISP adaptive calculation function provided by libadaptive.so, 1 ISP adaptive calculation function provided by libadaptive.so. By default, you can not specify -l, will enable the ISP adaptive computing function provided by libadaptive.so. 366 | - The demo requires the video configuration file and the corresponding sensor configuration file to be in the current directory. 367 | - The demo can demonstrate single and double cameras by changing the configuration file. 368 | - The demo demo single-camera full screen: ./v4l2_drm.out -e 1 -f video_drm_1080x1920.conf 369 | - The demo demo dual camera: ./v4l2_drm.out -f video_drm_1920x1080.conf 370 | - The demo must ensure that three profiles video_drm_1920x1080.conf, imx219_0.conf, and imx219_1.conf exist 371 | 372 | **Translation Disclaimer** 373 | For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail. 374 | 375 | If you would like to report a translation error or inaccuracy, please feel free to contact us by mail. 376 | -------------------------------------------------------------------------------- /en/README.md: -------------------------------------------------------------------------------- 1 | [![Gitee repository](https://img.shields.io/badge/gitee-repository-blue?logo=gitee&style=plastic)](https://gitee.com/kendryte/k510_docs) 2 | [![GitHub release](https://img.shields.io/github/v/release/kendryte/k510_docs?color=brightgreen&display_name=tag&logo=github&style=plastic)](https://github.com/kendryte/k510_docs/releases) 3 | 4 | # Documentation overview 5 | 6 | K510 related documentation is as follows: 7 | 8 | | Document name | Document summary | 9 | | :-- | :-- | 10 | | [K510_CRB_V1.2_Hardware_Guide.md](K510_CRB_V1.2_Hardware_Guide.md) | K510 CRB Version 1.2 hardware resource description documentation | 11 | | [K510_CRB_V1.2 Schematic](https://github.com/kendryte/k510_docs/releases/download/v1.5/K510_CRB_Schematic.zip) | K510 CRB V1.2 schematic| 12 | | [K510_SDK_Build_and_Burn_Guide.md](K510_SDK_Build_and_Burn_Guide.md) | The K510 SDK compiles and burns the documentation | 13 | | [K510_System_memory_map.md](K510_System_memory_map.md) | K510 SDK system memory division documentation | 14 | | [K510_SDK_Application_Guides.md](K510_SDK_Application_Guides.md) | K510 Refer to the sample program documentation | 15 | | [K510_nncase_Developer_Guides.md](K510_nncase_Developer_Guides.md) | K510 compiler usage documentation | 16 | | [K510_AI_Application_Guides.md](K510_AI_Application_Guides.md) | k510 AI app deployment process documentation | 17 | | [K510_U-Boot_Developer_Guides.md](K510_U-Boot_Developer_Guides.md) | K510 SDK uboot documentation | 18 | | [K510_Linux_Kernel_Driver_Developer_Guides.md](K510_Linux_Kernel_Driver_Developer_Guides.md) | K510 SDK kernel documentation | 19 | | [K510_SDK_DSP_CORE_Guide.md](K510_SDK_DSP_CORE_Guide.md) | K510 DSP Core Usage Documentation | 20 | | [K510_V4l2_Developer_Guides.md](K510_V4l2_Developer_Guides.md) | K510 V4L2 application example documentation | 21 | | [K510_V4l2_Sensor_Developer_Guides.md](K510_V4l2_Sensor_Developer_Guides.md) | K510 sensor development documentation | 22 | | [K510_Drm_Developer_Guides.md](K510_Drm_Developer_Guides.md) | K510 DRM API interface documentation | 23 | | [K510_Multimedia_Developer_Guides.md](K510_Multimedia_Developer_Guides.md) | K510 Multimedia application example documentation | 24 | | [K510_Mailbox_Developer_Guides.md](K510_Mailbox_Developer_Guides.md) | K510 Multiprocessor Communication Documentation | 25 | | [K510_ISP_Tuning_Tool_Guides.md](K510_ISP_Tuning_Tool_Guides.md) | K510 ISP Tuning Tool Documentation [Download Address](https://github.com/kendryte/k510_isp_tuning_tool/releases) | 26 | | [K510_ISP_Adaptive_Tuning_Guides.md](K510_ISP_Adaptive_Tuning_Guides.md) | K510 ISP Adaptive Tuning Documentation | 27 | 28 | ## Contribution Guide 29 | 30 | If you are interested in this project and would like feedback or submit documentation, please refer to[CONSOLIDATING](/.github/CONTRIBUTING.md) 31 | 32 | ## Contact us 33 | 34 | Canaan Inc. 35 | URL:[canaan-creative.com](https://www.canaan-creative.com/) 36 | Business Enquiries:[salesAI@canaan-creative.com](mailto:salesAI@canaan-creative.com) 37 | 38 | **Translation Disclaimer** 39 | For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail. 40 | 41 | If you would like to report a translation error or inaccuracy, please feel free to contact us by mail. 42 | -------------------------------------------------------------------------------- /zh/K510_AI_Application_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 AI Application Guide** 4 | 5 | 文档版本:V1.0.0 6 | 7 | 发布日期:2022-03-07 8 | 9 |
10 | 11 | **免责声明** 12 | 您购买的产品、服务或特性等应受北京嘉楠捷思信息技术有限公司(“本公司”,下同)商业合同和条款的约束,本文档中描述的全部或部分产品、服务或特性可能不在您的购买或使用范围之内。除非合同另有约定,本公司不对本文档的任何陈述、信息、内容的准确性、可靠性、完整性、营销型、特定目的性和非侵略性提供任何明示或默示的声明或保证。除非另有约定,本文档仅作为使用指导的推理。 13 | 由于产品版本升级或其他原因,本文档内容将可能在未经任何通知的情况下,不定期进行更新或修改。 14 | 15 | **商标声明** 16 | 17 | “”、“Canaan”图标、嘉楠和嘉楠其他商标均为北京嘉楠捷思信息技术有限公司的商标。本文档可能提及的其他所有商标或注册商标,由各自的所有人拥有。 18 | 19 | **版权所有©2022北京嘉楠捷思信息技术有限公司** 20 | 本文档仅适用K510平台开发设计,非经本公司书面许可,任何单位和个人不得以任何形式对本文档的部分或全部内容传播。 21 | 22 | **北京嘉楠捷思信息技术有限公司** 23 | 网址:canaan-creative.com 24 | 商务垂询:salesAI@canaan-creative.com 25 | 26 |
27 | # 前言 28 | **文档目的** 29 | 本文档为K510 AI 应用的配套文档,旨在帮助工程师了解 k510 AI 应用的编写与应用。 30 | 31 | **读者对象** 32 | 33 | 本文档(本指南)主要适用的人员: 34 | 35 | - 软件开发人员 36 | - 技术支持人员 37 | 38 | **修订记录** 39 | 修订记录累积了每次文档更新的说明。最新版本的文档包含以前所有版本的更新内容。 40 | 41 | | 版本号 | 修改者 | 修订日期 | 修订说明 | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | AI 产品部 | 2022-03-07 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **目 录** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 简介 58 | 59 | 本文档介绍K510 AI应用的编写与应用。基于K510 AI芯片进行AI应用开发共有如下几个阶段: 60 | 61 | 模型准备:将训练好的模型在PC端进行验证(可使用静态图片推理),以确保模型的正确性 62 | 63 | 模型生成:将训练好的模型使用nncase compiler进行编译,生成kmodel 64 | 65 | 模型验证:将生成的kmodel使用nncase simulator进行精度验证 66 | 67 | 编写AI 应用程序:完成视频/图片的读取、输入的预处理、模型推理、模型后处理 68 | 69 | 编译AI 应用程序:使用交叉编译工具链,完成K510 AI应用程序的编译 70 | 71 | 部署和联调:将编译好的AI 应用署到K510硬件产品上,并在实际场景中进行功能的联调 72 | 73 | 在K510 AI芯片上进行AI应用开发的整体架构如下图所示: 74 | 75 | ![](../zh/images/ai_demo/image-ai-demo.png) 76 | 77 | 本文档将以320x320分辨率的YOLOV5s的onnx模型为示例,介绍K510 AI应用整个流程的编写与应用。 78 | 79 | # 2 模型准备 80 | 81 | 用于推理的YOLOV5s的onnx模型位于/docs/utils/AI_Application/aidemo_sdk/models/onnx子目录(如果没有文件请下载 [models](https://github.com/kendryte/k510_docs/releases/download/v1.5/models.tar.gz) 并解压),静态图片位于/docs/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/data子目录,脚本位于/docs/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC子目录。 82 | 83 | 按照脚本命令提示,运行yolov5_image.py脚本,得到静态图片的推理结果。通过验证输出图片的检测框正确与否来检测模型的正确性。 84 | 85 | ```shell 86 | usage: yolov5_image.py [-h] [--image_path IMAGE_PATH] 87 | [--image_out_path IMAGE_OUT_PATH] 88 | [--onnx_path ONNX_PATH] 89 | [--confidence_threshold CONFIDENCE_THRESHOLD] 90 | [--nms_threshold NMS_THRESHOLD] 91 | 92 | object detect 93 | 94 | optional arguments: 95 | -h, --help show this help message and exit 96 | --image_path IMAGE_PATH 97 | input image path 98 | --image_out_path IMAGE_OUT_PATH 99 | output image path 100 | --onnx_path ONNX_PATH 101 | onnx model path 102 | --confidence_threshold CONFIDENCE_THRESHOLD 103 | confidence_threshold 104 | --nms_threshold NMS_THRESHOLD 105 | nms_threshold 106 | ``` 107 | 108 | # 3 模型生成 109 | 110 | 模型生成依赖于nncase compiler,关于nncase compiler的具体使用规则可参考[K510_nncase_Developer_Guides.md](./K510_nncase_Developer_Guides.md)。生成YOLOV5s的kmodel的脚本位于/docs/utils/AI_Application/aidemo_sdk/scripts子目录。 111 | 112 | 按照脚本命令提示,运行gen_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py,可生成相应的kmodel。 113 | 114 | ```shell 115 | usage: gen_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py [-h] [--target TARGET] [--dump_dir DUMP_DIR] [--onnx ONNX] [--kmodel KMODEL] 116 | 117 | optional arguments: 118 | -h, --help show this help message and exit 119 | --target TARGET target to run 120 | --dump_dir DUMP_DIR temp folder to dump 121 | --onnx ONNX onnx model path 122 | --kmodel KMODEL kendryte model path 123 | ``` 124 | 125 | 需要注意的是,为了尽可能减少在CPU上做预处理,脚本中的编译选项配置如下: 126 | 127 | ```python 128 | compile_options.input_type = 'uint8' 129 | compile_options.preprocess = True 130 | compile_options.input_layout = 'NCHW' 131 | compile_options.output_layout = 'NHWC' 132 | compile_options.input_shape = [1, 3, 320, 320] 133 | compile_options.mean = [0, 0, 0] 134 | compile_options.std = [255, 255, 255] 135 | compile_options.input_range = [0, 255] 136 | ``` 137 | 138 | # 4 模型验证 139 | 140 | 模型验证依赖于nncase simulator,关于nncase simulator的具体使用规则可参考[K510_nncase_Developer_Guides.md](./K510_nncase_Developer_Guides.md)。验证YOLOV5s的kmodel脚本位于/docs/utils/AI_Application/aidemo_sdk/scripts子目录。 141 | 142 | 按照脚本命令提示,运行simu_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py,可验证相应的kmodel是否生成正确。 143 | 144 | ```shell 145 | usage: sim_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py [-h] [--onnx ONNX] [--kmodel KMODEL] 146 | 147 | optional arguments: 148 | -h, --help show this help message and exit 149 | --onnx ONNX original model file 150 | --kmodel KMODEL kmodel file 151 | ``` 152 | 153 | 如有cosine similarity接近与1或者等于1,则可确保生成的kmodel的正确性。 154 | 155 | ```text 156 | output 0 cosine similarity : 0.9999450445175171 157 | output 1 cosine similarity : 0.9999403953552246 158 | output 2 cosine similarity : 0.9999019503593445 159 | ``` 160 | 161 | # 5 编写AI 应用程序 162 | 163 | 模型验证依赖于nncase runtime,关于nncase runtime的具体使用规则可参考[K510_nncase_Developer_Guides.md](./K510_nncase_Developer_Guides.md)。AI应用程序参考 `k510_buildroot/package/ai/code/object_detect`。首先需要创建目标检测实例,并为kmodel输入输出分配空间。 164 | 165 | ```c++ 166 | objectDetect od(obj_thresh, nms_thresh, net_len, {valid_width, valid_height}); 167 | od.load_model(kmodel_path); // load kmodel 168 | od.prepare_memory(); // memory allocation 169 | ``` 170 | 171 | 为实现zero memory copy,将ISP输出地址与kmodel输入地址关联 172 | 173 | ```c++ 174 | // define cv::Mat for ai input 175 | // padding offset is (valid_width - valid_height) / 2 * valid_width 176 | cv::Mat rgb24_img_for_ai(net_len, net_len, CV_8UC3, od.virtual_addr_input[0] + (valid_width - valid_height) / 2 * valid_width); 177 | ``` 178 | 179 | 配置ISP输出的宽高 180 | 181 | ```c++ 182 | /****fixed operation for video operation****/ 183 | mtx.lock(); 184 | cv::VideoCapture capture; 185 | capture.open(5); 186 | // video setting 187 | capture.set(cv::CAP_PROP_CONVERT_RGB, 0); 188 | capture.set(cv::CAP_PROP_FRAME_WIDTH, net_len); 189 | capture.set(cv::CAP_PROP_FRAME_HEIGHT, net_len); 190 | // RRRRRR....GGGGGGG....BBBBBB, CHW 191 | capture.set(cv::CAP_PROP_FOURCC, V4L2_PIX_FMT_RGB24); 192 | mtx.unlock(); 193 | ``` 194 | 195 | 配置相应的video配置文件,video_height_r为ISP真实输出高度,video_height为ISP不同通道间的高度偏移 196 | 197 | ```json 198 | "/dev/video5":{ 199 | "video5_used":1, 200 | "video5_width":320, 201 | "video5_height":320, 202 | "video5_height_r":240, 203 | "video5_out_format":0 204 | } 205 | ``` 206 | 207 | 将输入输出地址与kmodel的input_tensor和output_tensor关联 208 | 209 | ```c++ 210 | od.set_input(0); 211 | od.set_output(); 212 | ``` 213 | 214 | 运行kmodel,得到输出结果,并进行后处理 215 | 216 | ```c++ 217 | { 218 | ScopedTiming st("od run", enable_profile); 219 | od.run(); 220 | } 221 | 222 | { 223 | ScopedTiming st("od get output", enable_profile); 224 | od.get_output(); 225 | } 226 | std::vector result; 227 | { 228 | ScopedTiming st("post process", enable_profile); 229 | od.post_process(result); 230 | } 231 | ``` 232 | 233 | 最终,将检测框画到OSD上,显示输出 234 | 235 | ```c++ 236 | { 237 | ScopedTiming st("draw osd", enable_profile); 238 | obj_cnt = 0; 239 | for (auto r : result) 240 | { 241 | if (obj_cnt < 32) 242 | { 243 | struct vo_draw_frame frame; 244 | frame.crtc_id = drm_dev.crtc_id; 245 | frame.draw_en = 1; 246 | frame.frame_num = obj_cnt; 247 | frame.line_y_start = r.x2 * DRM_INPUT_WIDTH / valid_width; 248 | frame.line_x_start = r.x1 * DRM_INPUT_WIDTH / valid_width; 249 | frame.line_x_end = r.y1 * DRM_INPUT_HEIGHT / valid_height + DRM_OFFSET_HEIGHT; 250 | frame.line_y_end = r.y2 * DRM_INPUT_HEIGHT / valid_height + DRM_OFFSET_HEIGHT; 251 | draw_frame(&frame); 252 | 253 | cv::Point origin; 254 | origin.x = (int)(r.x1 * DRM_INPUT_WIDTH / valid_width); 255 | origin.y = (int)(r.y1 * DRM_INPUT_HEIGHT / valid_height + 10); 256 | std::string text = od.labels[r.label] + ":" + std::to_string(round(r.score * 100) / 100.0).substr(0,4); 257 | cv::putText(img_argb, text, origin, cv::FONT_HERSHEY_COMPLEX, 1.5, cv::Scalar(0, 0, 255, 255), 1, 8, 0); 258 | } 259 | obj_cnt += 1; 260 | } 261 | } 262 | ``` 263 | 264 | # 6 编译AI应用程序 265 | 266 | 使用交叉编译工具链,关于AI应用程序的编译的具体使用规则可参考[K510_SDK_Build_and_Burn_Guide](./K510_SDK_Build_and_Burn_Guide.md)。 267 | 268 | **翻译免责声明** 269 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 270 | 271 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 272 | -------------------------------------------------------------------------------- /zh/K510_ISP_Tuning_Tool_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 ISP Tuning Tool Guides** 4 | 5 | 文档版本:V1.0.0 6 | 7 | 发布日期:2022-03-31 8 | 9 |
10 | 11 | **免责声明** 12 | 您购买的产品、服务或特性等应受北京嘉楠捷思信息技术有限公司(“本公司”,下同)商业合同和条款的约束,本文档中描述的全部或部分产品、服务或特性可能不在您的购买或使用范围之内。除非合同另有约定,本公司不对本文档的任何陈述、信息、内容的准确性、可靠性、完整性、营销型、特定目的性和非侵略性提供任何明示或默示的声明或保证。除非另有约定,本文档仅作为使用指导的参考。 13 | 由于产品版本升级或其他原因,本文档内容将可能在未经任何通知的情况下,不定期进行更新或修改。 14 | 15 | **商标声明** 16 | 17 | “”、“Canaan”图标、嘉楠和嘉楠其他商标均为北京嘉楠捷思信息技术有限公司的商标。本文档可能提及的其他所有商标或注册商标,由各自的所有人拥有。 18 | 19 | **版权所有©2022北京嘉楠捷思信息技术有限公司** 20 | 本文档仅适用K510平台开发设计,非经本公司书面许可,任何单位和个人不得以任何形式对本文档的部分或全部内容传播。 21 | 22 | **北京嘉楠捷思信息技术有限公司** 23 | 网址:canaan-creative.com 24 | 商务垂询:salesAI@canaan-creative.com 25 | 26 |
27 | # 前言 28 | **文档目的** 29 | 本文档为ISP Tuning Tool说明文档。 30 | 31 | **读者对象** 32 | 33 | 本文件的主要受众是有经验的软件工程师、图像算法工程师、系统设计师和系统集成商,他们希望实现私有应用程序和驱动程序。 34 | 35 | **修订记录** 36 | 修订记录累积了每次文档更新的说明。最新版本的文档包含以前所有版本的更新内容。 37 | 38 | | 版本号 | 修改者 | 修订日期 | 修订说明 | 39 | | :----- |------- | ------ | ------ | 40 | | V1.0.0 | 系统软件组 | 2022-03-31 | SDK V1.6发布 | 41 | 42 |
43 | **目 录** 44 | 45 | [TOC] 46 | 47 |
48 | 49 | # ISP调优工具框架介绍 50 | 51 | 本节介绍ISP调优工具和数据流的说明,这些框架和数据流是为上层处理器提供的,用于控制整个ISP图像优化。 52 | 53 | ```text 54 | +----------------------------------------------------+ 55 | | | 56 | | K510 | 57 | | | 58 | | +-------+ +--------------------------+ | 59 | | | | | | | 60 | | | ISP +------> | v4l2_drm.out | | 61 | | | | | | | 62 | | +-------+ +-------------+------------+ | 63 | | | | 64 | | | | 65 | | +-----------------+ | | 66 | | | | | | 67 | | | isp-tuningd | <----------+ | 68 | | | | | 69 | | +^-+--------------+ | 70 | | | | | 71 | | | | | 72 | +----------------------------------------------------+ 73 | | | 74 | | | 75 | +-------------------------------+ 76 | | | | | 77 | | | | PC | 78 | | | | | 79 | | ++-v------------------+ | 80 | | | | | 81 | | | ISP Tuning Tool | | 82 | | | | | 83 | | +---------------------+ | 84 | | | 85 | +-------------------------------+ 86 | ``` 87 | 88 | ## 调优工具数据流 89 | 90 | 通信协议参见客户端代码仓库里的说明文档,工具包含两部分,一部分是在PC上运行的客户端isp-tuningd,程序位于/app/mediactl_lib/isp-tuningd,另一部分是在K510上运行的服务端。通信默认使用TCP的9982端口。 91 | 92 | ### 客户端 93 | 94 | ISP Tuning Tool是在PC上运行的应用程序。除了能设置寄存器外还支持进行AWB校准和CCM校准。 95 | 96 | ### 服务端 97 | 98 | isp-tuningd会从标准输入接收yuv图像(NV12)并广播给所有客户端,我们可以使用v4l2_drm.out,他会自动启动isp-tuningd并送入图像数据。我们可以用如下命令运行 99 | 100 | ```shell 101 | cd /app/mediactl_lib 102 | # 使用camera 0 103 | ./v4l2_drm.out -t 1 -f video_drm_1080x1920.conf 104 | 105 | # 使用camera 1 106 | ./v4l2_drm.out -t 1 -f video_drm_1080x1920_r2k.conf 107 | ``` 108 | 109 | 如果不需要使用预览,则直接启动isp-tuningd即可。 110 | 111 | ```shell 112 | /app/mediactl_lib/isp-tuningd 113 | ``` 114 | 115 | # ISP调优选项 116 | 117 | K510 ISP中提供了许多寄存器和表以进行控制和调优。ISP硬件寄存器的设置对图像质量非常重要。目前K510平台,图像调优过程只通过TCP Socket实现。 118 | 119 | ## 调优工具主窗口 120 | 121 | 本节介绍调优窗口上这些面板的功能。 122 | 123 | 图3-1显示了调优窗口上的整个操作面板 124 | 125 | - 面板1是**菜单**,它可以选择加载配置好的ISP文件或进行校准。 126 | - 面板2是**连接控制面板**,填入开发板的IP地址和端口号(默认9982端口)后点击绿色的连接按钮即可连接。 127 | - 面板3是**寄存器面板**,如果你需要设置或读取的寄存器并不在这里面则可以使用这个面板进行设置和读取。 128 | - 面板4是**ISP选择面板**,可以指定ISP F2K或ISP R2K。 129 | - 面板5是调优**参数选择面板**,用户可以根据面板提示文本选择各种参数或参数组,这些选择的寄存器将显示在面板5上。 130 | - 面板6是**调优参数设置面板**,它用于设置或从调优服务器获取参数值。 131 | 132 | ![图3-1 调优工具主窗口](../zh/images/sdk_application/clip_image033.png) 133 | 134 | ISP Tuning Tool在连接后**不会**自动获取所有寄存器值,如果需要获取所有的寄存器值可以点击**连接控制面板**右侧的读取按钮,即可拉取当前的所有寄存器值。 135 | 136 | # 标定 & 校准 137 | 138 | 本节介绍使用ISP调优工具进行标定和校准的说明,包括自动白平衡(AWB)、颜色校正矩阵(CCM)、Gamma和镜头阴影(LSC)。 139 | 140 | ## AWB 141 | 142 | ### 准备工作 143 | 144 | 1. 标准灯箱,有标准D65光源 145 | 2. 标准24色卡,目前仅支持X-RITE色卡 146 | 3. 准备标定的相机,能输出sensor原始图像或处理后的图像 147 | 4. ISP也仅打开黑电平矫正与去马赛克算法模块,CSC等格式转换模块一定要注意对称性(矩阵是逆矩阵),另外降噪、锐化等模块影响不大,不过也尽量关闭,非线性模块与颜色处理模块(GAMMA,宽动态,AWB,CCM,饱和度调整等)必须关闭 148 | 149 | ### 获取图像 150 | 151 | 1. 相机对准24色卡,确保24色卡撑满整个画面,然后抓取图像,未保证准确可以点击暂停播放,如下图所示 152 | 153 | ![图4-1 拍摄24色卡](../zh/images/sdk_application/clip_image014.jpg) 154 | 155 | 2. 抓取的图像注意亮暗适中,太亮太暗都影响标定 156 | 157 | ### 标定 158 | 159 | 点击菜单栏的“Calibration”,选择“AWB”即可执行标定,程序会自动框选色卡 160 | 161 | ![图4-2 自动框选色卡](../zh/images/sdk_application/clip_image016.jpg) 162 | 163 | 此时按下任意键继续,弹出完成白平衡后的图像 164 | 165 | ![图4-3 完成AWB标定](../zh/images/sdk_application/clip_image018.jpg) 166 | 167 | 如果没问题,则继续按下任意键,工具会弹出对话框询问参数是否合理,是则会将其填入主界面相关寄存器,否则放弃标定结果,如果是则工具会继续询问是否写入设备寄存器。 168 | 169 | ## CCM 170 | 171 | 与AWB标定一致,不再赘述。 172 | 173 | ## Gamma 174 | 175 | 标准的gamma曲线的公式为 176 | $$ 177 | Y=aX^b 178 | $$ 179 | 其中$b$即为Gamma系数,在成像端一般小于1,在显示端一般大于1。$a$的值可以根据$b$的值算出来 180 | 181 | $$ 182 | a=\frac{256}{256^b} 183 | $$ 184 | 该公式的原理是输入是256,做完Gamma矫正后仍为256。 185 | 186 | Gamma系数b为0.5时,曲线如下图所示 187 | 188 | ![](../zh/images/sdk_application/clip_image025.png) 189 | 190 | ## LSC 191 | 192 | ### 准备工作 193 | 194 | - 一张镜头拍摄获得的RAW格式照片 195 | 196 | ### 原理 197 | 198 | 因镜头的中心与四周通光量不一致,造成图像亮度不均匀,因此通过曲线拟合生成一个矫正曲面来弥补该问题。 199 | 200 | 矫正前如下图所示 201 | 202 | ![校正前](../zh/images/sdk_application/clip_image029.png) 203 | 204 | 矫正后如下图所示 205 | 206 | ![校正后](../zh/images/sdk_application/clip_image031.png) 207 | 208 | **翻译免责声明** 209 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 210 | 211 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 212 | -------------------------------------------------------------------------------- /zh/K510_SDK_DSP_CORE_Guide.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 DSP CORE Guide** 4 | 5 | 文档版本:V1.0.0 6 | 7 | 发布日期:2022-03-09 8 | 9 |
10 | 11 | **免责声明** 12 | 您购买的产品、服务或特性等应受北京嘉楠捷思信息技术有限公司(“本公司”,下同)商业合同和条款的约束,本文档中描述的全部或部分产品、服务或特性可能不在您的购买或使用范围之内。除非合同另有约定,本公司不对本文档的任何陈述、信息、内容的准确性、可靠性、完整性、营销型、特定目的性和非侵略性提供任何明示或默示的声明或保证。除非另有约定,本文档仅作为使用指导的参考。 13 | 由于产品版本升级或其他原因,本文档内容将可能在未经任何通知的情况下,不定期进行更新或修改。 14 | 15 | **商标声明** 16 | 17 | “”、“Canaan”图标、嘉楠和嘉楠其他商标均为北京嘉楠捷思信息技术有限公司的商标。本文档可能提及的其他所有商标或注册商标,由各自的所有人拥有。 18 | 19 | **版权所有©2022北京嘉楠捷思信息技术有限公司** 20 | 本文档仅适用K510平台开发设计,非经本公司书面许可,任何单位和个人不得以任何形式对本文档的部分或全部内容传播。 21 | 22 | **北京嘉楠捷思信息技术有限公司** 23 | 网址:canaan-creative.com 24 | 商务垂询:salesAI@canaan-creative.com 25 | 26 |
27 | # 前言 28 | **文档目的** 29 | 本文档为K510 DSP核使用指导说明。 30 | 31 | **读者对象** 32 | 33 | 本文档(本指南)主要适用的人员: 34 | 35 | - 软件开发人员 36 | - 技术支持人员 37 | 38 | **修订记录** 39 | 修订记录累积了每次文档更新的说明。最新版本的文档包含以前所有版本的更新内容。 40 | 41 | | 版本号 | 修改者 | 修订日期 | 修订说明 | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | 系统软件组 | 2022-03-09 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **目 录** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 概述 58 | 59 | K510芯片中一共有三个处理器,其中CPU Dual cores运行Linux,DSP核空闲留待用户开发使用,本文档提供了DSP核作为协处理器运行裸机程序的参考例程。 60 | 61 | ![](../zh/images/doc_dsp/image-dsp_1.png) 62 | 63 |
图1 k510框图
64 | 65 | # 1 DSP 程序加载 66 | 67 | k510_buildroot/package/dsp_app_new 目录下,是加载DSP并使之运行的代码,该代码运行于Linux用户空间。dsp_app_new代码主要实现加载DSP固件到指定位置,并启动DSP开始执行,其主要的代码如下: 68 | 69 | ```c 70 | /*将DSP固件从pDspBinmPath路径下加载到DspRestVector位置。*/ 71 | if (kendryte_dsp_load_bin(DspRestVector, pDspBinmPath)) { 72 | printf("ERR: Load dsp bin file err\n"); 73 | return -1; 74 | } else { 75 | printf("Load dsp success\n"); 76 | } 77 | 78 | /*启动DspRestVector位置处的DSP固件运行。*/ 79 | if (kendryte_dsp_boot(DspRestVector)) { 80 | printf("ERR: Boot dsp err\n"); 81 | return -1; 82 | } 83 | ``` 84 | 85 | dsp_app_new编译后的可执行程序将存放在根文件系统/app/dsp_app_new目录下。 86 | 87 | # 2 DSP 信息打印 88 | 89 | k510_buildroot/package/dsp_log 目录下,是查询是否DSP核是否有Log输出的代码,该代码运行于 Linux用户空间。dsp_log 编译后的可执行程序将存放在根文件系统/app/dsp_log目录下。 90 | 91 | 开机后,dsp_log默认将在后台执行,其配置文件在:k510_buildroot/board/canaan/k510/k510_rootfs_skeleton/etc/init.d/rc.sysinit 92 | 93 | ![](../zh/images/doc_dsp/image-dsp_log.png) 94 | 95 | # 3 DSP 裸机Demo 96 | 97 | ## 3.1 fft 98 | 99 | fft demo 程序位于`/app/dsp_app_new/fft.bin`。 100 | fft demo 程序源码放在`k510_buildroot/package/k510_evb_test/src/test/fft`目录下。 101 | 102 | 进入 /app/dsp_app_new`目录下: 103 | 104 | - `dsp_app`:加载DSP并使得dsp运行的程序(运行于Linux 用户空间) 105 | - `fft.bin`: DSP 裸机程序 106 | 107 | 启动 fft 程序运行: 108 | 109 | ```shell 110 | cd /app/dsp_app_new 111 | ./dsp_app fft.bin 112 | ``` 113 | 114 | 可以看到如下打印: 115 | 116 | ![DSP Demo](../zh/images/doc_dsp/demo_dsp.png) 117 | 118 | 现在dsp上运行的firmware是fft的demo程序。 119 | 120 | ## 3.2 simd_umul8 121 | 122 | simd_umul8 demo 程序位于`/app/dsp_app_new/simd_umul8_demo.bin`。 123 | simd_umul8 demo 程序源码放在`k510_buildroot/package/k510_evb_test/src/test/simd_umul8_demo`目录下,所做的主要工作如下: 124 | 125 | - 在 demo 中让两个 32 位的数据"相乘”,即将每个 32 位的数据分成 4 个 8 位的数据,然后分别对应相乘,得到 4 个 16 位的结果,检查计算结果是否符合预期。例如,0x05050505 与 0x02020202 “相乘”后的结果为 0x000a000a000a000a。 126 | - 如果符合预期,打印信息`DSP SIMD UMUL8 TEST PASS`,否则打印信息`DSP SIMD UMUL8 TEST FAIL`. 127 | 128 | 运行 demo 的方法: 129 | 130 | ```shell 131 | cd /app/dsp_app_new 132 | ./dsp_app simd_umul8_demo.bin 133 | ``` 134 | 135 | 具体指令的可到 [Product Documentation - Andes Technology](http://www.andestech.com/en/products-solutions/product-documentation/) 下载 AndeStar V5 DSP ISA Extension Specification.PDF(v1.0,2019-03-25),查看第 3.172 节。 136 | 137 | ## 3.3 DSP Scheduler API 138 | 139 | 当cpu性能不能满足一些应用的时候,可以分割一部分功能运行到DSP上,以减轻cpu负载。DSP上没有操作系统,因此实现了一个任务调度管理器,代码在k510_buildroot/package/dsp_scheduler目录下。在DSP上运行的任务编译成静态库,预先和DSP scheduler静态链接在一起,运行时cpu通过mailbox向dsp发送消息启动相应的任务运行。 140 | 141 | 用户在注册任务的时候可以定义优先级,DSP scheduler根据优先级进行任务调度。任务运行接口run函数的返回值决定是RUN_ONCE还是CONTINUE_RUN,这样用户能自己决定任务的执行次数。 142 | 143 | cpu如何通过linux mailbox框架给dsp发消息,请参考文档K510_Mailbox_Developer_Guides里的相应介绍。参考实现在k510_buildroot/package/k510_evb_test/src/test/mailbox_demo/cpu2dsp_task_demo.c 144 | 145 | ### 3.3.1 头文件说明 146 | 147 | 1. k510_buildroot/package/dsp_scheduler/src/dsp_tasks.h 148 | 149 | cpu上运行的程序需要include此头文件,此头文件里定义了cpu和dsp之间的消息类型和结构,系统消息通信采用一问一答的方式,cpu发完消息后要等到dsp发来的相同消息表明dsp处理完毕。用户消息可以根据需要自行定义机制。消息含义如下: 150 | 151 | - DSP_TASK_ENABLE 152 | 153 | 相应的任务开始运行,此消息可以跟随一个内存地址,用于dsp上任务打印调试信息 154 | 155 | - DSP_TASK_DISABLE 156 | 157 | 相应的任务停止运行 158 | 159 | - DSP_TASK_PRINT_INFO 160 | 161 | 打印所有已经注册的任务信息 162 | 163 | - DSP_TASK_USER_MSG 164 | 165 | 用户自定义的任务消息,此消息跟随一个内存地址,用户可根据需要自行设计消息队列和消息通信机制 166 | 167 | ```c 168 | typedef enum 169 | { 170 | DSP_TASK_ENABLE = 0x10000000, 171 | DSP_TASK_DISABLE, 172 | DSP_TASK_PRINT_INFO, 173 | DSP_TASK_USER_MSG, 174 | MAX_NUM_DSP_TASK_MSG 175 | } DspTaskMsg; 176 | 177 | typedef struct tDSP_MESSAGE 178 | { 179 | DspTaskMsg msgId; /**log_id 0, cur_addr 0x1fdfd000, log_len 4096 345 | dsp process_command>task 0: init done 346 | task 0 is enabled 347 | cpu send PROCESS_START 348 | cpu receive PROCESS_END 349 | cpu send PROCESS_START 350 | cpu receive PROCESS_END 351 | cpu send PROCESS_START 352 | cpu receive PROCESS_END 353 | cpu send PROCESS_START 354 | cpu receive PROCESS_END 355 | cpu send PROCESS_START 356 | cpu receive PROCESS_END 357 | cpu send PROCESS_START 358 | cpu receive PROCESS_END 359 | cpu send PROCESS_START 360 | cpu receive PROCESS_END 361 | ^C //按下ctrl+c后 362 | cpu send PROCESS_START 363 | cpu receive PROCESS_END 364 | dsp process_command>task 0: deinit done 365 | task 0 is disabled 366 | exit: task0 is disabled 367 | cpu2dsp_task_demo: exit successful 368 | ``` 369 | 370 | **翻译免责声明** 371 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 372 | 373 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 374 | -------------------------------------------------------------------------------- /zh/K510_System_memory_map.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 System memory map** 4 | 5 | 文档版本:V1.0.0 6 | 7 | 发布日期:2022-03-09 8 | 9 |
10 | 11 | **免责声明** 12 | 您购买的产品、服务或特性等应受北京嘉楠捷思信息技术有限公司(“本公司”,下同)商业合同和条款的约束,本文档中描述的全部或部分产品、服务或特性可能不在您的购买或使用范围之内。除非合同另有约定,本公司不对本文档的任何陈述、信息、内容的准确性、可靠性、完整性、营销型、特定目的性和非侵略性提供任何明示或默示的声明或保证。除非另有约定,本文档仅作为使用指导的参考。 13 | 由于产品版本升级或其他原因,本文档内容将可能在未经任何通知的情况下,不定期进行更新或修改。 14 | 15 | **商标声明** 16 | 17 | “”、“Canaan”图标、嘉楠和嘉楠其他商标均为北京嘉楠捷思信息技术有限公司的商标。本文档可能提及的其他所有商标或注册商标,由各自的所有人拥有。 18 | 19 | **版权所有©2022北京嘉楠捷思信息技术有限公司** 20 | 本文档仅适用K510平台开发设计,非经本公司书面许可,任何单位和个人不得以任何形式对本文档的部分或全部内容传播。 21 | 22 | **北京嘉楠捷思信息技术有限公司** 23 | 网址:canaan-creative.com 24 | 商务垂询:salesAI@canaan-creative.com 25 | 26 |
27 | # 前言 28 | **文档目的** 29 | 本文档为K510 SDK 应用实例的说明文档。 30 | 31 | **读者对象** 32 | 33 | 本文档(本指南)主要适用的人员: 34 | 35 | - 软件开发人员 36 | - 技术支持人员 37 | 38 | **修订记录** 39 | 修订记录累积了每次文档更新的说明。最新版本的文档包含以前所有版本的更新内容。 40 | 41 | | 版本号 | 修改者 | 修订日期 | 修订说明 | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | 系统软件组 | 2022-03-09 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **目 录** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 K510 系统内存规划 58 | 59 | K510的内存规划如下图所示: 60 | 61 | ![](../zh/images/system_memory_map/k510-system-memory-map.png) 62 | 63 | K510 crb参考板上有512MB DDR,总共规划了四个区域: 64 | 65 | - 0~240M规划给Linux kernel 66 | - 240M~496MB规划给share memory,采用预留CMA内存池的方式,这样在Share memory没有使用的情况下,Linux kernel内存管理子系统也可以从CMA池中分配内存 67 | - 496M~510M规划给DSP使用 68 | - 510M~512M规划给logo使用 69 | 70 | # 2 设备树描述 71 | 72 | K510的内存规划采用reserved-meory的方式,通过设备树的reserved-memory节点进行描述。相关设备树节点信息如下: 73 | 74 | ```text 75 | ddr_memory: memory@0 { 76 | status = "okay"; 77 | device_type = "memory"; 78 | reg = <0x0 0x00000000 0x0 0x20000000>; 79 | }; 80 | 81 | sharem_cma:sharem_cma@8000000 { 82 | compatible = "k510-share-memory-cma"; 83 | reg = <0x0 0xf000000 0x0 0x10000000>; /*240M~496M*/ 84 | }; 85 | 86 | reserved-memory { 87 | #address-cells = <2>; 88 | #size-cells = <2>; 89 | ranges; 90 | 91 | cma_buffer: buffer@f000000 { 92 | compatible = "shared-dma-pool"; 93 | reusable; 94 | linux,cma-default; 95 | reg = <0x0 0xf000000 0x0 0x10000000>; 96 | }; 97 | 98 | dsp_buffer: buffer@1f000000 { 99 | no-map; 100 | reg = <0x0 0x1f000000 0x0 0xe00000>; 101 | }; 102 | 103 | logo_buffer: buffer@1fe00000 { 104 | no-map; 105 | reg = <0x0 0x1fe00000 0x0 0x200000>; 106 | }; 107 | }; 108 | ``` 109 | 110 | # 3 Buildroot相关配置 111 | 112 | 系统内存规划全部在linux kernel的dts中描述,但是dsp firmware的加载地址需要在buildroot中配置: 113 | 114 | configs/k510_crb_lp3_v0_1_defconfig: 115 | 116 | configs/k510_crb_lp3_v1_2_defconfig: 117 | 118 | BR2_TARGET_EVB_FIRMWARE_LOAD_ADD=0x1f000000 119 | 120 | **翻译免责声明** 121 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 122 | 123 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 124 | -------------------------------------------------------------------------------- /zh/K510_U-Boot_Developer_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 U-boot Developer's Guide** 4 | 5 | 文档版本:V1.0.0 6 | 7 | 发布日期:2022-03-09 8 | 9 |
10 | 11 | **免责声明** 12 | 您购买的产品、服务或特性等应受北京嘉楠捷思信息技术有限公司(“本公司”,下同)商业合同和条款的约束,本文档中描述的全部或部分产品、服务或特性可能不在您的购买或使用范围之内。除非合同另有约定,本公司不对本文档的任何陈述、信息、内容的准确性、可靠性、完整性、营销型、特定目的性和非侵略性提供任何明示或默示的声明或保证。除非另有约定,本文档仅作为使用指导的参考。 13 | 由于产品版本升级或其他原因,本文档内容将可能在未经任何通知的情况下,不定期进行更新或修改。 14 | 15 | **商标声明** 16 | 17 | “”、“Canaan”图标、嘉楠和嘉楠其他商标均为北京嘉楠捷思信息技术有限公司的商标。本文档可能提及的其他所有商标或注册商标,由各自的所有人拥有。 18 | 19 | **版权所有©2022北京嘉楠捷思信息技术有限公司** 20 | 本文档仅适用K510平台开发设计,非经本公司书面许可,任何单位和个人不得以任何形式对本文档的部分或全部内容传播。 21 | 22 | **北京嘉楠捷思信息技术有限公司** 23 | 网址:canaan-creative.com 24 | 商务垂询:salesAI@canaan-creative.com 25 | 26 |
27 | # 前言 28 | **文档目的** 29 | 本文档为K510 demo板sdk配套文档,主要介绍uboot相关内容,比如uboot下k510 demo板配置文件、设备树、驱动位置等信息。 30 | 31 | **读者对象** 32 | 33 | 本文档(本指南)主要适用的人员: 34 | 35 | - 软件开发人员 36 | - 技术支持人员 37 | 38 | **修订记录** 39 | 修订记录累积了每次文档更新的说明。最新版本的文档包含以前所有版本的更新内容。 40 | 41 | | 版本号 | 修改者 | 修订日期 | 修订说明 | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | 系统软件组 | 2022-03-09 | | 44 | | | | | | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **目 录** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 U-Boot 简介 58 | 59 | u-boot是sdk的一部分,sdk目前使用的u-boot版本是2020.01。Uboot是德国DENX小组的开发用于多种嵌入式CPU的bootloader程序, UBoot不仅仅支持嵌入式Linux系统的引导,当前,它还支持NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS嵌入式操作系统。UBoot除了支持PowerPC系列的处理器外,还能支持MIPS、 x86、ARM、NIOS、RISICV等,主要功能有初始化内存,引导linux系统,更多u-boot介绍请参考 60 | 61 | # 2 开发环境简介 62 | 63 | - 操作系统 64 | 65 | | 编号 | 软件资源 | 说明 | 66 | | ---- | -------- | ----------- | 67 | | 1 | Ubuntu | 18.04/20.04 | 68 | 69 | - 软件环境 70 | 71 | 软件环境要求如下表所示: 72 | 73 | | 编号 | 软件资源 | 说明 | 74 | | ---- | -------- | ---- | 75 | | 1 | K510 SDK | | 76 | 77 | # 3 获取方式 78 | 79 | 下载并编译sdk,sdk编译的时候会下载uboot代码,并编译uboot代码。sdk的下载编译方法请参考[K510_SDK_Build_and_Burn_Guide.md](./K510_SDK_Build_and_Burn_Guide.md) 80 | 81 | # 4 重要目录和文件说明 82 | 83 | 本章以编译k510_evb_lp3_v1_1_defconfig为例。对应的sdk编译方法是make CONF=k510_evb_lp3_v1_1_defconfig,其编译完后目录如下: 84 | 85 | ![image-20210930135634105](../zh/images/uboot_guides/build_out.png) 86 | 87 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom ---uboot的代码和编译目录; 88 | 89 | board/canaan/k510/uboot-sdcard.env---uboot默认环境变量配置文件 90 | 91 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom/configs/k510_evb_lp3_v1_1_defconfig --uboot配置文件; 92 | 93 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom/arch/riscv/dts/k510_evb_lp3_v1_1.dts----设备树文件; 94 | 95 | k510_evb_lp3_v1_1_defconfig/build/uboot-custom/include/configs/k510_evb_lp3_v1_1.h---头文件; 96 | 97 | k510_evb_lp3_v1_1_defconfig/images/u-boot_burn.bin ---uboot烧写固件 98 | 99 | buildroot-2020.02.11/boot/uboot ----buildroot里面关于uboot的编译脚本,一般不需修改; 100 | 101 | configs/k510_evb_lp3_v1_1_defconfig---sdk的配置文件,BR2_TARGET_UBOOT_BOARD_DEFCONFIG指定uboot的配置文件; 102 | 103 | # 5 uboot启动流程 104 | 105 | _start(arch/riscv/cpu/start.S, line 43) 106 | 107 | board_init_f(common/board_f.c, line 1013) 108 | 109 | board_init_r(common/board_r.c, line 845) 110 | 111 | run_main_loop(common/board_r.c, line 637) 112 | 113 | # 6 uboot下驱动说明 114 | 115 | ## 6.1 ddr驱动 116 | 117 | board/Canaan/k510_evb_lp3/ddr_init.c 118 | 119 | ## 6.2 eth驱动 120 | 121 | drivers/net/macb.c 122 | 123 | 设备树: 124 | 125 | ```text 126 | ethernet@93030000 { 127 | compatible = "cdns,macb"; 128 | reg = <0x0 0x93030000 0x0 0x10000>; 129 | phy-mode = "rmii"; 130 | interrupts = <0x36 0x4>; 131 | interrupt-parent = <0x4>; 132 | clocks = <0x5 0x5>; 133 | clock-names = "hclk", "pclk"; 134 | }; 135 | ``` 136 | 137 | ## 6.3 串口驱动 138 | 139 | drivers/serial/ns16550.c 140 | 141 | 设备树: 142 | 143 | ```text 144 | serial@96000000 { 145 | compatible = "andestech,uart16550", "ns16550a"; 146 | reg = <0x0 0x96000000 0x0 0x1000>; 147 | interrupts = <0x19 0x4>; 148 | clock-frequency = <0x17d7840>; 149 | reg-shift = <0x2>; 150 | reg-io-width = <0x4>; 151 | no-loopback-test = <0x1>; 152 | interrupt-parent = <0x4>; 153 | }; 154 | ``` 155 | 156 | ## 6.4 iomux 157 | 158 | drivers/pinctrl/pinctrl-single.c 159 | 160 | 设备树: 161 | 162 | ```text 163 | iomux@97040000 { 164 | compatible = "pinctrl-single"; 165 | reg = <0x0 0x97040000 0x0 0x10000>; 166 | #address-cells = <0x1>; 167 | #size-cells = <0x0>; 168 | #pinctrl-cells = <0x1>; 169 | pinctrl-single,register-width = <0x20>; 170 | pinctrl-single,function-mask = <0xffffffff>; 171 | pinctrl-names = "default"; 172 | pinctrl-0 = <0x6 0x7 0x8 0x9 0xa>; 173 | 174 | iomux_uart0_pins { 175 | pinctrl-single,pins = <0x1c0 0x540ca8 0x1c4 0x5a0c69>; 176 | phandle = <0x6>; 177 | }; 178 | 179 | iomux_emac_pins { 180 | pinctrl-single,pins = <0x8c 0x4e 0x90 0xce 0x88 0x8e 0x98 0x4e 0x80 0x8e 0xb8 0x4e 0xb4 0x4e 0xa8 0x8e 0xa4 0x8e 0x74 0x8e>; 181 | phandle = <0x7>; 182 | }; 183 | 184 | iomux_spi0_pins { 185 | pinctrl-single,pins = <0x158 0x4e 0x15c 0x4e 0x160 0xce 0x164 0xce 0x168 0xce 0x16c 0xce 0x170 0xce 0x174 0xce 0x178 0xce 0x17c 0xce 0x180 0x8e>; 186 | phandle = <0x8>; 187 | }; 188 | 189 | iomux_mmc0_pins { 190 | pinctrl-single,pins = <0x1c 0x4e 0x20 0xce 0x24 0xce 0x28 0xce 0x2c 0xce 0x30 0xce 0x34 0xce 0x38 0xce 0x3c 0xce 0x40 0xce>; 191 | phandle = <0x9>; 192 | }; 193 | 194 | iomux_mmc2_pins { 195 | pinctrl-single,pins = <0x5c 0x4e 0x60 0xce 0x64 0xce 0x68 0xce 0x6c 0xce 0x70 0xce>; 196 | phandle = <0xa>; 197 | }; 198 | }; 199 | ``` 200 | 201 | ## 6.5 mmc和sd卡驱动 202 | 203 | drivers/mmc/sdhci-cadence.c 204 | 205 | 设备树 206 | 207 | ```text 208 | mmc0@93000000 { 209 | compatible = "socionext,uniphier-sd4hc", "cdns,sd4hc"; 210 | reg = <0x0 0x93000000 0x0 0x400>; 211 | interrupts = <0x30 0x4>; 212 | interrupt-parent = <0x4>; 213 | clocks = <0xb 0x4>; 214 | max-frequency = <0xbebc200>; 215 | cap-mmc-highspeed; 216 | bus-width = <0x8>; 217 | }; 218 | 219 | mmc2@93020000 { 220 | compatible = "socionext,uniphier-sd4hc", "cdns,sd4hc"; 221 | reg = <0x0 0x93020000 0x0 0x400>; 222 | interrupts = <0x32 0x4>; 223 | interrupt-parent = <0x4>; 224 | clocks = <0xb 0x4>; 225 | max-frequency = <0xbebc200>; 226 | cap-sd-highspeed; 227 | bus-width = <0x1>; 228 | }; 229 | ``` 230 | 231 | # 7 Uboot默认环境变量 232 | 233 | uboot的默认环境变量在SDK的board/canaan/k510目录下,用文本文件预定义: 234 | 235 | uboot-emmc.env 236 | 237 | uboot-nfs.env 238 | 239 | uboot-sdcard.env 240 | 241 | SDK的post脚本会在编译的时候调用mkenvimage将文本的环境变量定义编译为uboot可以加载的二进制镜像,放在启动分区中。 242 | 243 | 举例如下: 244 | 245 | uboot-sdcard.env 246 | 247 | ```text 248 | bootm_size=0x2000000 249 | bootdelay=3 250 | 251 | stderr=serial@96000000 252 | stdin=serial@96000000 253 | stdout=serial@96000000 254 | arch=riscv 255 | baudrate=115200 256 | 257 | ipaddr=10.100.226.221 258 | netmask=255.255.255.0 259 | gatewayip=10.100.226.254 260 | serverip=10.100.226.63 261 | bootargs=root=/dev/mmcblk1p2 rw console=ttyS0,115200n8 debug loglevel=7 262 | 263 | bootcmd=fatload mmc 1:1 0x600000 bootm-bbl.img;fatload mmc 1:1 0x2000000 k510.dtb;bootm 0x600000 - 0x2000000 264 | bootcmd_nfs=tftp 0x600000 bootm-bbl.img;tftp 0x2000000 k510_nfsroot.dtb;bootm 0x600000 - 0x2000000 265 | ``` 266 | 267 | 注:内核启动参数bootargs由uboot的默认环境变量设置,dts中的bootargs将会被覆盖。详见 常见问题-bootargs 哪里获取并传给内核的? 268 | 269 | # 8 Uboot程序更新 270 | 271 | ## 8.1 烧写sdk镜像方法 272 | 273 | sdk镜像里面已经包含uboot程序,直接烧写sdk镜像,比如:k510_evb_lp3_v1_1_defconfig/images/sysimage-sdcard.img文件 274 | 275 | ## 8.2 linux下更新sd卡里面的uboot程序 276 | 277 | 把u-boot_burn.bin文件放到tftp目录,配置设备网口ip地址,进入/root/sd/p1目录;执行tftp -gr u-boot_burn.bin xxx.xxx.xxx.xx 命令; 278 | 279 | ## 8.3 linux更新emmc里面的uboot程序 280 | 281 | 把u-boot_burn.bin文件放到tftp目录,配置设备网口ip地址;通过tftp -gr u-boot_burn.bin xxx.xxx.xxx.xx下载文件到设备; 282 | 283 | 执行dd if=u-boot_burn.bin of=/dev/mmcblk0p1 命令把文件写到mmc卡。 284 | 285 | # 9 常见问题 286 | 287 | ## 9.1 DDR 频率如何配置? 288 | 289 | 答:目前evb只能跑800,CRB可以设置800或1600。CRB板子ddr频率设置方法见uboot的board\Canaan\k510_crb_lp3\ddr_param.h文件,800M对应#define DDR_800 1,1600M对应#define DDR_1600 1。 290 | 291 | ## 9.2 bootargs 哪里获取并传给内核的? 292 | 293 | 答:从uboot环境变量bootargs 获取,uboot引导内核时会根据bootargs 环境变量值,修改内存设备树里面的bootargs参数。相关代码如下: 294 | 295 | ```c 296 | int fdt_chosen(void *fdt) 297 | { 298 | int nodeoffset; 299 | int err; 300 | char *str; /* used to set string properties */ 301 | 302 | err = fdt_check_header(fdt); 303 | if (err < 0) { 304 | printf("fdt_chosen: %s\n", fdt_strerror(err)); 305 | return err; 306 | } 307 | 308 | /* find or create "/chosen" node. */ 309 | nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen"); 310 | if (nodeoffset < 0) 311 | return nodeoffset; 312 | 313 | str = env_get("bootargs"); 314 | if (str) { 315 | err = fdt_setprop(fdt, nodeoffset, "bootargs", str, 316 | strlen(str) + 1); 317 | if (err < 0) { 318 | printf("WARNING: could not set bootargs %s.\n", 319 | fdt_strerror(err)); 320 | return err; 321 | } 322 | } 323 | 324 | return fdt_fixup_stdout(fdt, nodeoffset); 325 | } 326 | ``` 327 | 328 | ## 9.3 启动参数和编译的设备树文件不一致? 329 | 330 | 答:uboot根据启动方式动态获取环境变量,引导内核时根据bootargs环境变量,更新内存里面的设备树。修改完后的启动参数见/sys/firmware/devicetree/base/chosen节点。 331 | 332 | ## 9.4 uboot环境变量保存在那里? 333 | 334 | 答: 335 | 336 | | 启动方式 | uboot读取和保存位置 | 编译时对应文件 | 337 | | :-: | :-: | :-: | 338 | | emmc启动 | emmc第二个分区的uboot-emmc.env文件 | board\canaan\k510\uboot-emmc.env | 339 | | sd卡启动 | sd卡第一个分区的uboot-sd.env文件 | board\canaan\k510\uboot-sd.env | 340 | 341 | ## 9.5 qos如何设置? 342 | 343 | 答:qos相关寄存器是QOS_CTRL0 QOS_CTRL1 QOS_CTRL2 QOS_CTRL3 QOS_CTRL4 。例子: 344 | 设置qos后,nncase demo性能有所提高 345 | 346 | ```c 347 | *(uint32_t *)0x970E00FC = (0x2 << 8) | (0x2 << 12) | (0x2 << 16) | (0x2 << 20) | (0x2 << 24); 348 | *(uint32_t *)0x970E0100 = (0x3 << 4) | 0x3; 349 | *(uint32_t *)0x970E00F4 = (0x5 << 16) | (0x5 << 20); 350 | ``` 351 | 352 | **翻译免责声明** 353 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 354 | 355 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 356 | -------------------------------------------------------------------------------- /zh/K510_V4l2_Developer_Guides.md: -------------------------------------------------------------------------------- 1 | ![](../zh/images/canaan-cover.png) 2 | 3 | **K510 V4L2 Developer's Guide** 4 | 5 | 文档版本:V1.0.0 6 | 7 | 发布日期:2022-03-09 8 | 9 |
10 | 11 | **免责声明** 12 | 您购买的产品、服务或特性等应受北京嘉楠捷思信息技术有限公司(“本公司”,下同)商业合同和条款的约束,本文档中描述的全部或部分产品、服务或特性可能不在您的购买或使用范围之内。除非合同另有约定,本公司不对本文档的任何陈述、信息、内容的准确性、可靠性、完整性、营销型、特定目的性和非侵略性提供任何明示或默示的声明或保证。除非另有约定,本文档仅作为使用指导的参考。 13 | 由于产品版本升级或其他原因,本文档内容将可能在未经任何通知的情况下,不定期进行更新或修改。 14 | 15 | **商标声明** 16 | 17 | “”、“Canaan”图标、嘉楠和嘉楠其他商标均为北京嘉楠捷思信息技术有限公司的商标。本文档可能提及的其他所有商标或注册商标,由各自的所有人拥有。 18 | 19 | **版权所有©2022北京嘉楠捷思信息技术有限公司** 20 | 本文档仅适用K510平台开发设计,非经本公司书面许可,任何单位和个人不得以任何形式对本文档的部分或全部内容传播。 21 | 22 | **北京嘉楠捷思信息技术有限公司** 23 | 网址:canaan-creative.com 24 | 商务垂询:salesAI@canaan-creative.com 25 | 26 |
27 | # 前言 28 | **文档目的** 29 | 本文档为K510 V4L2 应用实例的说明文档。 30 | 31 | **读者对象** 32 | 33 | 本文档(本指南)主要适用的人员: 34 | 35 | - 软件开发人员 36 | - 技术支持人员 37 | 38 | **修订记录** 39 | 修订记录累积了每次文档更新的说明。最新版本的文档包含以前所有版本的更新内容。 40 | 41 | | 版本号 | 修改者 | 修订日期 | 修订说明 | 42 | | :----- |------- | ------ | ------ | 43 | | V1.0.0 | 系统软件组 | 2022-03-09 | SDK V1.5发布 | 44 | | v1.0.1 | 朱大雷 | 2022-03-11 | SDK V1.5发布 | 45 | | | | | | 46 | | | | | | 47 | | | | | | 48 | | | | | | 49 | 50 |
51 | **目 录** 52 | 53 | [TOC] 54 | 55 |
56 | 57 | # 1 V4L2 mediactl库 58 | 59 | ## 1.1 头文件说明 60 | 61 | \#include “media_ctl.h” 62 | 63 | ## 1.2 API 函数说明 64 | 65 | ### ◆ mediactl_init 66 | 67 | ```c 68 | struct video_info { 69 | unsigned int video_used; 70 | char *video_name[4]; 71 | unsigned int enable[4]; 72 | unsigned int video_width[4]; 73 | unsigned int video_height[4]; 74 | unsigned int video_out_format[4]; 75 | }; 76 | 77 | int mediactl_init(char *video_cfg_file,struct video_info *dev_info); 78 | ``` 79 | 80 | 初始化media。 81 | 82 | #### 参数 83 | 84 | ```text 85 | 参数: 86 | [in] video_cfg_file: video的配置文件,这个文件的内容只需关心下面解释的内容,具体解释如下。 87 | sensor0_name:只在V4L2驱动中设置的sensor驱动名字。 88 | sensor0_cfg_file:sensor对应的isp参数配置文件名字,如imx219_0.conf。 89 | sensor0_total_width:sensor输出的水平方向的总像素,用来产生VSYNC信号,如3476 90 | sensor0_total_height:sensor输出的总行数,用来产生HSYNC信号,如1166 91 | sensor0_active_width:sensor输出的水平方向的有效像素,如1920, 92 | sensor0_active_height:sensor输出的有效行数,如1080 93 | video2_used:1 -- 使能,0 -- 没有使用。 94 | video2_width:video输出的宽度,如1920。 95 | video2_height:video输出的高度,如1080。 96 | video2_out_format:1--指YUV420,NV21。 97 | video3_used:1 -- 使能,0 -- 没有使用。 98 | video3_width:video输出的宽度,如1080。 99 | video3_height:video输出的高度,如720。 100 | video3_out_format:1--指YUV420,NV21。 101 | video4_used:1 -- 使能,0 -- 没有使用。 102 | video4_width:video输出的宽度,如640。 103 | video4_height:video输出的高度,如480。 104 | video4_out_format:1--指YUV420,NV21。 105 | video5_used:1 -- 使能,0 -- 没有使用。 106 | video5_width:video输出的宽度,如320。 107 | video5_height":video存储的高度,如320。 108 | video5_height_r:video输出的高度,如240。 109 | video5_out_format:0--指分离RGB,1--指ARGB。 110 | sensor1_name:只在V4L2驱动中设置的sensor驱动名字。 111 | sensor1_cfg_file:sensor对应的isp参数配置文件名字,如imx219_0.conf。 112 | sensor1_total_width:sensor输出的水平方向的总像素,用来产生VSYNC信号,如3476, 113 | sensor1_total_height:sensor输出的总行数,用来产生HSYNC信号,如1166, 114 | sensor1_active_width:sensor输出的水平方向的有效像素,如1920, 115 | sensor1_active_height:sensor输出的有效行数,如1080 116 | video6_used:1 -- 使能,0 -- 没有使用。 117 | video6_width:video输出的宽度,如1920。 118 | video6_height:video输出的高度,如1080。 119 | video6_out_format:1--指YUV420,NV21。 120 | video7_used:1 -- 使能,0 -- 没有使用。 121 | video7_width:video输出的宽度,如1080。 122 | video7_height:video输出的高度,如720. 123 | video7_out_format:1--指YUV420,NV21。 124 | video8_used:1 -- 使能,0 -- 没有使用。 125 | video8_width:video输出的宽度,如640。 126 | video8_height:video输出的高度,如480。 127 | video8_out_format:1--指YUV420,NV21。 128 | video9_used:1 -- 使能,0 -- 没有使用。 129 | video9_width:video输出的宽度,如320。 130 | video9_height:video存储的宽度,如320。 131 | video9_height_r:video输出的高度,如240。 132 | video9_out_format:0--指分离RGB,1--指ARGB。 133 | [out] dev_info: mediactl_lib返回从video的配置文件得到的video信息,具体的解释如下。 134 | video_used:这里是指ISP的pipeline,如果使用就会返回1,否则0。K510支持ISP_F2K/ISP_R2K这两个pipeline,每个pipeline最多支持4个video输出。 135 | video_name[4]:返回的video的名字。f2k的四个video是video2/video3/video4/video5;r2k的四个video是 video6/video7/video8/video9 136 | enable[4]:返回的每个video是否使能,1 -- 使能,0 -- 没有使用。 137 | video_width[4]:返回的每个video的宽度。 138 | video_height[4]:返回的每个video的高度。 139 | video_out_format[4]:返回的每个video的输出图像格式,具体见《video的配置文件》的解释。 140 | 具体使用方法如下: 141 | char *video_cfg_file = "video_cfg"; 142 | struct video_info dev_info[2] 143 | mediactl_init(video_cfg_file,&dev_info) 144 | ``` 145 | 146 | #### 返回值 147 | 148 | ```text 149 | 0 成功, -1 失败. 150 | ``` 151 | 152 | ### ◆ mediactl_exit 153 | 154 | 关闭media设备及释放申请的share memory内存。 155 | 156 | #### 参数 157 | 158 | ```text 159 | 参数: 160 | 无 161 | ``` 162 | 163 | ### ◆ adaptive_enable 164 | 165 | ```c 166 | enum adaptive_enable_select_e 167 | { 168 | ADAPTIVE_SELECT_DISABLE, 169 | ADAPTIVE_SELECT_ENABLE, 170 | }; 171 | int adaptive_enable(int scl); 172 | ``` 173 | 174 | 配置ISP自适应功能开关 175 | 176 | #### 参数 177 | 178 | ```text 179 | 参数 180 | ADAPTIVE_SELECT_DISABLE:关闭libadaptive.so提供的自适应功能计算 181 | ADAPTIVE_SELECT_ENABLE:开启libadaptive.so提供的自适应功能计算(默认) 182 | ``` 183 | 184 | ### ◆ ae_select_init 185 | 186 | ```c 187 | enum ae_select_e 188 | { 189 | AE_SELECT_SW_MODE, 190 | AE_SELECT_HW_MODE, 191 | }; 192 | int ae_select_init(int scl); 193 | 194 | ``` 195 | 196 | 配置软硬AE切换 197 | 198 | #### 参数 199 | 200 | ```text 201 | 参数 202 | AE_SELECT_SW_MODE:开启软件AE,使用lib3actl.so提供的软件AE(默认) 203 | AE_SELECT_HW_MODE:开启硬件AE,使用硬件AE 204 | ``` 205 | 206 | ### ◆ anti_flicker_init 207 | 208 | ```c 209 | enum anti_flicker_scl_e 210 | { 211 | ANTI_FLICKER_ALL_DSIABLE, 212 | ANTI_FLICKER_F2K_ENABLE, 213 | ANTI_FLICKER_R2K_ENABLE, 214 | ANTI_FLICKER_ALL2K_ENABLE, 215 | }; 216 | int anti_flicker_init(int scl); 217 | ``` 218 | 219 | 配置antiflicker矫正功能 220 | 221 | #### 参数 222 | 223 | ```text 224 | 参数 225 | ANTI_FLICKER_ALL_DSIABLE:关闭antiflicker矫正功能 226 | ANTI_FLICKER_F2K_ENABLE:开启F2K antiflicker50Hz矫正功能 227 | ANTI_FLICKER_R2K_ENABLE:开启R2K antiflicker50Hz矫正功能 228 | ANTI_FLICKER_ALL2K_ENABLE:开启F2K和R2K antiflicker50Hz矫正功能(默认) 229 | ``` 230 | 231 | ### ◆ mediactl_set_ae 232 | 233 | ```c 234 | enum isp_pipeline_e { 235 | ISP_F2K_PIPELINE, 236 | ISP_R2K_PIPELINE, 237 | ISP_TOF_PIPELINE 238 | }; 239 | void mediactl_disable_ae(enum isp_pipeline_e pipeline); 240 | ``` 241 | 242 | 关闭ISP的AE。 243 | 244 | #### 参数 245 | 246 | ```text 247 | 参数: 248 | ISP_F2K_PIPELINE:关闭f2k pipeline的AE。 249 | ISP_R2K_PIPELINE:关闭r2k pipeline的AE。 250 | ``` 251 | 252 | ### ◆ mediactl_get_isp_modules 253 | 254 | ```c 255 | enum isp_modules { 256 | ISP_TPG, 257 | ISP_BLC, 258 | ISP_LSC, 259 | ISP_AE, 260 | ISP_AWB, 261 | ISP_AWB_D65, 262 | ISP_AWB_CCM, 263 | ISP_WDR, 264 | ISP_RGB_GAMMA, 265 | ISP_YUV_GAMMA, 266 | ISP_ADA, 267 | ISP_ADA_SBZ, 268 | ISP_ADA_CCR, 269 | ISP_RGBIR, 270 | ISP_RAW_2DNR, 271 | ISP_YUV_Y_2DNR, 272 | ISP_YUV_UV_2DNR, 273 | ISP_3DNR, 274 | ISP_LTM, 275 | ISP_SHARP, 276 | ISP_CC, 277 | ISP_CTRST, 278 | ISP_LUMA, 279 | ISP_SATURATION, 280 | ISP_LDC, 281 | ISP_AF, 282 | }; 283 | 284 | unsigned int mediactl_get_isp_modules(enum isp_pipeline_e pipeline,enum isp_modules module); 285 | ``` 286 | 287 | 获取ISP的各模块的使能状态。 288 | 289 | #### 参数 290 | 291 | ```text 292 | 参数: 293 | isp_pipeline_e:具体见mediactl_set_ae中的解释。 294 | isp_modules: 295 | ISP_TPG -- Test Pattern Control模块 296 | ISP_BLC -- Black Level Correction模块 297 | ISP_LSC -- Lens Shading Correction模块 298 | ISP_AE -- AUTO Exposure Gain模块 299 | ISP_AWB -- AUTO white balance模块 300 | ISP_AWB_D65 -- AUTO white balance d65模块 301 | ISP_AWB_CCM -- AUTO white balance ccm模块 302 | ISP_WDR -- wide dynamic range模块 303 | ISP_RGB_GAMMA -- rgb gamma模块 304 | ISP_YUV_GAMMA -- yuv gamma模块 305 | ISP_ADA -- Adaptive dynamic range adjust模块 306 | ISP_ADA_SBZ -- Image stabilization模块 307 | ISP_ADA_CCR -- Color correction模块 308 | ISP_RGBIR -- rgbir rectify模块 309 | ISP_RAW_2DNR -- raw域2D降噪模块 310 | ISP_YUV_Y_2DNR -- yuv域2D Y方向降噪模块 311 | ISP_YUV_UV_2DNR -- yuv域2D uv方向降噪模块 312 | ISP_3DNR -- yuv域3D降噪模块 313 | ISP_LTM -- local tone mapping模块 314 | ISP_SHARP -- sharpness模块 315 | ISP_CC -- color correction模块 316 | ISP_CTRST -- contrast adjust模块 317 | ISP_LUMA -- luma adjust模块 318 | ISP_SATURATION -- saturation adjust 模块 319 | ISP_LDC -- lens Distortion Correction模块 320 | ISP_AF -- ATUO FOCUS模块 321 | ``` 322 | 323 | #### 返回值 324 | 325 | ```text 326 | 0 -- 模块没有使能 1 -- 模块使能 327 | ``` 328 | 329 | # 2 配置imx385 sensor 330 | 331 | ## 2.1 修改 设备树 332 | 333 | ```text 334 | 修改k510_crb_lp3_v1_2.dts 文件,将 335 | #include "k510_common/camera-imx219x2.dtsi" 替换成 336 | #include "k510_common/camera-imx385.dtsi", 如下图所示 337 | ``` 338 | 339 | ![ouput.yuv](../zh/images/sdk_application/image-imx385-dts.jpg) 340 | 341 | ## 2.2 修改内核 342 | 343 | ```shell 344 | cd k510_buildroot/k510_crb_lp3_v1_2_defconfig 345 | make linux-menuconfig 346 | ``` 347 | 348 | 进入配置界面后,进入下边路径: 349 | 350 | ```text 351 | Device Drivers ---> 352 | Multimedia support ---> 353 | Sensors used on soc_camera driver ---> 354 | ``` 355 | 356 | 进入目录后,将Sony IMX385 sensor support 选上,两个219 的不选上,如下如: 357 | ![ouput.yuv](../zh/images/sdk_application/image-imx385-kernel-config.jpg) 358 | 359 | ## 2.3 重新编译镜像 360 | 361 | ```shell 362 | cd k510_buildroot/k510_crb_lp3_v1_2_defconfig 363 | make linux-rebuild 364 | make riscv-pk-k510-dirclean 365 | make riscv-pk-k510 366 | make 367 | ``` 368 | 369 | # 3 Demo应用 370 | 371 | ## 3.1 v4l2_drm 372 | 373 | 程序放在`/app/mediactl_lib`目录下: 374 | 375 | - `v4l2_drm.out`:v4l2和drm联动case,添加了-f 修改输入配置文件的名字。可以使用-h 查看帮助。 376 | 377 | 运行v4l2_drm.out 378 | 379 | - -e:0 关闭所有ae,1打开 f-2k ae,2打开r-2k ae,3打开所有ae。默认情况下可以不指定-e 就是关闭所有ae。 380 | - -x:0 切换至由lib3actl提供的sw ae,1切换至硬件AE。默认情况下可以不指定-x就是sw ae。 381 | - -a:0 关闭antiflicker矫正功能,1 打开f-2k 50Hz矫正功能,2打开r-2k矫正功能,3打开所有antiflicker 50Hz矫正功能。默认情况下可以不指定-a就是开启所有50Hz矫正功能。 382 | - -l:0 关闭libadaptive.so提供的ISP自适应计算功能,1 libadaptive.so提供的ISP自适应计算功能。默认情况下可以不指定-l就是开启libadaptive.so提供的ISP自适应计算功能。 383 | - 该demo 需要video配置文件及对应的sensor配置文件在当前目录下。 384 | - 该demo通过更改配置文件,可以演示单双摄。 385 | - 该demo演示单摄全屏:./v4l2_drm.out -f video_drm_1080x1920.conf 386 | - 该demo演示双摄:./v4l2_drm.out -f video_drm_1920x1080.conf 387 | - 该demo必须保证video_drm_1920x1080.conf,imx219_0.conf及imx219_1.conf三个配置文件存在 388 | - imx385 demo:./v4l2_drm.out -e 1 -f imx385_video_1920x1080.conf 389 | 390 | **翻译免责声明** 391 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 392 | 393 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 394 | -------------------------------------------------------------------------------- /zh/README.md: -------------------------------------------------------------------------------- 1 | [![Gitee repository](https://img.shields.io/badge/gitee-repository-blue?logo=gitee&style=plastic)](https://gitee.com/kendryte/k510_docs) 2 | [![GitHub release](https://img.shields.io/github/v/release/kendryte/k510_docs?color=brightgreen&display_name=tag&logo=github&style=plastic)](https://github.com/kendryte/k510_docs/releases) 3 | 4 | # 文档概述 5 | 6 | k510 相关文档如下: 7 | 8 | | 文档名称 | 文档概要 | 9 | | :-- | :-- | 10 | | [K510_CRB_V1.2_Hardware_Guide.md](K510_CRB_V1.2_Hardware_Guide.md) | K510 CRB V1.2 硬件资源说明文档 | 11 | | [K510_CRB_V1.2 Schematic](https://github.com/kendryte/k510_docs/releases/download/v1.5/K510_CRB_Schematic.zip) | K510 CRB V1.2 原理图| 12 | | [K510_SDK_Build_and_Burn_Guide.md](K510_SDK_Build_and_Burn_Guide.md) | K510 SDK 编译和烧录说明文档 | 13 | | [K510_System_memory_map.md](K510_System_memory_map.md) | K510 SDK 系统memory划分说明文档 | 14 | | [K510_SDK_Application_Guides.md](K510_SDK_Application_Guides.md) | K510 参考示例程序说明文档 | 15 | | [K510_nncase_Developer_Guides.md](K510_nncase_Developer_Guides.md) | K510 compiler 使用说明文档 | 16 | | [K510_AI_Application_Guides.md](K510_AI_Application_Guides.md) | k510 AI 应用部署流程说明文档 | 17 | | [K510_U-Boot_Developer_Guides.md](K510_U-Boot_Developer_Guides.md) | K510 SDK uboot说明文档 | 18 | | [K510_Linux_Kernel_Driver_Developer_Guides.md](K510_Linux_Kernel_Driver_Developer_Guides.md) | K510 SDK kernel 说明文档 | 19 | | [K510_SDK_DSP_CORE_Guide.md](K510_SDK_DSP_CORE_Guide.md) | K510 DSP核使用说明文档 | 20 | | [K510_V4l2_Developer_Guides.md](K510_V4l2_Developer_Guides.md) | K510 V4L2 应用实例说明文档 | 21 | | [K510_V4l2_Sensor_Developer_Guides.md](K510_V4l2_Sensor_Developer_Guides.md) | K510 sensor 开发说明文档 | 22 | | [K510_Drm_Developer_Guides.md](K510_Drm_Developer_Guides.md) | K510 DRM API接口说明文档 | 23 | | [K510_Multimedia_Developer_Guides.md](K510_Multimedia_Developer_Guides.md) | K510 Multimedia 应用实例说明文档 | 24 | | [K510_Mailbox_Developer_Guides.md](K510_Mailbox_Developer_Guides.md) | K510 多处理器通信说明文档 | 25 | | [K510_ISP_Tuning_Tool_Guides.md](K510_ISP_Tuning_Tool_Guides.md) | K510 ISP Tuning Tool 说明文档 [下载地址](https://github.com/kendryte/k510_isp_tuning_tool/releases) | 26 | | [K510_ISP_Adaptive_Tuning_Guides.md](K510_ISP_Adaptive_Tuning_Guides.md) | K510 ISP Adaptive Tuning 参数说明文档 | 27 | 28 | ## 贡献指南 29 | 30 | 如果您对本项目感兴趣,想要反馈问题或提交文档,请参考[CONTRIBUTING](/.github/CONTRIBUTING.md) 31 | 32 | ## 联系我们 33 | 34 | 北京嘉楠捷思信息技术有限公司 35 | 网址:[canaan-creative.com](https://www.canaan-creative.com/) 36 | 商务垂询:[salesAI@canaan-creative.com](mailto:salesAI@canaan-creative.com) 37 | 38 | **翻译免责声明** 39 | 为方便客户,Canaan 使用 AI 翻译程序将文本翻译为多种语言,它可能包含错误。我们不保证提供的译文的准确性、可靠性或时效性。对于因依赖已翻译信息的准确性或可靠性而造成的任何损失或损害,Canaan 概不负责。如果不同语言翻译之间存在内容差异,以简体中文版本为准。 40 | 41 | 如果您要报告翻译错误或不准确的问题,欢迎通过邮件与我们联系。 42 | -------------------------------------------------------------------------------- /zh/images/ai_demo/image-ai-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/ai_demo/image-ai-demo.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/activity_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/activity_log.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/attach_policies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/attach_policies.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/aws_iot_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/aws_iot_config.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/aws_iot_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/aws_iot_test.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/aws_iot_test_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/aws_iot_test_log.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/board_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/board_back.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/board_front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/board_front.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/boot_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/boot_mode.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/certification_display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/certification_display.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/certs_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/certs_folder.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/create_policy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/create_policy.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/create_single_thing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/create_single_thing.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/create_things.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/create_things.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/device_certificate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/device_certificate.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/download_crts_keys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/download_crts_keys.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/thing_properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/thing_properties.png -------------------------------------------------------------------------------- /zh/images/aws_quick_start/troubleshooting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/aws_quick_start/troubleshooting.png -------------------------------------------------------------------------------- /zh/images/canaan-cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/canaan-cover.png -------------------------------------------------------------------------------- /zh/images/canaan-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/canaan-logo.png -------------------------------------------------------------------------------- /zh/images/doc_dsp/demo_dsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/doc_dsp/demo_dsp.png -------------------------------------------------------------------------------- /zh/images/doc_dsp/image-dsp_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/doc_dsp/image-dsp_1.png -------------------------------------------------------------------------------- /zh/images/doc_dsp/image-dsp_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/doc_dsp/image-dsp_log.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/canaan-board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/canaan-board.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw-3-18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw-3-18.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3-10.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3-13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3-13.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3-16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3-16.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3-17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3-17.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3-3.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_11.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_12.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_14.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_15.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_5.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_7.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_8.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_3_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_3_9.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/clip_hw_4_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/clip_hw_4_1.jpg -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-K510_Core.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-K510_Core.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-eMMC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-eMMC.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_1_2.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_1_3.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_2-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_2-4.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_2_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_2_1.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_2_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_2_2.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_2_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_2_3.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_3_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_3_1.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_3_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_3_2.png -------------------------------------------------------------------------------- /zh/images/hw_crb_v1_2/image-hw_3_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/hw_crb_v1_2/image-hw_3_6.png -------------------------------------------------------------------------------- /zh/images/mailbox/130601_dsp_load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/mailbox/130601_dsp_load.png -------------------------------------------------------------------------------- /zh/images/mailbox/130602_mailbox_async.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/mailbox/130602_mailbox_async.png -------------------------------------------------------------------------------- /zh/images/mailbox/130602_mailbox_poll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/mailbox/130602_mailbox_poll.png -------------------------------------------------------------------------------- /zh/images/multimedia_guides/EasyDarwin_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/multimedia_guides/EasyDarwin_run.png -------------------------------------------------------------------------------- /zh/images/multimedia_guides/ffmpeg_block_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/multimedia_guides/ffmpeg_block_diagram.png -------------------------------------------------------------------------------- /zh/images/multimedia_guides/ffmpeg_canaan_audio3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/multimedia_guides/ffmpeg_canaan_audio3a.png -------------------------------------------------------------------------------- /zh/images/multimedia_guides/hardware_block_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/multimedia_guides/hardware_block_diagram.png -------------------------------------------------------------------------------- /zh/images/multimedia_guides/multimedia_block_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/multimedia_guides/multimedia_block_diagram.png -------------------------------------------------------------------------------- /zh/images/multimedia_guides/sdp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/multimedia_guides/sdp.png -------------------------------------------------------------------------------- /zh/images/package_app/image-ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/package_app/image-ps.png -------------------------------------------------------------------------------- /zh/images/package_app/image-ps_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/package_app/image-ps_list.png -------------------------------------------------------------------------------- /zh/images/package_app/image-rc.sysinit-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/package_app/image-rc.sysinit-b.png -------------------------------------------------------------------------------- /zh/images/package_app/image-rc.sysinit-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/package_app/image-rc.sysinit-c.png -------------------------------------------------------------------------------- /zh/images/quick_start/balenaetcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/quick_start/balenaetcher.png -------------------------------------------------------------------------------- /zh/images/quick_start/k510_boot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/quick_start/k510_boot.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image001.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image002.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image003.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image004.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image005.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image006.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image007.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image008.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image009.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image010.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image011.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image012.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image012.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image013.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image013.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image014.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image014.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image015.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image016.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image016.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image017.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image018.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image019.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image020.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image021.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image022.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image022.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image023.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image024.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image025.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image026.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image028.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image029.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image030.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image031.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image031.png -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image032.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image032.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/clip_image033.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/clip_image033.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_dsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_dsp.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_dualcamera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_dualcamera.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_dualcamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_dualcamera.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_h264.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_h264.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_nncase_qos_ctrl0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_nncase_qos_ctrl0.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_nncase_qos_ctrl1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_nncase_qos_ctrl1.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_nncase_qos_ctrl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_nncase_qos_ctrl2.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_nncase_qos_ctrl3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_nncase_qos_ctrl3.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_nncase_qos_ctrl4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_nncase_qos_ctrl4.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_rtsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_rtsp.png -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_videolib.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_videolib.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/demo_videolib_n.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/demo_videolib_n.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/driver-twod-output-1080x1920.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/driver-twod-output-1080x1920.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/driver-twod-output-640x480.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/driver-twod-output-640x480.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/image-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-client.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-gpio-keys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-gpio-keys.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-imx385-dts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-imx385-dts.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/image-imx385-kernel-config.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-imx385-kernel-config.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/image-menu0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-menu0.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-menu2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-menu2.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-pwm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-pwm.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-rtc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-rtc.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-sdmmc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-sdmmc.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-server.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-uart-mobaxterm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-uart-mobaxterm.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-uart-shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-uart-shell.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-uart-telent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-uart-telent.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image-watchdog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image-watchdog.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_crypto_cbc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_crypto_cbc.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_crypto_ecb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_crypto_ecb.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_crypto_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_crypto_help.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_crypto_sha256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_crypto_sha256.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_drm_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_drm_demo.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_lvgl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_lvgl.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_trng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_trng.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_v4l2_drm_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_v4l2_drm_demo.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_wifi_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_wifi_1.png -------------------------------------------------------------------------------- /zh/images/sdk_application/image_wifi_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/image_wifi_2.png -------------------------------------------------------------------------------- /zh/images/sdk_application/twod-osd2yuv-app.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/twod-osd2yuv-app.jpg -------------------------------------------------------------------------------- /zh/images/sdk_application/twod-scaler-overlay-osd-app.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_application/twod-scaler-overlay-osd-app.jpg -------------------------------------------------------------------------------- /zh/images/sdk_build/clip_image_p1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/clip_image_p1.jpg -------------------------------------------------------------------------------- /zh/images/sdk_build/clip_image_p2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/clip_image_p2.jpg -------------------------------------------------------------------------------- /zh/images/sdk_build/image-app-build-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-app-build-2.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-app_build-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-app_build-1.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-build_make_def.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-build_make_def.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-build_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-build_menu.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-build_savedef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-build_savedef.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-buildroot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-buildroot.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-config_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-config_list.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-dd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-dd.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-dev_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-dev_sd.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-emmc3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-emmc3.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-emmc_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-emmc_1.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-emmc_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-emmc_2.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-enter_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-enter_docker.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-extern_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-extern_option.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-hello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-hello.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-linux_men.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-linux_men.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-linux_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-linux_menu.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-linux_rebuild.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-linux_rebuild.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-linux_savedefconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-linux_savedefconfig.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-make.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-make.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-make_men.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-make_men.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-make_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-make_menu.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-make_savedef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-make_savedef.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-make_u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-make_u.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-makeout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-makeout.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-makeresult.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-makeresult.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-mdk_dts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-mdk_dts.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-pre1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-pre1.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-pull_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-pull_docker.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-riscv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-riscv.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-sd_pre0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-sd_pre0.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-uboot-rebuild.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-uboot-rebuild.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-uboot_men.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-uboot_men.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-uboot_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-uboot_menu.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-uboot_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-uboot_r.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-uboot_savedefconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-uboot_savedefconfig.png -------------------------------------------------------------------------------- /zh/images/sdk_build/image-vi_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_build/image-vi_config.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_defconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_defconfig.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_dir1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_dir1.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_dir2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_dir2.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_images.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_knownissue1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_knownissue1.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_menuconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_menuconfig.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_nfsboot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_nfsboot1.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_nfsboot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_nfsboot2.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_nfsboot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_nfsboot3.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_version.png -------------------------------------------------------------------------------- /zh/images/sdk_guides/sdk_win32disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/sdk_guides/sdk_win32disk.png -------------------------------------------------------------------------------- /zh/images/system_memory_map/k510-system-memory-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/system_memory_map/k510-system-memory-map.png -------------------------------------------------------------------------------- /zh/images/uboot_guides/build_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/images/uboot_guides/build_out.png -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/box_utils.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | def xywh2xyxy(x): 4 | y = np.zeros_like(x) 5 | y[:, 0] = x[:, 0] - x[:, 2] / 2 6 | y[:, 1] = x[:, 1] - x[:, 3] / 2 7 | y[:, 2] = x[:, 0] + x[:, 2] / 2 8 | y[:, 3] = x[:, 1] + x[:, 3] / 2 9 | return y 10 | 11 | def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False): 12 | box2 = np.transpose(box2,[1,0]) 13 | 14 | if x1y1x2y2: 15 | b1_x1, b1_y1, b1_x2, b1_y2 = box1[0], box1[1], box1[2], box1[3] 16 | b2_x1, b2_y1, b2_x2, b2_y2 = box2[0,:], box2[1,:], box2[2,:], box2[3,:] 17 | else: 18 | b1_x1, b1_x2 = box1[0] - box1[2] / 2, box1[0] + box1[2] / 2 19 | b1_y1, b1_y2 = box1[1] - box1[3] / 2, box1[1] + box1[3] / 2 20 | b2_x1, b2_x2 = box2[0,:] - box2[2,:] / 2, box2[0,:] + box2[2,:] / 2 21 | b2_y1, b2_y2 = box2[1,:] - box2[3,:] / 2, box2[1,:] + box2[3,:] / 2 22 | 23 | inter_area = np.clip(np.minimum(b1_x2, b2_x2) - np.maximum(b1_x1, b2_x1), 0, 100000)* \ 24 | np.clip(np.minimum(b1_y2, b2_y2) - np.maximum(b1_y1, b2_y1), 0, 100000) 25 | 26 | union_area = ((b1_x2 - b1_x1) * (b1_y2 - b1_y1) + 1e-16) + \ 27 | (b2_x2 - b2_x1) * (b2_y2 - b2_y1) - inter_area 28 | 29 | iou = inter_area / union_area # iou 30 | if GIoU: 31 | c_x1, c_x2 = np.minimum(b1_x1, b2_x1), np.maximum(b1_x2, b2_x2) 32 | c_y1, c_y2 = np.minimum(b1_y1, b2_y1), np.maximum(b1_y2, b2_y2) 33 | c_area = (c_x2 - c_x1) * (c_y2 - c_y1) # convex area 34 | return iou - (c_area - union_area) / c_area # GIoU 35 | 36 | return iou 37 | 38 | def non_max_suppression(class_score, loc, conf_thres=0.5, nms_thres=0.5, nms_style = 'MERGE' ): 39 | output = [None] 40 | class_conf = class_score.max(axis=1) 41 | valid_index = (class_conf > conf_thres) & np.isfinite(loc).all(axis=1) & np.isfinite(class_score).all(axis=1) 42 | if np.sum(valid_index) == 0: 43 | return output 44 | class_conf = class_conf[valid_index] 45 | valid_score = class_score[valid_index] 46 | class_pred = np.argmax(valid_score, axis=1) 47 | valid_loc = loc[valid_index] 48 | valid_loc = xywh2xyxy(valid_loc) 49 | pred = np.concatenate([valid_loc, np.expand_dims(class_conf, 1), np.expand_dims(class_pred, 1)], axis=1) 50 | pred = pred[(-pred[:, 4]).argsort()] 51 | det_max = [] 52 | for c in np.unique(pred[:, -1]): 53 | dc = pred[pred[:, -1] == c] 54 | n = len(dc) 55 | if n == 1: 56 | det_max.append(dc) 57 | continue 58 | elif n > 100: 59 | dc = dc[:100] 60 | 61 | if nms_style == 'OR': 62 | while dc.shape[0]: 63 | det_max.append(dc[:1]) 64 | if len(dc) == 1: 65 | break 66 | iou = bbox_iou(dc[0], dc[1:]) 67 | dc = dc[1:][iou < nms_thres] 68 | 69 | elif nms_style == 'AND': 70 | while len(dc) > 1: 71 | iou = bbox_iou(dc[0], dc[1:]) 72 | if iou.max() > 0.5: 73 | det_max.append(dc[:1]) 74 | dc = dc[1:][iou < nms_thres] 75 | 76 | elif nms_style == 'MERGE': 77 | while len(dc): 78 | if len(dc) == 1: 79 | det_max.append(dc) 80 | break 81 | i = bbox_iou(dc[0], dc) > nms_thres 82 | weights = dc[i, 4:5] 83 | dc[0, :4] = (weights * dc[i, :4]).sum(0) / weights.sum() 84 | det_max.append(dc[:1]) 85 | dc = dc[i == 0] 86 | 87 | elif nms_style == 'SOFT': 88 | sigma = 0.5 89 | while len(dc): 90 | if len(dc) == 1: 91 | det_max.append(dc) 92 | break 93 | det_max.append(dc[:1]) 94 | iou = bbox_iou(dc[0], dc[1:]) 95 | dc = dc[1:] 96 | dc[:, 4] *= np.exp(-iou ** 2 / sigma) 97 | dc = dc[dc[:, 4] > nms_thres] 98 | 99 | if len(det_max): 100 | det_max = np.concatenate(det_max) 101 | output = det_max[(-det_max[:, 4]).argsort()] 102 | 103 | return output 104 | 105 | def clip_coords(boxes, img_shape): 106 | boxes[:, [0, 2]] = np.clip(boxes[:, [0, 2]], 0, img_shape[1]) 107 | boxes[:, [1, 3]] = np.clip(boxes[:, [1, 3]], 0, img_shape[0]) 108 | return boxes 109 | 110 | def scale_coords(img1_shape, coords, img0_shape): 111 | coords[:, [0, 2]] *= img1_shape[1] 112 | coords[:, [1, 3]] *= img1_shape[0] 113 | gain = max(img1_shape) / max(img0_shape) 114 | coords[:, [0, 2]] -= (img1_shape[1] - img0_shape[1] * gain) / 2 115 | coords[:, [1, 3]] -= (img1_shape[0] - img0_shape[0] * gain) / 2 116 | coords[:, :4] /= gain 117 | clip_coords(coords, img0_shape) 118 | return coords 119 | 120 | def _sigmoid(x): 121 | return 1. / (1. + np.exp(-x)) 122 | 123 | 124 | def decode_netout(netout, net_len, anchors, loc, class_score): 125 | netout = np.transpose(netout, [0, 2, 3, 1]) 126 | nb_box, grid_h, grid_w, = netout.shape[:3] 127 | netout[..., 4] = (netout[..., 4]) 128 | netout[..., 5:] = netout[..., 4][..., np.newaxis] * (netout[..., 5:]) 129 | for b in range(nb_box): 130 | for row in range(grid_h): 131 | for col in range(grid_w): 132 | classes = netout[b, row, col, 5:] 133 | if np.sum(classes) > 0.0: 134 | x, y, w, h = netout[b, row, col, :4] 135 | x = ((x) * 2 - 0.5 + col) / grid_w 136 | y = ((y) * 2 - 0.5 + row) / grid_h 137 | w = anchors[2 * b + 0] * (((w) * 2) ** 2) / net_len 138 | h = anchors[2 * b + 1] * (((h) * 2) ** 2) / net_len 139 | loc.append([x, y, w, h]) 140 | class_score.append(classes) -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/data/bus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/data/bus.jpg -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/data/bus_out.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/data/bus_out.jpg -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/examples/python_inference_on_PC/yolov5_image.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | import argparse 3 | import numpy as np 4 | import cv2 5 | from box_utils import non_max_suppression, scale_coords, decode_netout 6 | import onnxruntime as ort 7 | from numpy import random 8 | anchors = [[10,13, 16,30, 33,23], [30,61, 62,45, 59,119], [116,90, 156,198, 373,326]] 9 | 10 | def letterbox(img, new_shape, color, mode): 11 | shape = img.shape[:2] 12 | 13 | if isinstance(new_shape, int): 14 | ratio = float(new_shape) / max(shape) 15 | else: 16 | ratio = max(new_shape) / max(shape) 17 | ratiow, ratioh = ratio, ratio 18 | new_unpad = (int(round(shape[1] * ratio)), int(round(shape[0] * ratio))) 19 | 20 | 21 | if mode is 'auto': 22 | dw = np.mod(new_shape - new_unpad[0], 32) / 2 23 | dh = np.mod(new_shape - new_unpad[1], 32) / 2 24 | elif mode is 'square': 25 | dw = (new_shape - new_unpad[0]) / 2 26 | dh = (new_shape - new_unpad[1]) / 2 27 | elif mode is 'rect': 28 | dw = (new_shape[1] - new_unpad[0]) / 2 29 | dh = (new_shape[0] - new_unpad[1]) / 2 30 | elif mode is 'scaleFill': 31 | dw, dh = 0.0, 0.0 32 | new_unpad = (new_shape, new_shape) 33 | ratiow, ratioh = new_shape / shape[1], new_shape / shape[0] 34 | 35 | if shape[::-1] != new_unpad: 36 | img = cv2.resize(img, new_unpad, interpolation=cv2.INTER_AREA) # INTER_AREA is better, INTER_LINEAR is faster 37 | top, bottom = int(round(dh - 0.1)), int(round(dh + 0.1)) 38 | left, right = int(round(dw - 0.1)), int(round(dw + 0.1)) 39 | img = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color) # add border 40 | return img, ratiow, ratioh, dw, dh 41 | 42 | def find_object_in_image(img, od_input_name, od_output_name, od_ort_session): 43 | img, _, _, _, _ = letterbox(img, new_shape=320, color=(114, 114, 114), mode='square') 44 | img = img[:, :, ::-1].transpose(2, 0, 1) 45 | img = np.ascontiguousarray(img, dtype=np.float32) # uint8 to fp32 46 | img /= 255.0 # 0 - 255 to 0.0 - 1.0 47 | dst = od_ort_session.run(od_output_name, {od_input_name: np.expand_dims(img, 0)}) 48 | return dst 49 | 50 | parser = argparse.ArgumentParser(description='object detect') 51 | parser.add_argument('--image_path', default='./data/bus.jpg', help='input image path') 52 | parser.add_argument('--image_out_path', default='./data/bus_out.jpg', help='output image path') 53 | parser.add_argument('--onnx_path', default='../../models/onnx/yolov5s_320_sigmoid.onnx', help='onnx model path') 54 | parser.add_argument('--confidence_threshold', default=0.5, type=float, help='confidence_threshold') 55 | parser.add_argument('--nms_threshold', default=0.45, type=float, help='nms_threshold') 56 | args = parser.parse_args() 57 | 58 | if __name__ == '__main__': 59 | colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(80)] 60 | od_onnx_path = args.onnx_path 61 | # net and model 62 | od_ort_session = ort.InferenceSession(od_onnx_path) 63 | od_input_name = od_ort_session.get_inputs()[0].name 64 | od_output_name = [o.name for o in od_ort_session.get_outputs()] 65 | 66 | img_raw = cv2.imread(args.image_path) 67 | orig_image = img_raw.copy() 68 | dst = find_object_in_image(img_raw, od_input_name, od_output_name, od_ort_session) 69 | class_score = [] 70 | loc = [] 71 | for _i in range(3): 72 | decode_data = dst[_i][0] 73 | decode_netout(np.reshape(decode_data, [3, -1, dst[_i].shape[2], dst[_i].shape[3]]), 320, anchors[_i], loc, class_score) 74 | dets = non_max_suppression(np.array(class_score), np.array(loc), args.confidence_threshold, args.nms_threshold, 'OR') 75 | dets = scale_coords((320, 320), dets, img_raw.shape) 76 | for _i, b in enumerate(dets): 77 | b = list(map(int, b)) 78 | color = colors[int(b[5])] 79 | cv2.rectangle(orig_image, (b[0], b[1]), (b[2], b[3]), color, 2) 80 | cv2.imwrite(args.image_out_path, orig_image) 81 | 82 | -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/models/kmodel/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/utils/AI_Application/aidemo_sdk/models/kmodel/.gitkeep -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/models/onnx/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kendryte/k510_docs/eef103d58097e8b08bd38c393acf157799c4766d/zh/utils/AI_Application/aidemo_sdk/models/onnx/.gitkeep -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/scripts/gen_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import onnxsim 4 | import onnx 5 | import nncase 6 | import argparse 7 | 8 | def parse_model_input_output(model_file): 9 | onnx_model = onnx.load(model_file) 10 | input_all = [node.name for node in onnx_model.graph.input] 11 | input_initializer = [node.name for node in onnx_model.graph.initializer] 12 | input_names = list(set(input_all) - set(input_initializer)) 13 | input_tensors = [node for node in onnx_model.graph.input if node.name in input_names] 14 | 15 | # input 16 | inputs= [] 17 | for _, e in enumerate(input_tensors): 18 | onnx_type = e.type.tensor_type 19 | input_dict = {} 20 | input_dict['name'] = e.name 21 | input_dict['dtype'] = onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[onnx_type.elem_type] 22 | input_dict['shape'] = [(i.dim_value if i.dim_value != 0 else d) for i, d in zip( 23 | onnx_type.shape.dim, [1, 3, 320, 320])] 24 | inputs.append(input_dict) 25 | 26 | 27 | return onnx_model, inputs 28 | 29 | def onnx_simplify(model_file, dump_dir): 30 | onnx_model, inputs = parse_model_input_output(model_file) 31 | onnx_model = onnx.shape_inference.infer_shapes(onnx_model) 32 | input_shapes = {} 33 | for input in inputs: 34 | input_shapes[input['name']] = input['shape'] 35 | 36 | onnx_model, check = onnxsim.simplify(onnx_model, input_shapes=input_shapes) 37 | assert check, "Simplified ONNX model could not be validated" 38 | 39 | model_file = os.path.join(dump_dir, 'simplified.onnx') 40 | onnx.save_model(onnx_model, model_file) 41 | return model_file 42 | 43 | 44 | def read_model_file(model_file): 45 | with open(model_file, 'rb') as f: 46 | model_content = f.read() 47 | return model_content 48 | 49 | def main(): 50 | parser = argparse.ArgumentParser() 51 | parser.add_argument("--target", type=str, help='target to run') 52 | parser.add_argument("--dump_dir", type=str, help='temp folder to dump') 53 | parser.add_argument("--onnx", type=str, help='onnx model path') 54 | parser.add_argument("--kmodel", type=str, help='kendryte model path') 55 | args = parser.parse_args() 56 | 57 | dump_dir = args.dump_dir 58 | if not os.path.exists(dump_dir): 59 | os.makedirs(dump_dir) 60 | 61 | # onnx simplify 62 | model_file = onnx_simplify(args.onnx, dump_dir) 63 | 64 | # compile_options 65 | compile_options = nncase.CompileOptions() 66 | compile_options.target = args.target 67 | compile_options.input_type = 'uint8' 68 | compile_options.dump_ir = True 69 | compile_options.dump_asm = True 70 | compile_options.dump_dir = dump_dir 71 | compile_options.preprocess = True 72 | compile_options.input_layout = 'NCHW' 73 | compile_options.output_layout = 'NHWC' 74 | compile_options.input_shape = [1, 3, 320, 320] 75 | compile_options.mean = [0, 0, 0] 76 | compile_options.std = [255, 255, 255] 77 | compile_options.input_range = [0, 255] 78 | 79 | # compiler 80 | compiler = nncase.Compiler(compile_options) 81 | 82 | # import_options 83 | import_options = nncase.ImportOptions() 84 | 85 | # import 86 | model_content = read_model_file(model_file) 87 | compiler.import_onnx(model_content, import_options) 88 | 89 | # compile 90 | compiler.compile() 91 | 92 | # kmodel 93 | kmodel = compiler.gencode_tobytes() 94 | with open(args.kmodel, 'wb') as f: 95 | f.write(kmodel) 96 | 97 | if os.path.exists(dump_dir): 98 | shutil.rmtree(dump_dir) 99 | 100 | if __name__ == '__main__': 101 | main() 102 | 103 | -------------------------------------------------------------------------------- /zh/utils/AI_Application/aidemo_sdk/scripts/sim_yolov5s_320_with_sigmoid_bf16_with_preprocess_output_nhwc.py: -------------------------------------------------------------------------------- 1 | import os 2 | import copy 3 | import argparse 4 | import numpy as np 5 | import onnxruntime as ort 6 | import nncase 7 | 8 | def read_model_file(model_file): 9 | with open(model_file, 'rb') as f: 10 | model_content = f.read() 11 | return model_content 12 | 13 | def cosine(gt, pred): 14 | return (gt @ pred) / (np.linalg.norm(gt, 2) * np.linalg.norm(pred, 2)) 15 | 16 | def main(): 17 | parser = argparse.ArgumentParser() 18 | parser.add_argument("--onnx", type=str, help='original model file') 19 | parser.add_argument("--kmodel", type=str, help='kmodel file') 20 | args = parser.parse_args() 21 | 22 | # create simulator 23 | sim = nncase.Simulator() 24 | 25 | # read kmodel 26 | kmodel = read_model_file(args.kmodel) 27 | 28 | # load kmodel 29 | sim.load_model(kmodel) 30 | 31 | input_tensor=sim.get_input_tensor(0).to_numpy() 32 | input = np.random.randint(0, 256, input_tensor.shape, dtype=input_tensor.dtype) 33 | # cpu inference 34 | ort_session = ort.InferenceSession(args.onnx) 35 | input_name = ort_session.get_inputs()[0].name 36 | 37 | cpu_results = ort_session.run(None, {input_name : np.array(input / 255., 'float32')}) 38 | 39 | # set input for simulator 40 | sim.set_input_tensor(0, nncase.RuntimeTensor.from_numpy(input)) 41 | 42 | # simulator inference 43 | nncase_results = [] 44 | sim.run() 45 | for i in range(sim.outputs_size): 46 | nncase_result = sim.get_output_tensor(i).to_numpy() 47 | nncase_results.append(copy.deepcopy(nncase_result)) 48 | 49 | 50 | # compare 51 | for i in range(sim.outputs_size): 52 | cos = cosine(np.reshape(nncase_results[i], (-1)), np.reshape(np.transpose(np.reshape(cpu_results[i], (255, -1)), [1, 0]), (-1))) 53 | print('output {0} cosine similarity : {1}'.format(i, cos)) 54 | 55 | if __name__ == '__main__': 56 | main() 57 | --------------------------------------------------------------------------------