当前位置:网站首页>基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
2022-07-25 11:33:00 【InfoQ】
一、云服务器的使用
cd /home/
su - HwHiAiUser
二、基于咖啡 ResNet-50网络实现图片分类(仅推理)实验
1、下载样例代码
git clone https://gitee.com/ascend/samples.git
cd samples/
cd cplusplus/level2_simple_inference/1_classification/resnet50_imagenet_classification
2、获取ResNet-50预训练模型
mkdir caffe_model
cd caffe_model wegt https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/resnet50/resnet50.prototxt
wegt https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/resnet50/resnet50.caffemodel
3、模型转换
cd ../ atc --model=caffe_model/resnet50.prototxt --weight=caffe_model/resnet50.caffemodel --framework=0 --output=model/resnet50 --soc_version=Ascend310 --input_format=NCHW --input_fp16_nodes=data --output_type=FP32 --out_nodes=prob:0

4、下载测试图片
cd ../data/
wget https://c7xcode.obs.cn-north-4.myhuaweicloud.com/models/aclsample/dog1_1024_683.jpg
wget https://c7xcode.obs.cn-north-4.myhuaweicloud.com/models/aclsample/dog2_1024_683.jpg


5、图片格式转换
python3 ../script/transferPic.py
6、编译运行
cd ../复制 export DDK_PATH=$HOME/Ascend/ascend-toolkit/latest
export NPU_HOST_LIB=$DDK_PATH/acllib/lib64/stub
mkdir -p build/intermediates/host
cd build/intermediates/host
cmake ../../../src -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SKIP_RPATH=TRUE
make

cd ../../../out/
./main三、替换图片数据进行测试
1、添加图片并转换格式


python3 ../script/transferPic.py
2、修改sample_process.cpp源码,添加新增的两张图片的路径

3、重新编译源码

4、推理

边栏推荐
- 【6篇文章串讲ScalableGNN】围绕WWW 2022 best paper《PaSca》
- 氢能创业大赛 | 国家能源局科技司副司长刘亚芳:构建高质量创新体系是我国氢能产业发展的核心
- 协程
- keepalived实现mysql的高可用
- Start with the development of wechat official account
- Eureka registration center opens password authentication - record
- PHP one server sends pictures to another. Curl post file_ get_ Contents save pictures
- WPF项目入门1-简单登录页面的设计和开发
- Scott+scott law firm plans to file a class action against Yuga labs, or will confirm whether NFT is a securities product
- 【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)
猜你喜欢

OSPF comprehensive experiment

【微服务~Sentinel】Sentinel降级、限流、熔断

Start with the development of wechat official account

【GCN-RS】Towards Representation Alignment and Uniformity in Collaborative Filtering (KDD‘22)

防范SYN洪泛攻击的方法 -- SYN cookie
![[comparative learning] understanding the behavior of contractual loss (CVPR '21)](/img/96/9b58936365af0ca61aa7a8e97089fe.png)
[comparative learning] understanding the behavior of contractual loss (CVPR '21)

After having a meal with trump, I wrote this article

【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)
![[GCN multimodal RS] pre training representations of multi modal multi query e-commerce search KDD 2022](/img/9c/0434d40fa540078309249d415b3659.png)
[GCN multimodal RS] pre training representations of multi modal multi query e-commerce search KDD 2022
![[dark horse morning post] eBay announced its shutdown after 23 years of operation; Wei Lai throws an olive branch to Volkswagen CEO; Huawei's talented youth once gave up their annual salary of 3.6 mil](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] eBay announced its shutdown after 23 years of operation; Wei Lai throws an olive branch to Volkswagen CEO; Huawei's talented youth once gave up their annual salary of 3.6 mil
随机推荐
【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)
selenium使用———xpath和模拟输入和模拟点击协作
从云原生到智能化,深度解读行业首个「视频直播技术最佳实践图谱」
Median (two point answer + two point search)
Transformer变体(Routing Transformer,Linformer,Big Bird)
R语言ggplot2可视化:使用ggpubr包的ggstripchart函数可视化点状条带图、设置palette参数配置不同水平数据点的颜色、设置add参数在点状条带图中添加均值标准差竖线
【AI4Code】《Unified Pre-training for Program Understanding and Generation》 NAACL 2021
【RS采样】A Gain-Tuning Dynamic Negative Sampler for Recommendation (WWW 2022)
【黑马早报】运营23年,易趣网宣布关停;蔚来对大众CEO抛出橄榄枝;华为天才少年曾放弃360万年薪;尹烨回应饶毅炮轰其伪科学...
[untitled]
和特朗普吃了顿饭后写下了这篇文章
协程
Brpc source code analysis (I) -- the main process of RPC service addition and server startup
【多模态】《HiT: Hierarchical Transformer with Momentum Contrast for Video-Text Retrieval》ICCV 2021
Eureka使用记录
web编程(二)CGI相关
R语言使用wilcox.test函数执行wilcox符号秩检验获取总体中位数(median)的置信区间(默认输出结果包括95%置信水平的置信区间)
Mirror Grid
【GCN】《Adaptive Propagation Graph Convolutional Network》(TNNLS 2020)
Transformer variants (routing transformer, linformer, big bird)