摘要: 使用pdb模块辅助python调试。 import pdb 断点模式 在需要调试的语句前设置断点,加入这行代码: pdb.set_trace() 程序运行到这就会进入断点调试模式。 | 输入 | 作用 | | | | |n|运行下一步| |s x|进入某个函数x| |c|跳到下一个断点| |p x| 阅读全文
posted @ 2022-03-03 17:31 CAMILIA 阅读(95) 评论(0) 推荐(0)
摘要: python常常用opencv模块来处理图像。 import cv2 as cv 读取图片:imread() 默认按照彩色三通道读取: img = cv2.imread(path) 读取灰度图: img = cv2.imread(path, cv2.IMREAD_GRAYSCALE) 色彩空间转换: 阅读全文
posted @ 2022-03-03 17:24 CAMILIA 阅读(532) 评论(0) 推荐(0)
摘要: PyTorch框架中常用torchvision模块来辅助计算机视觉算法的搭建,transforms用于图像的预处理。 from torchvision import transforms 预处理操作集合:Compose rans = transforms.Compose([ transforms.T 阅读全文
posted @ 2022-03-03 16:43 CAMILIA 阅读(624) 评论(0) 推荐(0)
摘要: 在训练模型时,经常遇到需要采用多个策略同时跑的情况,直接运行的话比较费时,只要CPU和GPU支持,可以通过Linux的screen命令多终端并行,大大提升效率。 创建: screen -S name 退出/离线: 键盘:(ctrl) + a + d 或者输入: screen -d name 删除 s 阅读全文
posted @ 2022-03-03 16:14 CAMILIA 阅读(207) 评论(0) 推荐(0)
摘要: 拆分数据集train&test from sklearn.model_selection import train_test_split 可以按比例拆分数据集,分为train和test x_train, x_test, y_train, y_test = train_test_split(x, y 阅读全文
posted @ 2022-03-03 14:39 CAMILIA 阅读(153) 评论(0) 推荐(0)