【网课笔记】Fast.ai-2019 || Week1&2 - Image Classification & Data cleaning and production

2019/6/23 - week1 【Image Classification】
*

Forum Lesson1


2019/6/25 - week2【Data cleaning and production】
*

Important topics on the forums:
FAQ, resources, and official course updates!

配置环境时,如果遇到难易解决的问题,全部推倒,按照教程重来可能是最好的选择!

成果展示

1、Deep Convolutional neural network and data augmentation for environmental sound classification 论文复现,提高到80.5%
turning sounds into pictures.

2、识别卫星地图:不同国家!链接

学习建议

1、知识不断反复,CV和NLP会相互间隔反复,不断深入!
it`s much better for learning if you see things multiple times!
2. you are not expected to remember everything or understand everything yet. So just push on! 不要停在第一课,知道你能完全懂,往下走!
3. most of the people who have done the course successfully watch the videos at least 3 times. 至少三遍!
在这里插入图片描述


part I : Creating your own dataset from Google Images

at the beginning of the Jupyter notebook, there is a link to a Tutorial!

1. download URL in a text file(use javascript)
2. download images on the server

下载时是在多线程下进行的,如果出现问题,尝试用下一行中注释掉的另一种版本。
同时删除非照片的数据(Google image会莫名其妙下载一些非图片数据)

3. 随机划分train 和 valid,训练!

注意设置seed为固定值,这样每次划分的validation set都是固定的,这样便于你调参,否则结果的变化有可能是验证集改变导致的

4. 清洗数据

(使用一个内嵌的程序FileDeleter)查看模型标记错误的图片,决定是否删除它
??FileDeleter可以查看Python3源码
Google:ipywidgets,可以查看更多关于在notebook内如何写GUI的文档教程!

然而,大多数情况下,清洗数据对结果提升不大,模型对一定的噪音有很好的泛化能力,除非你的数据not randomly noisy but biased noisy

5. Putting your model in production

学习所用的工具包和python多线程

6. 调参
  • valid_loss 特别大:leaning rate 太大
  • train_loss比valid_loss还大:underfitting,训练不够,leaning_rate太小或epochs太少;如果还underfitting,you need decrease regularization
  • error_rate先变小又变大:overfitting
  • unbalanced data set: it works! try it!
7. 答疑:learning_rate的设置

For now, all you need to remember is that your basic approach looks like this:

  • 阶段1:unfreezing前,learn.fit_one_cycle(4, 3e-3), 训练
    • Some number of epochs, I often pick 4
    • Some learning rate which defaults to 3e-3.(We found 3e-3 is a really good default)
      或者用lr_find(),选择最陡的地方!
  • 阶段2: unfreeze it.
    • slice()中 part2 一般设置为阶段1中learning_rate的1/10
    • slice()中 part1 则根据lr_find():
      情况1:取图像最陡的地方!
      情况2:取开始变坏(最低点)的1/10处或更靠前!
      learn.fit_one_cycle(4, 3e-3)
      learn.unfreeze()
      learn.fit_one_cycle(4, slice(xxx, 3e-4))
      
    这种训练称为:discriminative learning rates,也就是对于不同layers设置不同的学习率,层数越往后学习率学大,所谓slice(),传入的就是最大最小值,fastai会自动切分,赋值给不同的layers。(也不是每层都不一样,而是几层看成一块,赋一个学习率,还要细看文档!)

推荐课程:可汗学院 (学习任何遗忘的数学课程)


part II : SGD
  • tensor: tensor means array with regular shape! (规整的多维数组)
    我们不用dimension,而是用rank(how many dimensions/axes are there)或者axis
    例如图片就是rank=3的tensor

  • pytorch中函数结尾带下划线’_’: 表示用函数的返回值替换调用这个函数的变量!

  • SGD训练过程 动画
    11行代码

  • 模型(model): 就和一次函数、二次函数一样,是一种architecture,比如renet34就和一次函数一样,可以当做是一种函数结构,不会占任何内存,只是告诉你这些数据是什么结构,其几百万个神经网络参数就和一次函数的两个参数(斜率k和截距b)一样,用梯度下降算法一步步训练(猜测)得到;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值