ImageNet(2010-2017)图像识别数据集

ImageNet 数据集是目前世界上图像识别最大的数据库,根据 WordNet 层次 结构 (目前仅限物体)组织,主要用于机器视觉领域的图像分类和目标检测。其中层次结构的每个节点由数百和数千个图像描绘,每个节点平均有超过 500 个图像,有大约 1500 万张图片,2.2 万类。 ImageNet 数据集于 2009 年由斯坦福大学的李飞飞等人在视觉科学学会(VSS)首次发布,而后自 2010 年起一年一度的 ImageNet 大规模视觉识别挑战(ILSVRC)挑战赛不断完善 ImageNet 数据集。

ImageNet.torrent  需要占用磁盘空间 860.55 GB

参考链接


如何检查macOS SSD健康状态,保持系统及文档安全

苹果为了保持自家一定领先地位,在 MAC 设备上都采用了 SSD 磁盘。为了帮助用户关注磁盘运行状况,macOS 系统中已经内置了检查内置 SSD 和其它已连接磁盘运行状态的相关工具。以便在SSD 固态磁盘挂掉之前,就让用户提前检测并知晓其工作状态。

各种存储介质,包括 SSD,其实都是消耗品。这意味着一旦磁盘挂了,不仅会影响系统正常运行,甚至存储的文件都会有损失的风险。

继续阅读如何检查macOS SSD健康状态,保持系统及文档安全

OCR-文本图像合成工具

1. Text Recognition Data Generator

Github地址: https://github.com/Belval/TextRecognitionDataGenerator

官方文档:https://textrecognitiondatagenerator.readthedocs.io/en/latest/index.html

安装:

# pip 安装,中文不建议
$ pip install trdg -i https://pypi.mirrors.ustc.edu.cn/simple/

# git clone
$ git clone https://github.com/Belval/TextRecognitionDataGenerator

以下根据个人需要:

git clone 解压后进入 /trdg/bin 安装目录:

$ mv trdg ../run.py

$ cd ..

$ vim run.py
# 删除 run.py中的 from trdg import, 全部改为 import

$ vim data_generator.py
# 同上,删除此文件首部的 from trdg import, 改为 import
  • pictures/ 文件夹内存放背景图,可以多添加一些图片用于丰富生成的合成图片;
  • fonts/ 文件夹内 cn/ en/分别存放中、英文字体文件(.ttf格式),可以自己在网上下载不同ttf文件放入文件夹内;
  • string_generator.py 定义了图片上的文本如何选取,可以自行定义(博主在Centos7服务器上中文好像一直有乱码问题,只能修改string 的编码)
  • data_generator.py 是按照给定参数生成图片,最好在里面加上 try / except,大规模合成数据万一有一个case报错就要重新生成,很麻烦,相应的在 bin/trdg 文件中修改相应的生成 labels.txt 的代码,保证一致(这里也可能涉及到保存的中文文本乱码,如果是的话也要修改string的编解码)

生成命令(示例,具体见官方文档):

$ python trdg -l cn -c 1000000 -d 1 -rs -b 3 -w 20 -bl 1 -rbl -tc '#000000,#888888' -f 64 -t 32 --output_dir 'sin-100w'
  • -l cn: language 为中文
  • -c 1000000: 生成1000000张图
  • -d 1: 文字按正弦函数曲线分布(0为不弯曲,1为sin,2为cos)
  • -rs: 图片文字随机选取;
  • -b 3: 背景图像从pictures文件夹中的图像上随机截取(0为高斯白噪声背景,1为白色背景,2为quasicrystal,3为自定义图片)
  • -bl 1 -rbl: 随机模糊,1为模糊的kernel size
  • -tc '#000000, #888888': 颜色变化区间
  • -f 64: 水平分布文字图像的高(像素64)
  • --output_dir 'sin-100w': 输出文件夹

2. Text Render

Github地址:https://github.com/Sanster/text_renderer

参见 github 的 README.md.

3. SynthText

Github地址: https://github.com/ankush-me/SynthText

参考链接


更换pip源到国内镜像

pip国内的一些镜像

python国内源

阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

修改源

临时使用:
可以在使用pip的时候在后面加上-i参数,指定pip源为国内源

eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

永久修改:
Linux/macOS:
修改 `~/.pip/pip.conf` (没有就创建一个), 内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

对于当前用户不是`root`,而有时候需要使用`sudo`安装的情况,上述设置是无效的。需要在`root`用户目录也设置一下,一般情况下配置文件默认是`/root/.pip/pip.conf`。

Windows:
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

参考链接


更换pip源到国内镜像

解决macOS 10.15.2下Python的tkinter库Entry无法输入中文

问题描述

macOS 10.15.2下使用 tkinter Entry 输入框,无法输入中文,不管怎么样都只能输入英文,只能复制进去中文,交互体验很不好ಥ_ಥ。

我的版本是 macOS 10.15.2python 3.7.5

继续阅读解决macOS 10.15.2下Python的tkinter库Entry无法输入中文

ubuntu 18.04下安装CUDA 10.1以及cuDNN的安装

安装最新版本的 `CUDA 10.1`:

# 卸载之前已经安装的cuda
$ sudo apt-get remove nvidia-cuda-toolkit

$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin

$ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600

$ wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb

$ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb

$ sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub

$ sudo apt-get update

$ sudo apt-get -y install cuda

# 部分驱动可能会更新,需要执行更新,否则可能依旧不正常
$ sudo apt-get dist-upgrade

$ sudo apt-get autoremove

# 可能需要删除一下XWindow的配置文件,否则驱动可能不能正常加载
$ sudo rm -rf ~/.Xauthority 

# 如果出现如下错误
# ubuntu 18.04 "nvidia-340 导致 /usr/lib/x86_64-linux-gnu/libGL.so.1 
# 转移到 /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib"
# 参考 http://www.mobibrw.com/?p=21739 

# 删除安装源,可以节约几个GB的磁盘,安装完成后这部分已经用不上了
$ sudo apt-get remove --purge cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00 

安装对应版本的`cuDNN`:

$ wget https://www.mobibrw.com/wp-content/uploads/2019/11/libcudnn7_7.6.5.32-1cuda10.1_amd64.deb_.zip

$ wget https://www.mobibrw.com/wp-content/uploads/2019/11/libcudnn7-dev_7.6.5.32-1cuda10.1_amd64.deb_.zip

$ wget https://www.mobibrw.com/wp-content/uploads/2019/11/libcudnn7-doc_7.6.5.32-1cuda10.1_amd64.deb_.zip

# 解压缩
$ unzip libcudnn7_7.6.5.32-1cuda10.1_amd64.deb_.zip

$ unzip libcudnn7-dev_7.6.5.32-1cuda10.1_amd64.deb_.zip

$ unzip libcudnn7-doc_7.6.5.32-1cuda10.1_amd64.deb_.zip

# 按照顺序安装
$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb

$ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb

$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb

检测是否成功安装:

$ cp -r /usr/src/cudnn_samples_v7/ ~/

$ cd ~/cudnn_samples_v7/mnistCUDNN

$ make clean && make

$ ./mnistCUDNN

执行输出如下结果代表成功安装:

继续阅读ubuntu 18.04下安装CUDA 10.1以及cuDNN的安装

在用BeautifulSoup解析HTML前对其中以JavaScript渲染部分的处理

在命令行运行:

# Python2
$ pip install requests-html

# Python3
# pip3 install requests-html

即可安装该模块。

例子如下:

#coding=utf-8
from bs4 import BeautifulSoup
import requests
from requests_html import HTMLSession
 
#使用requests抓取页面内容,并将响应赋值给page变量
html = requests.get('https://xcx.xzlzq.net/#/liftDetail?registerCode=31103301042010020002')
 
session = HTMLSession()
first_page = session.get('https://xcx.xzlzq.net/#/liftDetail?registerCode=31103301042010020002')
first_page.html.render(sleep=5)

#使用content属性获取页面的源页面
#使用BeautifulSoap解析,内容传递到BeautifulSoap类
soup = BeautifulSoup(first_page.html.html,'lxml')
links = soup.find_all('div',class_='content')
 
#link的内容就是div,我们取它的span内容就是我们需要段子的内容
for link in links:
    print(link.span.get_text())

参考链接


Samsung Magician 6.0升级固件失败“在选定的驱动器上无法更新固件。”("Failed to update firmware on the selected drive.")

最近的三星固态硬盘提示固件有升级,但是固件升级失败,提示“在选定的驱动器上无法更新固件。”或者"Failed to update firmware on the selected drive."

如下图所示:

继续阅读Samsung Magician 6.0升级固件失败“在选定的驱动器上无法更新固件。”("Failed to update firmware on the selected drive.")