English|[中文](README_CN.md)
**This sample provides reference for you to learn the Ascend AI Software Stack and cannot be used for commercial purposes.**
**This README file provides only guidance for running the sample in command line (CLI) mode. For details about how to run the sample in MindStudio, see [Running Image Samples in MindStudio](https://gitee.com/ascend/samples/wikis/Mindstudio%E8%BF%90%E8%A1%8C%E5%9B%BE%E7%89%87%E6%A0%B7%E4%BE%8B?sort_id=3164874).**
## GoogLeNet Image Classification Sample
Function: Use the GoogLeNet model to perform classification and inference on input images.
Input: source JPG image.
Output: JPG image after inference.
### Prerequisites
Check whether the following requirements are met. If not, perform operations according to the remarks. If the CANN version is upgraded, check whether the third-party dependencies need to be reinstalled. (The third-party dependencies for 5.0.4 and later versions are different from those for earlier versions.)
| Item| Requirement| Remarks|
|---|---|---|
| CANN version| ≥ 5.0.4| Install the CANN by referring to [Sample Deployment](https://gitee.com/ascend/samples#%E5%AE%89%E8%A3%85) in the *About Ascend Samples Repository*. If the CANN version is earlier than the required version, switch to the **samples** repository specific to the CANN version. See [Release Notes](https://gitee.com/ascend/samples/blob/master/README.md).|
| Hardware| Atlas 200 DK/Atlas 300 ([AI1s](https://support.huaweicloud.com/en-us/productdesc-ecs/ecs_01_0047.html#ecs_01_0047__section78423209366)) | Currently, the Atlas 200 DK and Atlas 300 have passed the test. For details about the product description, see [Hardware Platform](https://ascend.huawei.com/en/#/hardware/product). For other products, adaptation may be required.|
| Third-party dependency| ffmpeg, acllite| For details, see [Third-Party Dependency Installation Guide (C++ Sample)](../../../environment).|
### Sample Preparation
1. Obtain the source package.
You can download the source code in either of the following ways:
- Command line (The download takes a long time, but the procedure is simple.)
```
# In the development environment, run the following commands as a non-root user to download the source repository:
cd ${HOME}
git clone https://gitee.com/ascend/samples.git
```
**Note: To switch to another tag (for example, v0.5.0), run the following command:**
```
git checkout v0.5.0
```
- Compressed package (The download takes a short time, but the procedure is complex.)
**Note: If you want to download the code of another version, switch the branch of the samples repository according to the prerequisites.**
```
# 1. Click Clone or Download in the upper right corner of the samples repository and click Download ZIP.
# 2. Upload the .zip package to the home directory of a common user in the development environment, for example, ${HOME}/ascend-samples-master.zip.
# 3. In the development environment, run the following commands to unzip the package:
cd ${HOME}
unzip ascend-samples-master.zip
```
2. Convert the model.
| **Model** | **Description** | **How to Obtain** |
|---|---|---|
| GoogLeNet| Image classification inference model. It is a GoogLeNet model based on Caffe.| Download the model and weight file by referring to the links in **README.md** in the [ATC_googlenet_caffe_AE](https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/googlenet/ATC_googlenet_caffe_AE) directory of the ModelZoo repository.|
```
# To facilitate download, the commands for downloading the original model and converting the model are provided here. You can directly copy and run the commands. You can also refer to the above table to download the model from ModelZoo and manually convert it.
cd ${HOME}/samples/cplusplus/level2_simple_inference/1_classification/googlenet_imagenet_picture/model
wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/classification/googlenet.caffemodel
wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/classification/googlenet.prototxt
wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/models/googlenet_imagenet_picture/insert_op.cfg
atc --model="./googlenet.prototxt" --weight="./googlenet.caffemodel" --framework=0 --output="googlenet" --soc_version=Ascend310 --insert_op_conf=./insert_op.cfg --input_shape="data:1,3,224,224" --input_format=NCHW
```
### Sample Deployment
Run the following commands to execute the compilation script to start sample compilation:
```
cd ${HOME}/samples/cplusplus/level2_simple_inference/1_classification/googlenet_imagenet_picture/scripts
bash sample_build.sh
```
### Sample Running
**Note: If the development environment and operating environment are set up on the same server, skip step 1 and go to [step 2](#step_2) directly.**
1. Run the following commands to upload the **googlenet_imagenet_picture** directory in the development environment to any directory in the operating environment, for example, **/home/HwHiAiUser**, and log in to the operating environment (host) as the running user (**HwHiAiUser**):
```
# In the following information, xxx.xxx.xxx.xxx is the IP address of the operating environment. The IP address of Atlas 200 DK is 192.168.1.2 when it is connected over the USB port, and that of Atlas 300 (AI1s) is the corresponding public IP address.
scp -r ${HOME}/samples/cplusplus/level2_simple_inference/1_classification/googlenet_imagenet_picture HwHiAiUser@xxx.xxx.xxx.xxx:/home/HwHiAiUser
ssh HwHiAiUser@xxx.xxx.xxx.xxx
cd ${HOME}/googlenet_imagenet_picture/scripts
```
2. <a name="step_2"></a>Execute the script to run the sample.
```
bash sample_run.sh
```
### Result Viewing
After the running is complete, the inference result is displayed in the CLI of the operating environment, and the inferred image is generated in the **$HOME/googlenet_imagenet_picture/out/output** directory.
![输入图片说明](https://images.gitee.com/uploads/images/2021/1028/111540_cdbfc619_8083019.png "微信图片_20211028111126.png")
### Common Errors
For details about how to rectify the errors, see [Troubleshooting](https://gitee.com/ascend/samples/wikis/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E5%AE%9A%E4%BD%8D/%E4%BB%8B%E7%BB%8D). If an error is not included in Wiki, submit an issue to the **samples** repository.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
<项目介绍> 通过GFNET网络模型实现交通标志识别 googlenet_imagenet_picture文件夹中,为Atlas 200 DK开发的一个图片分类样例c++程序,源码链接: - 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
GFnet-TrafficSignRecognition-main.zip (21个子文件)
GFnet-TrafficSignRecognition-main
googlenet_imagenet_picture
README_CN.md 6KB
inc
image_net_classes.h 25KB
classify_process.h 2KB
CMakeLists.txt 233B
src
CMakeLists.txt 2KB
main.cpp 2KB
acl.json 3B
classify_process.cpp 6KB
data
.keep 0B
googlenet_imagenet_picture.iml 384B
model
.keep 0B
.project 155B
.build_project 161B
README.md 6KB
scripts
sample_build.sh 643B
sample_run.sh 376B
.idea
vcs.xml 167B
GFnet-TrafficSignRecognition.iml 336B
modules.xml 308B
.gitignore 176B
README.md 322B
共 21 条
- 1
资源评论
Android安卓科研室
- 粉丝: 1604
- 资源: 1185
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功