tensorflow实现车牌识别

学习1:中文车牌识别

学习2:国外车牌识别


知识点:

1、tf.greater(x, y, name=None)


Returns the truth value of (x > y) element-wise.

Args:

  • x: A Tensor. Must be one of the following types: float32float64int32int64.
  • y: A Tensor. Must have the same type as x.
  • name: A name for the operation (optional).
2、tf.ConfigProto()

一般用在创建session的时候,用来对session进行参数配置。

with tf.Session(config = tf.ConfigProto(...),...)
#tf.ConfigProto()的参数
log_device_placement=True : 是否打印设备分配日志
allow_soft_placement=True : 如果你指定的设备不存在,允许TF自动分配设备
tf.ConfigProto(log_device_placement=True,allow_soft_placement=True)

控制GPU资源使用率

#allow growth
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config, ...)
# 使用allow_growth option,刚一开始分配少量的GPU容量,然后按需慢慢的增加,由于不会释放
#内存,所以会导致碎片
# per_process_gpu_memory_fraction
gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
config=tf.ConfigProto(gpu_options=gpu_options)
session = tf.Session(config=config, ...)
#设置每个GPU应该拿出多少容量给进程使用,0.4代表 40%

控制使用哪块GPU

~/ CUDA_VISIBLE_DEVICES=0  python your.py#使用GPU0
~/ CUDA_VISIBLE_DEVICES=0,1 python your.py#使用GPU0,1
#或者在 程序开头
os.environ['CUDA_VISIBLE_DEVICES'] = '0' #使用 GPU 0
os.environ['CUDA_VISIBLE_DEVICES'] = '0,1' # 使用 GPU 0,1

Problems:
1. ValueError: Only callsoftmax_cross_entropy_with_logits with named arguments (labels=…, logits=…, …)
调用tf.nn.softmax_cross_entropy_with_logits(logits, tf_train_labels)出现上述错误。
解决办法:错误提示中已经给出,只能使用命名参数的方式来调用。调用函数改为:tf.nn.softmax_cross_entropy_with_logits(labels=logits, logits=tf_train_labels)即可。
2 .module ‘cv2’ has no attribute ‘CV_LOAD_IMAGE_GRAYSCALE’。Traceback (most recent call last): 
NameError: name ‘CV_LOAD_IMAGE_GRAYSCALE’ is not defined原来是 CV_LOAD_IMAGE_GRAYSCALE is from the outdated [and now removed] cv api

解决方法
cv2.IMREAD_GRAYSCALE
 
 
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

女王の专属领地

您的鼓励是我最大的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值