当前位置:网站首页>基于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、推理

边栏推荐
- Zero shot image retrieval (zero sample cross modal retrieval)
- Video caption (cross modal video summary / subtitle generation)
- Mirror Grid
- 那些离开网易的年轻人
- PHP curl post length required error setting header header
- Unexpected rollback exception analysis and transaction propagation strategy for nested transactions
- 【6篇文章串讲ScalableGNN】围绕WWW 2022 best paper《PaSca》
- 面试官:“同学,你做过真实落地项目吗?”
- 【黑马早报】运营23年,易趣网宣布关停;蔚来对大众CEO抛出橄榄枝;华为天才少年曾放弃360万年薪;尹烨回应饶毅炮轰其伪科学...
- 利用wireshark对TCP抓包分析
猜你喜欢

利用wireshark对TCP抓包分析

919. 完全二叉树插入器 : 简单 BFS 运用题

2.1.2 机器学习的应用

【GCN多模态RS】《Pre-training Representations of Multi-modal Multi-query E-commerce Search》 KDD 2022

【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)

记录一次线上死锁的定位分析

【AI4Code】《Unified Pre-training for Program Understanding and Generation》 NAACL 2021

【Debias】Model-Agnostic Counterfactual Reasoning for Eliminating Popularity Bias in RS(KDD‘21)

Video caption (cross modal video summary / subtitle generation)

面试官:“同学,你做过真实落地项目吗?”
随机推荐
水博士2
aaaaaaaaaaA heH heH nuN
Brpc source code analysis (I) -- the main process of RPC service addition and server startup
[high concurrency] Why is the simpledateformat class thread safe? (six solutions are attached, which are recommended for collection)
Hystrix使用
Location analysis of recording an online deadlock
搭建Vision Transformer系列实践,终于见面了,Timm库!
Scott+Scott律所计划对Yuga Labs提起集体诉讼,或将确认NFT是否属于证券产品
【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)
scrapy爬虫爬取动态网站
[comparative learning] understanding the behavior of contractual loss (CVPR '21)
R language uses the ggarrange function of ggpubr package to combine multiple images, and uses the ggexport function to save the visual images in JPEG format (width parameter specifies width, height pa
Feign使用
【微服务~Sentinel】Sentinel降级、限流、熔断
如何从远程访问 DMS数据库?IP地址是啥?用户名是啥?
919. 完全二叉树插入器 : 简单 BFS 运用题
客户端开放下载, 欢迎尝鲜
Resttemplate and ribbon are easy to use
Median (二分答案 + 二分查找)
【AI4Code最终章】AlphaCode:《Competition-Level Code Generation with AlphaCode》(DeepMind)