fastai学习
Witcher8848
这个作者很懒,什么都没留下…
展开
-
fastai更新后训练速度较慢——未使用GPU
fastai更新后训练速度慢的问题!很久没用fastai,使用时发现训练速度很慢,后来发现是没用GPU原因是torch更新时更新成了CPU版本下面代码查看是否能用GPUimport torchprint(torch.cuda.is_available())print(torch.__version__)print(torch.version.cuda)print(torch.backends.cudnn.version())如果是false,且version是cpu版本,那么将原版本卸载原创 2021-11-25 15:45:17 · 1548 阅读 · 0 评论 -
7-mnist-cnn
mnist cnn导入包%reload_ext autoreload%autoreload 2%matplotlib inlinefrom fastai.vision import *导入数据path = untar_data(URLs.MNIST)path.ls()[WindowsPath('C:/Users/Wither8848/.fastai/data/mnist_pn...原创 2020-03-29 13:37:49 · 183 阅读 · 0 评论 -
6-热力图
数据增强导入包%reload_ext autoreload%autoreload 2%matplotlib inlinefrom fastai.vision import *bs = 64path = untar_data(URLs.PETS)/'images'数据增强p_affine仿射变换发生概率p_lighting光照变换发生概率tfms = get_tran...原创 2020-03-29 13:35:08 · 293 阅读 · 0 评论 -
6-kaggle-rossman
rossman导入包%reload_ext autoreload%autoreload 2from fastai.tabular import *数据预处理加入时间的表示,如周几在rossmandataclean完成add_datepart(train, "Date", drop=False)add_datepart(test, "Date", drop=False)载入数...原创 2020-03-29 13:32:49 · 264 阅读 · 0 评论 -
4-协同过滤(推荐系统)
协同过滤导入包,数据from fastai.collab import *from fastai.tabular import *path = untar_data(URLs.ML_SAMPLE)pathWindowsPath('C:/Users/Wither8848/.fastai/data/movie_lens_sample')ratings = pd.read_csv(p...原创 2020-03-29 13:27:43 · 535 阅读 · 0 评论 -
4-tablur
处理表格数据导入包,数据集from fastai.tabular import *path = untar_data(URLs.ADULT_SAMPLE)df = pd.read_csv(path/'adult.csv')指定哪些是类别变量,哪些是连续变量数据预处理procsdep_var = 'salary'cat_names = ['workclass', 'educa...原创 2020-03-29 13:25:04 · 169 阅读 · 0 评论 -
3-imdb
3-imdb数据集导入包%reload_ext autoreload%autoreload 2%matplotlib inline导入的为.text包from fastai.text import *导入,查看样本数据path = untar_data(URLs.IMDB_SAMPLE)path.ls()[WindowsPath('C:/Users/Wither884...原创 2020-03-29 13:23:05 · 651 阅读 · 0 评论 -
3-unet-camvid
unet图像分割导入包,数据集%reload_ext autoreload%autoreload 2%matplotlib inlinefrom fastai.vision import *from fastai.callbacks.hooks import *from fastai.utils.mem import *path = untar_data(URLs.CAMVID)...原创 2020-03-08 14:10:22 · 466 阅读 · 2 评论 -
3-unet-回归
unet回归导入包,数据集%reload_ext autoreload%autoreload 2%matplotlib inlinefrom fastai.vision import *cal是相机的校正数字,必须要使用path = untar_data(URLs.BIWI_HEAD_POSE)cal = np.genfromtxt(path/'01'/'rgb.cal', s...原创 2020-03-08 14:07:01 · 1300 阅读 · 0 评论 -
fastai 3-planet
多标签分类导入包,路径%reload_ext autoreload%autoreload 2%matplotlib inlinefrom fastai.vision import *path = Config.data_path()/'planet'path.mkdir(parents=True, exist_ok=True)pathWindowsPath('C:/Users/W...原创 2020-03-07 15:38:42 · 261 阅读 · 0 评论 -
2-sgd
随机梯度下降导入包,数据%matplotlib inlinefrom fastai.basics import *n=100x = torch.ones(n,2) x[:,0].uniform_(-1.,1)x[:5]tensor([[ 0.9955, 1.0000], [-0.0753, 1.0000], [ 0.4918, 1.0000],...原创 2020-03-06 11:26:12 · 117 阅读 · 0 评论 -
fastai 2-download
运用下载的数据集训练导入包,查看数据from fastai.vision import *path = Path('data/bears')path.ls()[WindowsPath('data/bears/black'), WindowsPath('data/bears/teddy'), WindowsPath('data/bears/white')]classes = [...原创 2020-03-05 18:10:33 · 734 阅读 · 2 评论 -
宠物分辨使用resnet-34迁移学习
#在执行代码时自动载入需要的模块%reload_ext autoreload%autoreload 2%matplotlib inline # 将matplotlib的图表直接嵌入到Notebookfrom fastai.vision import * # 导入包from fastai.metrics import error_rate # 导入评价指标path = untar_...原创 2020-03-04 20:48:27 · 737 阅读 · 2 评论