首页 文章 精选 留言 我的

精选列表

搜索[快速],共10000篇文章
优秀的个人博客,低调大师

快速通过阿里云APP进行域名备案方法

阿里云APP备案方法如何通过阿里云APP进行域名备案? 1.准备备案材料(很多初次使用阿里云APP进行备案的同学会问备案需要准备哪些资料,不二版本下面就给大家一一列举出来) 个人备案需要材料: ⑴《用户网站备案授权书》(点开资料下载页面进行下载,下载后按要求填写然后拍照上传) ⑵网站负责人身份证(需要在阿里云app上面进行正反两面扫描上传) ⑶网站负责人联系方式以及紧急联系人联系方式(包括:手机、邮箱等) ⑷网站域名备案服务号(可在阿里云控制台主机界面申请) 注:资料下载地址:https://help.aliyun.com/knowledge_detail/36985.html(除湖北、甘肃、湖南、四川、上海、贵州、广西特别标注的地区需要特别下载特定的授权书外其它省份下载第一个就好) 个人备案操作流程: ⑴在电脑端登陆阿里云备案中心,进行开始备案操作; ⑵完成PC端的网站基本信息、验证基本信息操作; ⑶上传资料方式选择方法一:使用阿里云app上传备案资料; ⑷下载阿里云APP进行登陆操作,然后使用阿里云APP扫一扫当前页面二维码进入上传页面; ⑸按照操作提示依次上传备案资料; 注:备案资料提交完成后先需要等待阿里云备案专员电话通知审核,最后再是上报所属地区管局审核 阿里云APP可以进行域名备案后可以免去购买阿里云幕布、以及拍摄幕布+人像照片、还要邮寄备案《网站备案信息真实性核验单》这些繁琐的操作,现在幕布照片直接替换成拍摄活体照片(也就是网站负责人生活照)就可以了,一个APP就能搞定的事何必那么费劲呢? 企业网站备案所需资料: ⑴《单位网站备案承诺书》(下方提供单位网站备案承诺书填写范本以及下载地址) ⑵网站主体负责人身份证件以及网站负责人身份证件(需要在阿里云app上面进行正反两面扫描上传) ⑶网站负责人联系方式以及紧急联系人联系方式(包括:单位座机、手机、邮箱等) ⑷网站域名备案服务号(可在阿里云控制台主机界面申请) ⑸企业工商营业执照或者其它证明企业信息的文件 阿里云单位网站备案承诺书填写范本 企业网站备案操作流程: ⑴在电脑端登陆阿里云备案中心,进行开始备案操作; ⑵完成PC端的网站基本信息、验证基本信息操作; ⑶上传资料方式选择方法一:使用阿里云app上传备案资料; ⑷下载阿里云APP进行登陆操作,然后使用阿里云APP扫一扫当前页面二维码进入上传页面; ⑸按照操作提示依次上传备案资料; 企业网站在阿里云APP上备案的操作流程与个人网站备案的操作流程是一样的,只是企业网站备案需要准备的东西要多一些,所以网络公司帮助客户代备案阿里云网站的时候需要仔细看清楚需要的资料详情,好一次性就可以帮助客户完成网站的备案。 注:附上《单位网站备案承诺书》下载地址:https://beian.aliyun.com/order/downloadCommitment.do?baOrderId=25010351256 阿里云网站备案常见问题: 问:阿里云购买的域名都必须备案吗?阿里云域名不备案能用吗? 答: 非必须备案,能用,在阿里云旗下万网购买的域名不是强制性的要求备案而是根据工信部规定需要进行域名实名认证,备与不备全看个人; 问:为什么看到阿里云在备案里要求提交《网站建设方案书》? 答:目前只针对广东地区,前提是企业以及单位的同时备案网站超过31个,个人同时备案网站超过5个即需要提交《网站建设方案书》; 问:阿里云备案可以同时提交备案多个网站吗? 答:可以的,阿里云备案可以同时备案同一个主体下的多个网站; 问:一个阿里云主机最多可以申请多少个备案服务号? 答:同一个阿里云ECS主机最多可以申请5个备案服务号,备案主体可以不是同一个; 问:阿里云备案幕布用PS的能够通过管局审核吗? 答:不能,管局会有检测ps痕迹的措施,杜绝通过ps幕布申请; 问:二级域名需要单独进行备案吗? 答:只要是同一个备案主体,二级或二级以上域名,均不需要重新单独备案; 问:阿里云备案需要多久时间?域名备案多久能下来? 答:阿里云备案系统审核时间:3-7天,地方通信管理局审核时间:7-20天,整个备案下来大概在20天左右; 问:阿里云备案系统可以接入其它运营商的备案域名吗? 答:可以的,阿里云备案系统提供有接入备案; 文章来源:重庆seo转载请注明原文地址:https://www.panoeade.com/post/223.html

优秀的个人博客,低调大师

[官版翻译ing]OpenStack云计算快速入门之三:OpenStack镜像管理

第三部分OpenStack镜像管理 一、简介 很多源都有为OpenStack已经编译好的各种镜像了,您可以直接下载并通过使用这些镜像来熟悉OpenStack。 不过如果是为生产环境进行部署的话,您一定需要构建含有定制软件或配置的镜像文件。不要着急,本章将引领您完成几种较为流行的Linux发行版镜像,最后也将制作一份Windows的镜像。 由不同的Linux发行版制作镜像时,过程几乎一样,仅有微小的差别而已。由于含有cloud-ini软件包,人们用Ubuntu系统制作镜像文件变得非常容易。Cloud-init软件在实例运行时能够自动维护实例配置,也将为无密码登陆完成密匙导入以及完成设置主机名等任务。每个实例都将通过169.254.169.254的元数据接口,从nova运算中读取特定的配置。 如果您制作发行版不含有诸如cloud-init此类的软件包,您就需要自行完成密匙导入等操作了。说来也简单,只需向rc.local文件中添加相关命令即可。 如前所述,创建Linux不同发行版的过程除了几细微之处外,其余完全一致。不同点将在后文阐述。 本文所有的例子,都是在KVM基础上完成的。正像前两章说道的那样,现在我正在使用client1。 接下来的操作将制作很多镜像,这些镜像代表一个没有分区的硬盘。 二、创建Linux镜像 第一部,首先是在Client1上创建一块空镜像,这块镜像用作虚拟机的硬盘,所以请保证留出你所需的空间的大小: kvm-imgcreate-fqcow2server.img5G (一)安装准备 下载你所需的Linux发行版iso原镜像文件,比如您想安装Ubuntu,您可以使用wget或浏览器从网站“http://releases.ubuntu.com”获得iso文件。 将下载的iso文件置入虚拟机的CD-ROM后,启动KVM一个虚拟机实例。您将看到安装过程的开始。键入如下命令,它将在端口0开放VNC服务: sudokvm-m256-cdromubuntu-12.04-server-amd64.iso-drivefile=server.img,if=virtio,index=0-bootd-netnic-netuser-nographic-vnc:0 使用0这个展示端口连入虚拟机的VNC,并完成安装。 举例如下,client1的IP地址是10.10.10.4,则通过下列命令访问vnc: vncviewer10.10.10.4:0 注意,在制作Linux镜像过程中,请创建一个单独的ext4格式分区并将其挂在swap分区下。 安装结束后,通过执行下列命令重新载入虚拟机: sudokvm-m256-drivefile=server.img,if=virtio,index=0-bootc-netnic-netuser-nographic-vnc:0 此时,您可以在这个系统上安装定制的软件包,进行系统更新,添加用户或更改配置了。 (二)Ubuntu 执行以下命令: sudoapt-getupdate sudoapt-getupgrade sudoapt-getinstallopenssh-servercloud-init 清除/etc/udev/rules.d文件的网络设备命名规则,因为这些规则将从实例的网卡获得。 sudorm-rf/etc/udev/rules.d/70-persistent-net.rules (三)Fefora 运行如下命令: yumupdate yuminstallopenssh-server chkconfigsshdon 然后编辑/etc/sysconfig/network-scripts/ifcfg-eth0文件如下所示: DEVICE="eth0" BOOTPROTO=dhcp NM_CONTROLLED="yes" ONBOOT="yes" 清除/etc/udev/rules.d文件的网络设备命名规则,因为这些规则将从实例的网卡获得。 sudorm-rf/etc/udev/rules.d/70-persistent-net.rules 关闭虚拟机。 由于Fedora没有cloud-init或类似软件,您需要亲自进行几步配置使实例可以得到诸如sshkey这样的元数据。 编辑/etc/rc.local文件并且把以下内容粘贴到“touch/var/lock/subsys/local”行前: depmod-a modprobeacpiphp #simpleattempttogettheusersshkeyusingthemeta-dataservice mkdir-p/root/.ssh echo>>/root/.ssh/authorized_keys curl-m10-shttp://169.254.169.254/latest/meta-data/public-keys/0/openssh-key|grep'ssh-rsa'>>/root/.ssh/authorized_keys echo"AUTHORIZED_KEYS:" echo"************************" cat/root/.ssh/authorized_keys echo"************************" (四)OpenSUSE 选择ssh服务,curl以及其他需要的包。 安装ssh服务器: zypperinstallopenssh 安装crul: zypperinstallcurl 使用如下步骤将SshKey注入实例中: 首先,创建文件/etc/init.d/sshkey并且写入下列内容: echo>>/root/.ssh/authorized_keys curl-m10-shttp://169.254.169.254/latest/meta-data/public-keys/0/openssh-key|grep'ssh-rsa'>>/root/.ssh/authorized_keys echo"AUTHORIZED_KEYS:" echo"************************" cat/root/.ssh/authorized_keys echo"************************" 然后,为该文件设置权限: chmod755/etc/init.d/sshkey 将sshkey服务设置为开机自动启动: chkconfigsshkeyon 使用下列命令设置防火墙(而非iptables),令其允许ssh服务: yast2 最后同样地,清除/etc/udev/rules.d文件的网络设备命名规则,因为这些规则将从实例的网卡获得。 sudorm-rf/etc/udev/rules.d/70-persistent-net.rules (五)Debian 安装时选择SSH服务器,Curl及相关软件。 然后进行必要的设置,为key注入而编辑/etc/rc.local文件并增加如下内容: echo>>/root/.ssh/authorized_keys curl-m10-shttp://169.254.169.254/latest/meta-data/public-keys/0/openssh-key|grep'ssh-rsa'>>/root/.ssh/authorized_keys echo"AUTHORIZED_KEYS:" echo"************************" cat/root/.ssh/authorized_keys echo"************************" 同样地,清除/etc/udev/rules.d文件的网络设备命名规则,因为这些规则将从实例的网卡获得。 sudorm-rf/etc/udev/rules.d/70-persistent-net.rules (六)CentOS6及RHEL6 安装时选择SSH服务器,Curl及相关软件。 然后进行必要的设置,为key注入而编辑/etc/rc.local文件并增加如下内容: echo>>/root/.ssh/authorized_keys curl-m10-shttp://169.254.169.254/latest/meta-data/public-keys/0/openssh-key|grep'ssh-rsa'>>/root/.ssh/authorized_keys echo"AUTHORIZED_KEYS:" echo"************************" cat/root/.ssh/authorized_keys echo"************************" 编辑/etc/sysconfig/network-scripts/ifcfg-eth0文件如下所示: DEVICE="eth0" BOOTPROTO=dhcp NM_CONTROLLED="yes" ONBOOT="yes" 同样地,清除/etc/udev/rules.d文件的网络设备命名规则,因为这些规则将从实例的网卡获得。 sudorm-rf/etc/udev/rules.d/70-persistent-net.rules (七)上传Linux镜像 使用如下命令上传镜像: glanceaddname=""is_public=truecontainer_format=ovfdisk_format=qcow2.img 三、创建Windows镜像 第一步,仍然是在Client1上创建一块空镜像,这块镜像用作虚拟机的硬盘,所以请保证留出你所需的空间的大小: kvm-imgcreate-fqcow2windowsserver.img20G (一)安装操作系统 当实例运行时,OpenStack利用virtio接口来使用镜像,于是镜像中的操作系统需要装有virtio驱动。不巧的是,默认WindowsServer2008是没有virtio驱动的。您可以在如下网址:http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin下载装有该驱动的iso镜像并使用该镜像进行安装。 译者注1:Virtio是半虚拟化hypervisor中位于设备之上的抽象层。virtio由RustyRussell开发,virtio是对半虚拟化hypervisor中的一组通用模拟设备的抽象。该设置还允许hypervisor导出一组通用的模拟设备,并通过一个通用的应用编程接口(API)让它们变得可用。[来源:开源中国http://www.oschina.net/p/virtio] 译者注2:该链接的virtio-win是0.1-22版,不能用。下载用1.1.16新版即可。 执行此命令开始安装: sudokvm-m1024-cdromwindows2008.iso-drivefile=windowsserver1.img,if=virtio-bootd-drivefile=virtio-win-0.1-22.iso,index=3,media=cdrom-devicevirtio-net-pci-netnic-netuser-nographic-vnc:5 当安装提示您选择一块硬盘设备步骤时,您并不能看到当前有可用设备。点击左下方的“载入设备(Loaddrivers)”按钮,选择第二CDROM后,含有virtio驱动的硬盘便被加载了。 在安装结束之前,您需要重启系统一次,此时您可以安装其它您所需的软件或执行任何需要的配置更改。除此之外,请务必开放实例中的远程桌面,因为远程桌面将是您连接并使用该实例的唯一途径。同时,Windows防火墙应该相应地设置为对ICMP和RDP开放。 (二)上传Windows镜像 关闭虚拟机并将该镜像使用如下命令上传至OpenStack中: glanceaddname="windows"is_public=truecontainer_format=ovfdisk_format=qcow2 ************************ 第三章,完结[2012-07-12 20:43:00]********************* 五岳之巅原创,如有转载,必须注明出处,否则追究。

优秀的个人博客,低调大师

快速识别你家的猫猫狗狗,教你用ModelBox开发AI萌宠应用

本文分享自华为云社区《ModelBox-AI应用开发:动物目标检测【玩转华为云】》,作者:阳光大猫。 一、准备环境 ModelBox端云协同AI开发套件(Windows)环境准备【视频教程】 二、应用开发 1. 创建工程 在ModelBoxsdk目录下使用create.bat创建yolov7_pet工程 (tensorflow) PS D:\modelbox-win10-x64-1.5.3> .\create.bat -t server -n yolov7_pet (tensorflow) D:\modelbox-win10-x64-1.5.3>set BASE_PATH=D:\modelbox-win10-x64-1.5.3\ (tensorflow) D:\modelbox-win10-x64-1.5.3>set PATH=D:\modelbox-win10-x64-1.5.3\\python-embed;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3\envs\tensorflow;C:\Users\yanso\miniconda3\envs\tensorflow\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\usr\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Scripts;C:\Users\yanso\miniconda3\envs\tensorflow\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\Library\usr\bin;C:\Users\yanso\miniconda3\Library\bin;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin (tensorflow) D:\modelbox-win10-x64-1.5.3>set PYTHONPATH= (tensorflow) D:\modelbox-win10-x64-1.5.3>set PYTHONHOME= (tensorflow) D:\modelbox-win10-x64-1.5.3>python.exe -u D:\modelbox-win10-x64-1.5.3\\create.py -t server -n yolov7_pet sdk version is modelbox-win10-x64-1.5.3 dos2unix: converting file D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet/graph\modelbox.conf to Unix format... dos2unix: converting file D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet/graph\yolov7_pet.toml to Unix format... dos2unix: converting file D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet/bin\mock_task.toml to Unix format... success: create yolov7_pet in D:\modelbox-win10-x64-1.5.3\workspace create.bat工具的参数中,-t表示所创建实例的类型,包括server(ModelBox工程)、python(Python功能单元)、c++(C++功能单元)、infer(推理功能单元)等;-n表示所创建实例的名称,开发者自行命名。 2. 创建推理功能单元 在ModelBoxsdk目录下使用create.bat创建yolov7_infer推理功能单元 (tensorflow) PS D:\modelbox-win10-x64-1.5.3> .\create.bat -t infer -n yolov7_infer -p yolov7_pet (tensorflow) D:\modelbox-win10-x64-1.5.3>set BASE_PATH=D:\modelbox-win10-x64-1.5.3\ (tensorflow) D:\modelbox-win10-x64-1.5.3>set PATH=D:\modelbox-win10-x64-1.5.3\\python-embed;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3\envs\tensorflow;C:\Users\yanso\miniconda3\envs\tensorflow\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\usr\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Scripts;C:\Users\yanso\miniconda3\envs\tensorflow\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\Library\usr\bin;C:\Users\yanso\miniconda3\Library\bin;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin (tensorflow) D:\modelbox-win10-x64-1.5.3>set PYTHONPATH= (tensorflow) D:\modelbox-win10-x64-1.5.3>set PYTHONHOME= (tensorflow) D:\modelbox-win10-x64-1.5.3>python.exe -u D:\modelbox-win10-x64-1.5.3\\create.py -t infer -n yolov7_infer -p yolov7_pet sdk version is modelbox-win10-x64-1.5.3 success: create infer yolov7_infer in D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet/model/yolov7_infer create.bat工具使用时,-t infer即表示创建的是推理功能单元;-n xxx_infer表示创建的功能单元名称为xxx_infer;-p yolov7_infer表示所创建的功能单元属于yolov7_infer应用。 a. 下载转换好的模型 运行此Notebook下载转换好的ONNX格式模型 b. 修改模型配置文件 模型和配置文件保持在同级目录下 # Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. [base] name = "yolov7_infer" device = "cpu" version = "1.0.0" description = "your description" entry = "./best.onnx" # model file path, use relative path type = "inference" virtual_type = "onnx" # inference engine type: win10 now only support onnx group_type = "Inference" # flowunit group attribution, do not change # Input ports description [input] [input.input1] # input port number, Format is input.input[N] name = "Input" # input port name type = "float" # input port data type ,e.g. float or uint8 device = "cpu" # input buffer type: cpu, win10 now copy input from cpu # Output ports description [output] [output.output1] # output port number, Format is output.output[N] name = "Output" # output port name type = "float" # output port data type ,e.g. float or uint8 3. 创建后处理功能单元 在ModelBoxsdk目录下使用create.bat创建yolov7_post后处理功能单元 (tensorflow) PS D:\modelbox-win10-x64-1.5.3> .\create.bat -t python -n yolov7_post -p yolov7_pet (tensorflow) D:\modelbox-win10-x64-1.5.3>set BASE_PATH=D:\modelbox-win10-x64-1.5.3\ (tensorflow) D:\modelbox-win10-x64-1.5.3>set PATH=D:\modelbox-win10-x64-1.5.3\\python-embed;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3\envs\tensorflow;C:\Users\yanso\miniconda3\envs\tensorflow\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\usr\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Scripts;C:\Users\yanso\miniconda3\envs\tensorflow\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\Library\usr\bin;C:\Users\yanso\miniconda3\Library\bin;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin (tensorflow) D:\modelbox-win10-x64-1.5.3>set PYTHONPATH= (tensorflow) D:\modelbox-win10-x64-1.5.3>set PYTHONHOME= (tensorflow) D:\modelbox-win10-x64-1.5.3>python.exe -u D:\modelbox-win10-x64-1.5.3\\create.py -t python -n yolov7_post -p yolov7_pet sdk version is modelbox-win10-x64-1.5.3 success: create python yolov7_post in D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet/etc/flowunit/yolov7_post a. 修改配置文件 # Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved. # Basic config [base] name = "yolov7_post" # The FlowUnit name device = "cpu" # The flowunit runs on cpu version = "1.0.0" # The version of the flowunit type = "python" # Fixed value, do not change description = "description" # The description of the flowunit entry = "yolov7_post@yolov7_postFlowUnit" # Python flowunit entry function group_type = "Generic" # flowunit group attribution, change as Input/Output/Image/Generic ... # Flowunit Type stream = false # Whether the flowunit is a stream flowunit condition = false # Whether the flowunit is a condition flowunit collapse = false # Whether the flowunit is a collapse flowunit collapse_all = false # Whether the flowunit will collapse all the data expand = false # Whether the flowunit is a expand flowunit # The default Flowunit config [config] net_h = 640 net_w = 640 num_classes = 2 conf_threshold = 0.5 iou_threshold = 0.45 # Input ports description [input] [input.input1] # Input port number, the format is input.input[N] name = "in_feat" # Input port name type = "float" # Input port type # Output ports description [output] [output.output1] # Output port number, the format is output.output[N] name = "out_data" # Output port name type = "string" # Output port type b. 修改逻辑代码 # Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved. #!/usr/bin/env python # -*- coding: utf-8 -*- import _flowunit as modelbox import numpy as np import json import cv2 class yolov7_postFlowUnit(modelbox.FlowUnit): # Derived from modelbox.FlowUnit def __init__(self): super().__init__() # Open the flowunit to obtain configuration information def open(self, config): # 获取功能单元的配置参数 self.params = {} self.params['net_h'] = config.get_int('net_h') self.params['net_w'] = config.get_int('net_w') self.params['num_classes'] = config.get_int('num_classes') self.params['conf_thre'] = config.get_float('conf_threshold') self.params['nms_thre'] = config.get_float('iou_threshold') self.num_classes = config.get_int('num_classes') return modelbox.Status.StatusCode.STATUS_SUCCESS # Process the data def process(self, data_context): # 从DataContext中获取输入输出BufferList对象 in_feat = data_context.input("in_feat") out_data = data_context.output("out_data") # yolov7_post process code. # 循环处理每一个输入Buffer数据 for buffer_feat in in_feat: # 将输入Buffer转换为numpy对象 feat_data = np.array(buffer_feat.as_object(), copy=False) feat_data = feat_data.reshape((-1, self.num_classes + 5)) # 业务处理:解码yolov7模型的输出数据,得到检测框,转化为json数据 bboxes = self.postprocess(feat_data, self.params) result = {"det_result": str(bboxes)} print(result) # 将业务处理返回的结果数据转换为Buffer result_str = json.dumps(result) out_buffer = modelbox.Buffer(self.get_bind_device(), result_str) # 将输出Buffer放入输出BufferList中 out_data.push_back(out_buffer) return modelbox.Status.StatusCode.STATUS_SUCCESS # model post-processing function def postprocess(self, feat_data, params): """postprocess for yolo7 model""" boxes = [] class_ids = [] confidences = [] for detection in feat_data: scores = detection[5:] class_id = np.argmax(scores) if params['num_classes'] == 1: confidence = detection[4] else: confidence = detection[4] * scores[class_id] if confidence > params['conf_thre'] and detection[4] > params['conf_thre']: center_x = detection[0] / params['net_w'] center_y = detection[1] / params['net_h'] width = detection[2] / params['net_w'] height = detection[3] / params['net_h'] left = center_x - width / 2 top = center_y - height / 2 class_ids.append(class_id) confidences.append(confidence) boxes.append([left, top, width, height]) # use nms algorithm in opencv box_idx = cv2.dnn.NMSBoxes( boxes, confidences, params['conf_thre'], params['nms_thre']) detections = [] for i in box_idx: boxes[i][0] = max(0.0, boxes[i][0]) # [0, 1] boxes[i][1] = max(0.0, boxes[i][1]) # [0, 1] boxes[i][2] = min(1.0, boxes[i][0] + boxes[i][2]) # [0, 1] boxes[i][3] = min(1.0, boxes[i][1] + boxes[i][3]) # [0, 1] dets = np.concatenate( [boxes[i], np.array([confidences[i]]), np.array([class_ids[i]])], 0).tolist() detections.append(dets) return detections def close(self): # Close the flowunit return modelbox.Status() def data_pre(self, data_context): # Before streaming data starts return modelbox.Status() def data_post(self, data_context): # After streaming data ends return modelbox.Status() def data_group_pre(self, data_context): # Before all streaming data starts return modelbox.Status() def data_group_post(self, data_context): # After all streaming data ends return modelbox.Status() 4. 修改流程图 yolov7_pet工程graph目录下存放流程图,默认的流程图yolov7_pet.toml与工程同名,其内容为(以Windows版ModelBox为例): # Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. [driver] dir = ["${HILENS_APP_ROOT}/etc/flowunit", "${HILENS_APP_ROOT}/etc/flowunit/cpp", "${HILENS_APP_ROOT}/model", "${HILENS_MB_SDK_PATH}/flowunit"] skip-default = true [profile] profile=false trace=false dir="${HILENS_DATA_DIR}/mb_profile" [graph] format = "graphviz" graphconf = """digraph yolov7_pet { node [shape=Mrecord] queue_size = 4 batch_size = 1 input1[type=input,flowunit=input,device=cpu,deviceid=0] httpserver_sync_receive[type=flowunit, flowunit=httpserver_sync_receive_v2, device=cpu, deviceid=0, time_out_ms=5000, endpoint="http://0.0.0.0:8083/v1/yolov7_pet", max_requests=100] image_decoder[type=flowunit, flowunit=image_decoder, device=cpu, key="image_base64", queue_size=4] image_resize[type=flowunit, flowunit=resize, device=cpu, deviceid=0, image_width=640, image_height=640] image_transpose[type=flowunit, flowunit=packed_planar_transpose, device=cpu, deviceid=0] normalize[type=flowunit flowunit=normalize device=cpu deviceid=0 standard_deviation_inverse="0.0039215686,0.0039215686,0.0039215686"] yolov7_infer[type=flowunit, flowunit=yolov7_infer, device=cpu, deviceid=0, batch_size = 1] yolov7_post[type=flowunit, flowunit=yolov7_post, device=cpu, deviceid=0] httpserver_sync_reply[type=flowunit, flowunit=httpserver_sync_reply_v2, device=cpu, deviceid=0] input1:input -> httpserver_sync_receive:in_url httpserver_sync_receive:out_request_info -> image_decoder:in_encoded_image image_decoder:out_image -> image_resize:in_image image_resize:out_image -> image_transpose:in_image image_transpose:out_image -> normalize:in_data normalize:out_data -> yolov7_infer:Input yolov7_infer:Output -> yolov7_post:in_feat yolov7_post:out_data -> httpserver_sync_reply:in_reply_info }""" [flow] desc = "yolov7_pet run in modelbox-win10-x64" 5. 准备动物图片和测试脚本 a. 动物图片 yolov7_pet工程data目录下存放动物图片文件夹test_imgs b. 测试脚本 yolov7_pet工程data目录下存放测试脚本test_http.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved. import os import cv2 import json import base64 import http.client class HttpConfig: '''http调用的参数配置''' def __init__(self, host_ip, port, url, img_base64_str): self.hostIP = host_ip self.Port = port self.httpMethod = "POST" self.requstURL = url self.headerdata = { "Content-Type": "application/json" } self.test_data = { "image_base64": img_base64_str } self.body = json.dumps(self.test_data) def read_image(img_path): '''读取图片数据并转为base64编码的字符串''' img_data = cv2.imread(img_path) img_str = cv2.imencode('.jpg', img_data)[1].tostring() img_bin = base64.b64encode(img_str) img_base64_str = str(img_bin, encoding='utf8') return img_data, img_base64_str def decode_car_bboxes(bbox_str, input_shape): try: labels = [0, 1] # cat, dog bboxes = json.loads(json.loads(bbox_str)['det_result']) bboxes = list(filter(lambda x: int(x[5]) in labels, bboxes)) except Exception as ex: print(str(ex)) return [] else: for bbox in bboxes: bbox[0] = int(bbox[0] * input_shape[1]) bbox[1] = int(bbox[1] * input_shape[0]) bbox[2] = int(bbox[2] * input_shape[1]) bbox[3] = int(bbox[3] * input_shape[0]) return bboxes def draw_bboxes(img_data, bboxes): '''画框''' for bbox in bboxes: x1, y1, x2, y2, score, label = bbox color = (0, 0, 255) names = ['cat', 'dog'] score = '%.2f' % score label = '%s:%s' % (names[int(label)], score) cv2.rectangle(img_data, (x1, y1), (x2, y2), color, 2) cv2.putText(img_data, label, (x1, y1 - 10), cv2.FONT_HERSHEY_TRIPLEX, 0.5, (0, 255, 0), thickness=1) return img_data def test_image(img_path, ip, port, url): '''单张图片测试''' img_data, img_base64_str = read_image(img_path) http_config = HttpConfig(ip, port, url, img_base64_str) conn = http.client.HTTPConnection(host=http_config.hostIP, port=http_config.Port) conn.request(method=http_config.httpMethod, url=http_config.requstURL, body=http_config.body, headers=http_config.headerdata) response = conn.getresponse().read().decode() print('response: ', response) bboxes = decode_car_bboxes(response, img_data.shape) imt_out = draw_bboxes(img_data, bboxes) cv2.imwrite('./result-' + os.path.basename(img_path), imt_out) if __name__ == "__main__": port = 8083 ip = "127.0.0.1" url = "/v1/yolov7_pet" img_path = "./test.jpg" img_folder = './test_imgs' file_list = os.listdir(img_folder) for img_file in file_list: print("\n================ {} ================".format(img_file)) img_path = os.path.join(img_folder, img_file) test_image(img_path, ip, port, url) 三、运行应用 在yolov7_pet工程目录下执行.\bin\main.bat运行应用: (tensorflow) PS D:\modelbox-win10-x64-1.5.3> cd D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet (tensorflow) PS D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet> .\bin\main.bat (tensorflow) D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet>set PATH=D:/modelbox-win10-x64-1.5.3/workspace/yolov7_pet/bin/../../../python-embed;D:/modelbox-win10-x64-1.5.3/workspace/yolov7_pet/bin/../../../modelbox-win10-x64/bin;D:/modelbox-win10-x64-1.5.3/workspace/yolov7_pet/bin/../dependence/lib;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3\envs\tensorflow;C:\Users\yanso\miniconda3\envs\tensorflow\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\usr\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Library\bin;C:\Users\yanso\miniconda3\envs\tensorflow\Scripts;C:\Users\yanso\miniconda3\envs\tensorflow\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\yanso\miniconda3\envs\tensorflow\lib\site-packages\pywin32_system32;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Library\mingw-w64\bin;C:\Users\yanso\miniconda3\Library\usr\bin;C:\Users\yanso\miniconda3\Library\bin;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\bin;C:\Users\yanso\miniconda3\condabin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin;C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\yanso\miniconda3;C:\Users\yanso\miniconda3\Scripts;C:\Users\yanso\miniconda3\Library\bin;.;C:\Program Files\Git LFS;C:\Users\yanso\AppData\Local\Microsoft\WindowsApps;.;C:\Users\yanso\AppData\Local\Programs\Microsoft VS Code\bin (tensorflow) D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet>modelbox.exe -c D:/modelbox-win10-x64-1.5.3/workspace/yolov7_pet/bin/../graph/modelbox.conf [2024-06-10 06:42:50,922][ WARN][ iva_config.cc:143 ] update vas url failed. Fault, no vas projectid or iva endpoint open log file D:/modelbox-win10-x64-1.5.3/workspace/yolov7_pet/bin/../hilens_data_dir/log/modelbox.log failed, No error input dims is:1,3,640,640, output dims is:1,25200,7, HTTP服务启动后可以在另一个终端进行请求测试,进入yolov7_pet工程目录data文件夹中使用test_http.py脚本发起HTTP请求进行测试: (tensorflow) PS D:\modelbox-win10-x64-1.5.3> cd D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet\data (tensorflow) PS D:\modelbox-win10-x64-1.5.3\workspace\yolov7_pet\data> python .\test_http.py ================ Abyssinian_1.jpg ================ .\test_http.py:33: DeprecationWarning: tostring() is deprecated. Use tobytes() instead. img_str = cv2.imencode('.jpg', img_data)[1].tostring() response: {"det_result": "[[0.554308044910431, 0.1864600658416748, 0.7089953303337098, 0.3776256084442139, 0.82369065284729, 0.0]]"} ================ saint_bernard_143.jpg ================ response: {"det_result": "[[0.46182055473327643, 0.30239262580871584, 0.8193012714385988, 0.4969032764434815, 0.7603430151939392, 1.0]]"} 四、小结 本章我们介绍了如何使用ModelBox开发一个动物目标检测的AI应用,我们只需要准备模型文件以及简单的配置即可创建一个HTTP服务。同时我们可以了解到图片标注、数据处理和模型训练方法,以及对应的推理应用逻辑。 点击关注,第一时间了解华为云新鲜技术~

资源下载

更多资源
Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册