PaddleOCR常见问题(1)

报错图片数量太少

Exception: The number of the whole data (800) is smaller than the batch_size * devices_num * num_workers (2048)

----------------------
Error Message Summary:
----------------------
FatalError: Blocking queue is killed because the data reader raises an exception.
  [Hint: Expected killed_ != true, but received killed_:1 == true:1.] (at /paddle/paddle/fluid/operators/reader/blocking_queue.h:154)
  [operator < read > error]

搜索FatalError: Blocking queue is killed because the data reader raises an exception.发现报这个错的还不少。。。我的应该就是因为上面所说的 整体数据量太小了导致的,重新导一遍数据好了,多产一些,产2400张好了。

CPU_NUM设置问题

import ujson error: No module named 'ujson' use json
2020-09-29 06:24:37,367-INFO: places would be ommited when DataLoader is not iterable
2020-09-29 06:24:37,367-INFO: Distort operation can only support in GPU.Distort will be set to False.
2020-09-29 06:24:37,746-INFO: Loading parameters from ./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy...
// 加载预训练模型参数
2020-09-29 06:24:37,821-WARNING: variable ctc_fc_b_attr not used
2020-09-29 06:24:37,821-WARNING: variable ctc_fc_w_attr not used
2020-09-29 06:24:37,878-INFO: Finish initing model from ./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy
// 初始化模型完成
W0929 06:24:37.938328 116973 build_strategy.cc:170] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU.
!!! The CPU_NUM is not specified, you should set CPU_NUM in the environment variable list.
CPU_NUM indicates that how many CPUPlace are used in the current task.
And if this parameter are set as N (equal to the number of physical CPU core) the program may be faster.

export CPU_NUM=8 # for example, set CPU_NUM as number of physical CPU core which is 8.

!!! The default number of CPU_NUM=1.

根据github-issue_Add warning info If CPU_NUM is not set可知,使用之前需要设置一个 CPU_NUM系统变量。
但是这只是一个警告信息,其实不影响程序运行。。。
然后等了很久很久。。。。才出现第一行 训练结果:

2020-09-29 06:30:16,110-INFO: epoch: 1, iter: 10, lr: 0.000500, ‘loss’: 22621.375, ‘acc’: 0.0, time: 30.381

考虑改一下那个CPU_NUM吧,不然训练太慢了。。。

Linux查看物理CPU个数、核数、逻辑CPU个数
ubuntu环境变量的三种设置方法

# 查看物理CPU个数
[root@AAA ~]$ cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
1
#  查看每个物理CPU中core的个数(即核数)
[root@AAA ~]$ cat /proc/cpuinfo| grep "cpu cores"| uniq
8
# 查看逻辑CPU的个数
[root@AAA ~]$ cat /proc/cpuinfo| grep "processor"| wc -l
8
# 逻辑cpu个数=物理cpu个数*每个cpu中core的个数
(py37) root@XX:/home/XXX/paddleOCR/PaddleOCR$ cd
(py37) root@XX:~$ vim ~/etc/profile
(py37) root@XX:~$ cd ../
(py37) root@XX:/$ ls
bin  boot  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
(py37) root@XX:/$ vim etc/profile

$ vim /etc/profile
在里面加入:
export CPU_NUM=1
使生效
source profile
查看是否生效
echo $CPU_NUM

提示训练图片集不存在

在这里插入图片描述
解决方法:很容易发现是因为存放图片的文件夹名不一致,修改一下即可。
在这里插入图片描述
在这里插入图片描述

提示缺少yml参数文件

在这里插入图片描述
将缺少的文件夹复制到tools文件夹。

或者可以使用终端绝对路径直接调用

训练和评估的效果都特别好,预测的效果却特别差

这个是数据预处理的问题,paddleOCR官方给的推理程序里数据预处理的方式和训练程序里数据预处理的方式不完全一样,导致了训练时输入神经网络的张量维度和预测时输入神经网络的张量维度不一样,所以即使权重训练得很好,预测效果也会出现偏差。更改方式如下。
首先,要确保训练的配置文件里image_shape参数和推理的参数设置里rec_image_shape参数的值要是一样的,训练的配置文件在configs/rec里面,推理的参数设置在tools/infer/utility.py文件里面。

RuntimeError : ( PreconditionNotMet ) The third-party dynamic library(cublas64_102.dll;cublas64_10.d11)that Paddle deperon is not configured correctly(error code is 126)

只用cpu就没有这样的问题,这个问题是由于英伟达CUDA安装不正确导致的
解决方法:
它说缺cublas64_10.dll,我就在英伟达显卡加速包里找,发现这里有cublas64_100.dll,通过修改文件名去让其去被调用。

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值