
DL-数据预处理
DL-数据预处理
城俊BLOG
从此好好码代码。。
展开
-
图片输入数据检查: nan inf和不存在
import osimport cv2import numpy as npfrom tqdm import tqdm# read txt file content to listdef ReadTxt_to_list(rootdir): lines = [] with open(rootdir, 'r') as file_to_read: while True: line = file_to_read.readline()原创 2021-06-11 14:28:55 · 272 阅读 · 1 评论 -
Pytorch one hot多标签学习报错 RuntimeError: multi-target not supported at /opt/conda/conda-bld/pytorch_1556
报错:Traceback (most recent call last): File "/home/user1/main.py", line 544, in <module> main() File "/home/user1/main.py", line 273, in main validate(test_loader_lfwa, model, criterion) File "/home/user1/main.py", line 476, in validate原创 2020-06-18 16:30:15 · 4462 阅读 · 0 评论 -
pytorch训练报错TypeError: batch must contain tensors, numbers, dicts or lists found class PIL.Image.I
Traceback (most recent call last): File "/home/user1/main.py", line 1153, in <module> main() File "/home/user1/main.py", line 546, in main count_train) File "/home/user1/main.py", line 618, in train for i, (input, target) in enumera翻译 2020-06-13 12:18:58 · 7436 阅读 · 5 评论 -
LAP, UTKFace,webface, morph II 人脸数据集
LAP15 / LAP16:http://chalearnlap.cvc.uab.es/ (old:http://gesture.chalearn.org/)UTKFace:https://susanqq.github.io/UTKFace/原创 2020-05-21 17:06:38 · 3715 阅读 · 1 评论 -
sublimetext正则 选择性替换,保持原来的部分不变
1,替换 "字母+空格+数字"为 “原来的字母+多个tab+原来的数字”search:[a-z]\s[0-9]replace: $1和$3表示匹配到的第一个位置和第三个位置$1\t\t\t\t\t\t$32,替换https://blog.youkuaiyun.com/aerchi/article/details/46739801https://blog.youkuaiyun.com/gdp12315_gu/article/details/51730584...翻译 2020-05-19 16:52:03 · 3362 阅读 · 1 评论 -
IMDB-WIKI人脸属性数据集解析,dob matlab序列号转为出生日期
地址:https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/内容:wiki_crop.tar(做了人脸的crop 1G),wiki.tar.gz(没有crop的 3G)应该根据需要下载一个就行属性:原创 2020-05-15 17:01:24 · 1469 阅读 · 4 评论 -
LFWA人脸属性数据集解析
地址:文件内容:1,人脸照片lfw.zip 2,40类的属性标注lfw_att_40.mat 3,73类的属性标注lfw_att_73.mat 4,训练测试划分indices_train_test.mat属性:40属性:5_o_Clock_Shadow' Arched_Eyebrows' Attractive' Bags_Under_Eyes' Bald' Bangs' Big_Lips' Big_Nose' Black_Hair' ..原创 2020-05-15 10:11:18 · 3023 阅读 · 3 评论 -
CelebA人脸属性数据集解析
地址:http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html内容:celebA/Anno/list_attr_celeba.txt属性:5_o_Clock_Shadow ;Arched_Eyebrows ;Attractive ;Bags_Under_Eyes ;Bald ;Bangs ;Big_Lips ;Big_Nose ;Black_Hair ;Blond_Hair ;Blurry ;Brown_Hair ;Bushy_Eyebrows ;Chub原创 2020-05-15 11:05:34 · 2363 阅读 · 0 评论 -
Excel单元格内的换行替换为空格或者分号
选中单元格替换的快捷键:ctrl + h输入换行符:ctrl + j然后替换为:输入空格或者分号全部替换即可翻译 2020-05-15 10:55:09 · 7897 阅读 · 0 评论 -
AttributeError: module 'scipy.misc' has no attribute 'imresize'
sicpy版本不对,卸载其他版本,安装1.2.1版1,查看现有版本$ pip3.6 list2,卸载现有版本$ pip3.6 uninstall scipy3,安装指定岸本$ pip3.6 --trusted-host=files.pythonhosted.org --trusted-host=pypi.org install scipy==1.2.1 --user参考:ht...原创 2020-02-05 16:35:18 · 2188 阅读 · 0 评论 -
pytorch RuntimeError: input image (T: 9 H: 8 W: 2) smaller than kernel size (kT: 4 kH: 4 kW: 4)
报错:RuntimeError: input image (T: 9 H: 8 W: 2) smaller than kernel size (kT: 4 kH: 4 kW: 4)原因:可能不是字面那样是输入图片尺寸小了,而是维度不匹配。比如需要的输出是 (channel, height, width, frames)你输入的是 (channel, frames, height, widt...原创 2019-12-30 21:34:52 · 3082 阅读 · 0 评论 -
scipy.io.matlab IOError: could not read bytes
python2.7scipy 1.2.2代码:import scipyfrom scipy.io import matlabmat = matlab.loadmat(filename)报错:Traceback (most recent call last): File "syn_data/rep_pickle.py", line 57, in <modu...原创 2019-12-13 15:34:56 · 3843 阅读 · 0 评论 -
常用图片读取接口的速度测试
本文测试了三种常用的读图接口的速度:matplotlib.pyplot.imread, PIL.Image.open, cv2.imread测试方法为:读取1000张图片,转换为矩阵,看哪个API平均速度最快测试环境:Win10 x64, python3.5.4>>> matplotlib.__version__'3.0.3'>>> PIL._...原创 2019-11-27 20:22:23 · 1226 阅读 · 0 评论 -
AttributeError: 'JpegImageFile' object has no attribute 'load_seek'
【背景】使用PIL进行图片预处理,检查不完整的图片。可以使用Load()方法和verify方法。【报错】根据load和verify的顺序不同,可能的报错有以下几种:一、先使用load再使用verify:AttributeError: 'NoneType' object has no attribute 'close'二、先使用verify再load:AttributeError...原创 2019-06-03 15:29:30 · 8417 阅读 · 1 评论 -
TypeError: Cannot cast ufunc add output from dtype(‘float64‘) to dtype(‘uint8‘) with casting rule ‘s
【背景】keras中ImageDataGenerator使用image crop来进行数据增强,参考:https://blog.youkuaiyun.com/u012348774/article/details/78612869【报错】TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint8') with c...原创 2019-06-03 19:38:02 · 16259 阅读 · 1 评论 -
pandas生成dataframe,获取行和列,得到series
lib不用就忘:一、创建dataframeC:\Windows\system32>pythonPython 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for m...原创 2019-09-24 17:54:30 · 10212 阅读 · 1 评论 -
python 正则表达式re扫盲
一、sublimetext正则表达式搜索批量替换1,在正则表达式中匹配多个任意字符(类似于通配符),例如在sublimetext中批量替换 _1.jpg 结尾的字符串。可以在查找中输入: .*_1.jpg.*相当于shell里的*,表示0至多个任意字符参考:https://blog.youkuaiyun.com/weini1111/article/details/72896874二、...原创 2019-09-25 14:16:39 · 428 阅读 · 1 评论 -
【数据预处理】归一化和标准化的问题
一,归一化和标准化的区别:https://www.jianshu.com/p/4c3081d40ca6https://www.zhihu.com/question/20467170二,2.1 什么时候(什么模型)需要归一化:以下情况需要归一化:非概率模型;模型关心变量的值;使用梯度下降法求最优解。2.2 需要归一化的模型:神经网络/SVM/PCA/k-means/线性回归/A...原创 2019-03-20 18:00:40 · 2366 阅读 · 1 评论