tensorflow模型安装与测试

一 tensorflow安装(安装过的跳过)
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ tensorflow==2.0.0b1

二 下载所需文件

	elephant-299.jpg 
	classify_image_graph_def-with_shapes.pb	imagenet_2012_challenge_label_map_proto.pbtxt 
	imagenet_synset_to_human_label_map.txt 
(下载网站:
https://github.com/dmlc/web-data/raw/main/tensorflow/models/InceptionV1/)

文件保存路径:elephant-299.jpg、 imagenet_2012_challenge_label_map_proto.pbtxt 、imagenet_synset_to_human_label_map.txt 保存在/home5/yunji.he/.tvm_test_data/data目录下。classify_image_graph_def-with_shapes.pb文件保存在/home5/yunji.he/.tvm_test_data/tf/InceptionV1

三 测试
(1)导入头文件

import tvm
from tvm import te
from tvm import relay

# os and numpy
import numpy as np
import os.path

# Tensorflow imports
import tensorflow as tf

try:
    tf_compat_v1 = tf.compat.v1
except ImportError:
    tf_compat_v1 = tf

# Tensorflow utility functions
import tvm.relay.testing.tf as tf_testing

# Base location for model related files.
repo_base = "https://github.com/dmlc/web-data/raw/main/tensorflow/models/InceptionV1/"

# Test image
img_name = "elephant-299.jpg"
image_url = os.path.join(repo_base, img_name)
(2)
model_name = "classify_image_graph_def-with_shapes.pb"
model_url = os.path.join(repo_base, model_name)

# Image label map
map_proto = "imagenet_2012_challe
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值