[图文直播]使用EasyOCR识别图片上的文字

news/2024/11/13 8:51:37/文章来源:https://www.cnblogs.com/dizhilang/p/18355931

安装EasyOCR

C:\Users\Administrator>pip install easyocr
Collecting easyocrDownloading easyocr-1.7.1-py3-none-any.whl.metadata (11 kB)
Collecting torch (from easyocr)Downloading torch-2.4.0-cp312-cp312-win_amd64.whl.metadata (27 kB)
Collecting torchvision>=0.5 (from easyocr)Downloading torchvision-0.19.0-1-cp312-cp312-win_amd64.whl.metadata (6.1 kB)
Collecting opencv-python-headless (from easyocr)Downloading opencv_python_headless-4.10.0.84-cp37-abi3-win_amd64.whl.metadata (20 kB)
Collecting scipy (from easyocr)Downloading scipy-1.14.0-cp312-cp312-win_amd64.whl.metadata (60 kB)---------------------------------------- 60.8/60.8 kB 1.6 MB/s eta 0:00:00
Collecting numpy (from easyocr)Downloading numpy-2.0.1-cp312-cp312-win_amd64.whl.metadata (60 kB)---------------------------------------- 60.9/60.9 kB 817.1 kB/s eta 0:00:00
Collecting Pillow (from easyocr)Downloading pillow-10.4.0-cp312-cp312-win_amd64.whl.metadata (9.3 kB)
Collecting scikit-image (from easyocr)Downloading scikit_image-0.24.0-cp312-cp312-win_amd64.whl.metadata (14 kB)
Collecting python-bidi (from easyocr)Downloading python_bidi-0.6.0-cp312-none-win_amd64.whl.metadata (4.7 kB)
Collecting PyYAML (from easyocr)Downloading PyYAML-6.0.2-cp312-cp312-win_amd64.whl.metadata (2.1 kB)
Collecting Shapely (from easyocr)Downloading shapely-2.0.5-cp312-cp312-win_amd64.whl.metadata (7.2 kB)
Collecting pyclipper (from easyocr)Downloading pyclipper-1.3.0.post5-cp312-cp312-win_amd64.whl.metadata (9.2 kB)
Collecting ninja (from easyocr)Downloading ninja-1.11.1.1-py2.py3-none-win_amd64.whl.metadata (5.4 kB)
Collecting numpy (from easyocr)Downloading numpy-1.26.4-cp312-cp312-win_amd64.whl.metadata (61 kB)---------------------------------------- 61.0/61.0 kB 651.3 kB/s eta 0:00:00
Collecting filelock (from torch->easyocr)Downloading filelock-3.15.4-py3-none-any.whl.metadata (2.9 kB)
Collecting typing-extensions>=4.8.0 (from torch->easyocr)Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting sympy (from torch->easyocr)Downloading sympy-1.13.2-py3-none-any.whl.metadata (12 kB)
Collecting networkx (from torch->easyocr)Downloading networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting jinja2 (from torch->easyocr)Downloading jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch->easyocr)Downloading fsspec-2024.6.1-py3-none-any.whl.metadata (11 kB)
Collecting setuptools (from torch->easyocr)Downloading setuptools-72.1.0-py3-none-any.whl.metadata (6.6 kB)
Collecting imageio>=2.33 (from scikit-image->easyocr)Downloading imageio-2.34.2-py3-none-any.whl.metadata (4.9 kB)
Collecting tifffile>=2022.8.12 (from scikit-image->easyocr)Downloading tifffile-2024.8.10-py3-none-any.whl.metadata (31 kB)
Collecting packaging>=21 (from scikit-image->easyocr)Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting lazy-loader>=0.4 (from scikit-image->easyocr)Downloading lazy_loader-0.4-py3-none-any.whl.metadata (7.6 kB)
Collecting MarkupSafe>=2.0 (from jinja2->torch->easyocr)Downloading MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl.metadata (3.1 kB)
Collecting mpmath<1.4,>=1.1.0 (from sympy->torch->easyocr)Downloading mpmath-1.3.0-py3-none-any.whl.metadata (8.6 kB)
Downloading easyocr-1.7.1-py3-none-any.whl (2.9 MB)---------------------------------------- 2.9/2.9 MB 3.0 MB/s eta 0:00:00
Downloading torchvision-0.19.0-1-cp312-cp312-win_amd64.whl (1.3 MB)---------------------------------------- 1.3/1.3 MB 4.5 MB/s eta 0:00:00
Downloading torch-2.4.0-cp312-cp312-win_amd64.whl (197.8 MB)---------------------------------------- 197.8/197.8 MB 6.7 MB/s eta 0:00:00
Downloading numpy-1.26.4-cp312-cp312-win_amd64.whl (15.5 MB)---------------------------------------- 15.5/15.5 MB 6.5 MB/s eta 0:00:00
Downloading pillow-10.4.0-cp312-cp312-win_amd64.whl (2.6 MB)---------------------------------------- 2.6/2.6 MB 5.3 MB/s eta 0:00:00
Downloading ninja-1.11.1.1-py2.py3-none-win_amd64.whl (312 kB)---------------------------------------- 313.0/313.0 kB 1.6 MB/s eta 0:00:00
Downloading opencv_python_headless-4.10.0.84-cp37-abi3-win_amd64.whl (38.8 MB)---------------------------------------- 38.8/38.8 MB 13.6 MB/s eta 0:00:00
Downloading pyclipper-1.3.0.post5-cp312-cp312-win_amd64.whl (108 kB)---------------------------------------- 108.2/108.2 kB 3.2 MB/s eta 0:00:00
Downloading python_bidi-0.6.0-cp312-none-win_amd64.whl (156 kB)---------------------------------------- 156.3/156.3 kB 9.1 MB/s eta 0:00:00
Downloading PyYAML-6.0.2-cp312-cp312-win_amd64.whl (156 kB)---------------------------------------- 156.3/156.3 kB 4.7 MB/s eta 0:00:00
Downloading scikit_image-0.24.0-cp312-cp312-win_amd64.whl (12.9 MB)---------------------------------------- 12.9/12.9 MB 3.0 MB/s eta 0:00:00
Downloading scipy-1.14.0-cp312-cp312-win_amd64.whl (44.5 MB)---------------------------------------- 44.5/44.5 MB 10.1 MB/s eta 0:00:00
Downloading shapely-2.0.5-cp312-cp312-win_amd64.whl (1.4 MB)---------------------------------------- 1.4/1.4 MB 11.5 MB/s eta 0:00:00
Downloading imageio-2.34.2-py3-none-any.whl (313 kB)---------------------------------------- 313.5/313.5 kB 9.8 MB/s eta 0:00:00
Downloading lazy_loader-0.4-py3-none-any.whl (12 kB)
Downloading networkx-3.3-py3-none-any.whl (1.7 MB)---------------------------------------- 1.7/1.7 MB 1.2 MB/s eta 0:00:00
Downloading packaging-24.1-py3-none-any.whl (53 kB)---------------------------------------- 54.0/54.0 kB 1.4 MB/s eta 0:00:00
Downloading tifffile-2024.8.10-py3-none-any.whl (225 kB)---------------------------------------- 225.8/225.8 kB 129.0 kB/s eta 0:00:00
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading filelock-3.15.4-py3-none-any.whl (16 kB)
Downloading fsspec-2024.6.1-py3-none-any.whl (177 kB)---------------------------------------- 177.6/177.6 kB 5.4 MB/s eta 0:00:00
Downloading jinja2-3.1.4-py3-none-any.whl (133 kB)---------------------------------------- 133.3/133.3 kB 7.7 MB/s eta 0:00:00
Downloading setuptools-72.1.0-py3-none-any.whl (2.3 MB)---------------------------------------- 2.3/2.3 MB 2.0 MB/s eta 0:00:00
Downloading sympy-1.13.2-py3-none-any.whl (6.2 MB)---------------------------------------- 6.2/6.2 MB 3.7 MB/s eta 0:00:00
Downloading MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl (17 kB)
Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)---------------------------------------- 536.2/536.2 kB 1.2 MB/s eta 0:00:00
Installing collected packages: python-bidi, pyclipper, ninja, mpmath, typing-extensions, sympy, setuptools, PyYAML, Pillow, packaging, numpy, networkx, MarkupSafe, fsspec, filelock, tifffile, Shapely, scipy, opencv-python-headless, lazy-loader, jinja2, imageio, torch, scikit-image, torchvision, easyocr
Successfully installed MarkupSafe-2.1.5 Pillow-10.4.0 PyYAML-6.0.2 Shapely-2.0.5 easyocr-1.7.1 filelock-3.15.4 fsspec-2024.6.1 imageio-2.34.2 jinja2-3.1.4 lazy-loader-0.4 mpmath-1.3.0 networkx-3.3 ninja-1.11.1.1 numpy-1.26.4 opencv-python-headless-4.10.0.84 packaging-24.1 pyclipper-1.3.0.post5 python-bidi-0.6.0 scikit-image-0.24.0 scipy-1.14.0 setuptools-72.1.0 sympy-1.13.2 tifffile-2024.8.10 torch-2.4.0 torchvision-0.19.0 typing-extensions-4.12.2[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: python.exe -m pip install --upgrade pipC:\Users\Administrator>python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\program files\python312\lib\site-packages (24.0)
Collecting pipDownloading pip-24.2-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.2-py3-none-any.whl (1.8 MB)---------------------------------------- 1.8/1.8 MB 1.1 MB/s eta 0:00:00
Installing collected packages: pipAttempting uninstall: pipFound existing installation: pip 24.0Uninstalling pip-24.0:Successfully uninstalled pip-24.0
Successfully installed pip-24.2C:\Users\Administrator>pip install easyocr
Requirement already satisfied: easyocr in c:\program files\python312\lib\site-packages (1.7.1)
Requirement already satisfied: torch in c:\program files\python312\lib\site-packages (from easyocr) (2.4.0)
Requirement already satisfied: torchvision>=0.5 in c:\program files\python312\lib\site-packages (from easyocr) (0.19.0)
Requirement already satisfied: opencv-python-headless in c:\program files\python312\lib\site-packages (from easyocr) (4.10.0.84)
Requirement already satisfied: scipy in c:\program files\python312\lib\site-packages (from easyocr) (1.14.0)
Requirement already satisfied: numpy in c:\program files\python312\lib\site-packages (from easyocr) (1.26.4)
Requirement already satisfied: Pillow in c:\program files\python312\lib\site-packages (from easyocr) (10.4.0)
Requirement already satisfied: scikit-image in c:\program files\python312\lib\site-packages (from easyocr) (0.24.0)
Requirement already satisfied: python-bidi in c:\program files\python312\lib\site-packages (from easyocr) (0.6.0)
Requirement already satisfied: PyYAML in c:\program files\python312\lib\site-packages (from easyocr) (6.0.2)
Requirement already satisfied: Shapely in c:\program files\python312\lib\site-packages (from easyocr) (2.0.5)
Requirement already satisfied: pyclipper in c:\program files\python312\lib\site-packages (from easyocr) (1.3.0.post5)
Requirement already satisfied: ninja in c:\program files\python312\lib\site-packages (from easyocr) (1.11.1.1)
Requirement already satisfied: filelock in c:\program files\python312\lib\site-packages (from torch->easyocr) (3.15.4)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\program files\python312\lib\site-packages (from torch->easyocr) (4.12.2)
Requirement already satisfied: sympy in c:\program files\python312\lib\site-packages (from torch->easyocr) (1.13.2)
Requirement already satisfied: networkx in c:\program files\python312\lib\site-packages (from torch->easyocr) (3.3)
Requirement already satisfied: jinja2 in c:\program files\python312\lib\site-packages (from torch->easyocr) (3.1.4)
Requirement already satisfied: fsspec in c:\program files\python312\lib\site-packages (from torch->easyocr) (2024.6.1)
Requirement already satisfied: setuptools in c:\program files\python312\lib\site-packages (from torch->easyocr) (72.1.0)
Requirement already satisfied: imageio>=2.33 in c:\program files\python312\lib\site-packages (from scikit-image->easyocr) (2.34.2)
Requirement already satisfied: tifffile>=2022.8.12 in c:\program files\python312\lib\site-packages (from scikit-image->easyocr) (2024.8.10)
Requirement already satisfied: packaging>=21 in c:\program files\python312\lib\site-packages (from scikit-image->easyocr) (24.1)
Requirement already satisfied: lazy-loader>=0.4 in c:\program files\python312\lib\site-packages (from scikit-image->easyocr) (0.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\program files\python312\lib\site-packages (from jinja2->torch->easyocr) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\program files\python312\lib\site-packages (from sympy->torch->easyocr) (1.3.0)C:\Users\Administrator>

安装CUDA Toolkit

easyOCR默认是可以通过CPU直接进行计算的,但是为了更好的体验效果,就需要借助GPU来实现

查找适合自己电脑的CUDA Toolkit版本

查看自己电脑的CUDA Compute Capability版本

我的电脑是台式机,显卡是RTX 3060,显卡驱动为555.99

CUDA GPUs - Compute Capability | NVIDIA Developer

从上面链接可以查看到适合自己显卡的的CUDA Toolkit版本,

我并没有在官网里明确找到Compute Capability 8.6对应的所支持的CUDA Toolkit版本

但我从下面这个链接里看到

https://developer.nvidia.com/rdp/cudnn-archive

从这里看到看到大概8.6对应支持到11.X,我先选了个11.X里的最高版本11.8试试,下载链接如下:

https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local

安装过程

验证CUDA安装

安装完成后,打开命令提示符(Windows)或终端(Linux/macOS),输入以下命令,确认CUDA已正确安装:

C:\Users\Administrator>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
C:\Users\Administrator>

安装NVIDIA cuDNN

NVIDIA cuDNN

这里下载的时候,居然还需要注册

下载后解压:

下载完成后,解压缩文件,并将binincludelib目录中的文件复制到CUDA Toolkit的安装目录下(通常是 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.X,其中X.X是你的CUDA版本号)。

安装PyTorch的CUDA版本

https://pytorch.org/

CMD安装PyTorch

C:\Users\Administrator>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
Looking in indexes: https://download.pytorch.org/whl/cu118
Requirement already satisfied: torch in c:\program files\python312\lib\site-packages (2.4.0)
Requirement already satisfied: torchvision in c:\program files\python312\lib\site-packages (0.19.0)
Collecting torchaudioDownloading https://download.pytorch.org/whl/cu118/torchaudio-2.4.0%2Bcu118-cp312-cp312-win_amd64.whl (4.0 MB)---------------------------------------- 4.0/4.0 MB 4.4 MB/s eta 0:00:00
Requirement already satisfied: filelock in c:\program files\python312\lib\site-packages (from torch) (3.15.4)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\program files\python312\lib\site-packages (from torch) (4.12.2)
Requirement already satisfied: sympy in c:\program files\python312\lib\site-packages (from torch) (1.13.2)
Requirement already satisfied: networkx in c:\program files\python312\lib\site-packages (from torch) (3.3)
Requirement already satisfied: jinja2 in c:\program files\python312\lib\site-packages (from torch) (3.1.4)
Requirement already satisfied: fsspec in c:\program files\python312\lib\site-packages (from torch) (2024.6.1)
Requirement already satisfied: setuptools in c:\program files\python312\lib\site-packages (from torch) (72.1.0)
Requirement already satisfied: numpy<2 in c:\program files\python312\lib\site-packages (from torchvision) (1.26.4)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\program files\python312\lib\site-packages (from torchvision) (10.4.0)
Collecting torchDownloading https://download.pytorch.org/whl/cu118/torch-2.4.0%2Bcu118-cp312-cp312-win_amd64.whl (2692.5 MB)---------------------------------------- 2.7/2.7 GB 3.2 MB/s eta 0:00:00
Requirement already satisfied: MarkupSafe>=2.0 in c:\program files\python312\lib\site-packages (from jinja2->torch) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\program files\python312\lib\site-packages (from sympy->torch) (1.3.0)
Installing collected packages: torch, torchaudioAttempting uninstall: torchFound existing installation: torch 2.4.0Uninstalling torch-2.4.0:Successfully uninstalled torch-2.4.0WARNING: Failed to remove contents in a temporary directory 'C:\Program Files\Python312\Lib\site-packages\~orch'.You can safely remove it manually.
Successfully installed torch-2.4.0+cu118 torchaudio-2.4.0+cu118C:\Users\Administrator>

测试CUDA是否正常工作

import torch
print(torch.cuda.is_available())  # 应该输出: True
print(torch.cuda.get_device_name(0))  # 应该输出: RTX 3060

使用EasyOCR来识别

创建一个test.py文件

import easyocrdef main():# 交互式输入图像路径image_path = input("请输入图像文件的路径: ")try:# 创建EasyOCR阅读器reader = easyocr.Reader(['ch_sim', 'en'])  # 支持中文和英文# 识别图像中的文本results = reader.readtext(image_path)# 打印识别结果print("\n识别出的文本:")for (bbox, text, prob) in results:print(f"文本: {text} (置信度: {prob:.2f})")except Exception as e:print(f"发生错误: {e}")# 防止控制台窗口自动关闭input("\n按回车键退出...")if __name__ == "__main__":main()

运行后输入内容如下:

请输入图像文件的路径: W:\test.png
C:\Program Files\Python312\Lib\site-packages\easyocr\detection.py:85: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.net.load_state_dict(copyStateDict(torch.load(trained_model, map_location=device)))
C:\Program Files\Python312\Lib\site-packages\easyocr\recognition.py:182: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.model.load_state_dict(torch.load(model_path, map_location=device))识别出的文本:
文本: Github (置信度: 0.77)
文本: 2024/7/27134 (置信度: 0.78)
文本: 文件夹 (置信度: 0.44)
按回车键退出...

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/782998.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

内心与相关构型

内心1、三条角平分线 2、在 \(\odot M\) 上(鸡爪圆上) 3、\(AI\cdot IM=AM\cdot IK=2Rr\) ,即 \(OI^2=R^2-2Rr\)4、\(\odot I\) 与 \(\odot I_A\) 关于点 \(A\) 位似,所以 \(D\) 的对径点 \(D\) 满足 \(ADX\) 共线(两个圆过这两个点的切线平行),同理 \(AD\) 过 \(X\) 的…

【Windows系列】网卡1访问外网,网卡2访问内网!

背景 一、实验环境准备二、查看ipv4服务是否勾选和开启三、修改网卡路由四、修改网卡路由背景 当我们的Windows电脑有双网卡,若这时想要实现一张网卡用于访问外网,另一张网卡用于访问内网的功能。比如通过远程电脑,然后再通过电脑去访问我们家里的NAS存储等。通常这种需求下…

事件驱动系统设计之将事件检索与事件处理解耦

0 前言 part1讨论了集成过程中遇到的挑战以及幂等事件处理的作用。解决集成问题之后,我们需要反思事件检索的问题。我们的经验教训表明,将事件检索与事件处理解耦至关重要。 1 事件处理与请求/响应 API 紧耦合 part1讨论了将请求/响应 API 集成到事件驱动微服务中时,由于基于…

豆瓣影评数据抓取

豆瓣影评数据抓取 创建时间:2024-08-12 抓取豆瓣影评相关数据的代码,包括封面、标题、评论内容以及影评详情页的数据。 一、完整代码https://movie.douban.com/review/best/ 抓取封面 标题 评论內容 抓取完整的评论内容 也就是点击展开后的完整的 抓取当前影评的详情页的数…

设计规划专业 All In One

设计规划专业 All In One 设计规划 城市规划与设计设计规划专业 All In One 设计规划城市规划与设计demos西交利物浦大学当今我们生活在一个不断变化的全球环境中,中国以及世界城市发展面临着诸多挑战。城市规划(城市设计方向)硕士课程将培养学生将设计原理和技术运用到解决…

基于java实现MYDB数据库

整体结构 --MYDB分为后端和前端,前后端通过socket进行交互 前端(客户端)用于读取用户输入,并发送到后端执行,输出返回结果 MYDB后端需要解析SQL --MYDB的后端分为5个模块 分别是: 1、Transaction Manager事务管理器 2、Data Manager数据管理器 3、Version Manager版本管理器…

颜色空间的互相转换

前言 在上一篇中,我们介绍了常见颜色空间的一些定义及表示,在这一章中,我们将大致了解各个颜色空间的互相转换 颜色转换算法 由于有些颜色空间可能并不能直接转换,或着过于繁杂,本文主要介绍由RGB向其它空间的转换,涉及到的代码也采用Ts进行演示讲解 在文章的最后面,会给…

TGI 多-LoRA: 部署一次,搞定 30 个模型的推理服务

你是否已厌倦管理多个 AI 模型所带来的复杂性和高成本? 那么, 如果你可以部署一次就搞定 30 个模型推理服务会如何? 在当今的 ML 世界中,哪些希望充分发挥其数据的价值的组织可能最终会进入一个“微调的世界”。在这个世界,各个组织会构建大量模型,其中每个模型都针对特定…

计算机常用软件和语言

关于CSP-J初赛的学习笔记3.计算机常用软件和语言 3.1 计算机软件系统 计算机软件通常分为系统软件和应用软件两大类;系统软件 即支持应用软件开发和运行的一类计算机软件。一般包括操作系统,语言处理程序,数据库系统,网络管理系统等应用软件 即为特定领域开发,并为特定目的…

「Day 7—离散化 树状数组 线段树」

离散化 定义 离散化本质是一种哈希,是一种用来处理数据的方法。 1.创建原数组的副本。 2.将副本中的值从小到大排序。 3.将排序好的副本去重。 4.查找原数组的每一个元素在副本中的位置,位置即为排名,将其作为离散化后的值。 B3694 数列离散化 代码 #include<iostream>…

chrome无法下载文件

用的电脑是Mac Air M1,安装了127版本的chrome,总有几次在浏览器上下载文件的时候明明点击了下载按钮,chrome图标显示已经有下载的内容了,但是打开下载文件夹却不显示显示下载的文件,扒拉看了一下说是迅雷插件要关闭,后面发现自己也没安装迅雷插件。解决方案: 把这两个关…

万兆以太网协议栈的FPGA实现(一):常识+PCSPMA+结构

参考: https://docs.amd.com/r/zh-CN/pg210-25g-ethernet/%E7%AE%80%E4%BB%8B?tocId=59kIPN67Q57xorWh9w6GTA 10GbE以太网MAC和PHY - 者旨於陽 - 博客园 (cnblogs.com) 什么是CML电平-CSDN博客 10G Ethernet PCS/PMA v6.0 Product Guide (PG068) • 查看器 • AMD 技术信息门…