这里写目录标题
- assignment1:
- pytorch
- assignment2:
- understand Neural Networks and how they are arranged in layered architectures
- understand and be able to implement (vectorized) **backpropagation**
- implement various **update rules** used to optimize Neural Networks
- implement **batch normalization** for training deep networks implement **dropout** to regularize networks
- effectively **cross-validate** and find the best hyperparameters for Neural Network architecture
- understand the architecture of **Convolutional Neural Networks** and train gain experience with training these models on data
- BN
- 遇到的bug以及问题
- 收获
- 总结训练一个网络的技巧
- 神经网络一层的结构以及相应位置顺序
assignment1:
1.训练预测
2.明白训练 验证测试 同时在 验证上调整超参数
3.写高效的numpy向量
4.实现knn
5.svm
6.softmax
7.两层神经网络
learning_rate设置太大了就出问题了。loss直接变成0
隐藏层就是 num_class
两层神经网络的loss是什么?use softmax loss
8.利用除了像素之外的特征比如颜色直方图 梯度直方图来对性能进行改进
HOG
对于hog特征向量每个数值理解
代码中hog_feature怎么是一个144的向量?
944 =144
可视化hog
1.一维?
2.怎么从这个一维向量可视化出来?
后面两个非常清晰说明了功能,明白是这两对比就行了
import 与 _ init_.py
module 包 模块概念与 init
import 和 from … import 模块的变量、方法引用差异
plt.imshow()norm方法 以及两种需要astype情况,其他自动norm
plt.legend()?
astype有做正则化嘛?
比如10-15
250-265 是直接截断,还是250变成0265变成255?
大于255变成0,小数部分直接截断
*args
1.函数加不加括号的问题
2.TypeError: not all arguments converted during string formatting
3.np.vstack
如何计算svm梯度?svm梯度推导
SVM损失函数及梯度矩阵的计算
lambda用法
python 广播机制
np.max 跟 np.maximum
这里是 dw +=
xrange range区别
9.jupyter使用
esc + L显示行号
两次i可以中断单元格运行
jupyter显示全部结果
数字键:将单元格变为标题类型,数字越大标题越小
L: 显示代码的行号
command + d删除一行
numpy 语法
多维数组np.mean()
可以理解为压缩到剩下的那个axis上 比如3,100,100,如果axis =(1,2)输出是三个数字
np.pad
python矩阵点除
python 字典setdefault
python 无穷大 float(‘inf’)
在python 3.5以后,@是一个操作符,表示矩阵-向量乘法
Python将str转为int型或float型
np.floor
代码缩进 command + [
*args,**kwargs
python中’ '.JOIN()的使用
/是浮点除法,//是整数除法
f-string格式化输出
也可以这样:
pytorch
nn.sequential 也可以自定义!!! 类式函数
model.eval()
转置原因
[pyotrch]nn.Conv2d中groups参数的理解
每一批是(64,3,h,w)然后着64是如何采样的呢 是通过sampler规定的方式得到的
dataset dataloader tutorial
TORCHVISION.DATASETS
totensor
MSELOSS
定义torch.autograd.Function的子类,自己定义某些操作,且定义反向求导函数
ctx?self?
为啥要item:
loss.item()
assignment2:
understand Neural Networks and how they are arranged in layered architectures
如何理解 backward
understand and be able to implement (vectorized) backpropagation
implement various update rules used to optimize Neural Networks
implement batch normalization for training deep networks implement dropout to regularize networks
effectively cross-validate and find the best hyperparameters for Neural Network architecture
understand the architecture of Convolutional Neural Networks and train gain experience with training these models on data
dic.pop()里面两个参数意义,当没穿入相印参数,则返回第二个参数
getattr()
.pkl是什么文件
BN
遇到的bug以及问题
expected scalar type Long but found Float
用cifar 数据没问题
1…double() .float(). 分别是64 根32 这里需要32!long 是int64
2. 这个不是inplace操作!
train test predict?
1.bn中train跟test区别:test的时候用的均值方差不是来自于X_test,也不需要更新参数了
2. Ln就没有区别test跟train
drop中train 跟test区别
drop 的时候反向传播怎么做的,必须要有随机数种子记录吧,其实不需要?记录mask就行?
dropout 有一个缩放 是为了让数据的期望保持一致,改进版就是吧这个缩放从预测放到训练中来
BN越大越好吗
model 跟 solver 关系:
model 里面已经有loss了 如何还可以利用utilis afiine_relu_forward之类的呢?就是在loss里面用的!
反向传播的时候记得均方差 var 也可以对x求导的!
手推bn
BN如何反向传播,并且网络测试的时候BN层数据如何保留使用
BN原理代码理解
这里cache是什么,初值就是 dx**2? 肯定不是之前的字典
牛顿迭代法:但是我的直觉就是从数学上没法证明不断的迭代之后能收敛:即使自己尝试了一些例子,最终看到这篇文章!!如何通俗易懂地讲解牛顿迭代法?
才发现我的直觉是对的,牛顿迭代本来就不是全都适用当然也就没法用代数证明,但是很多情况下牛顿迭代是能收敛的。
但是文章有个地方有问题 :
我也是推导得到这个,但是真正的是这样:
两个都挺合理差别在哪里?
一个求根一个求极值
重大发现
weight_scale原来这么重要
以及在训练上做到过拟合这个技巧!!
弱智问题。test怎么是返回scores,解决:没有标签没有loss,求预测最大位置就行了
解决:
先考虑mode是train情况
暂时先不管,先继续看下去,先了解多层网络这么求backward
Batch Norm、Layer Norm、Instance Norm、Group Norm、Switchable Norm总结
收获
max
python 格式化输出
如何利用之前bn函数,注意bn不沿着d正则化的,正如cov中c通道也不进行正则化。
sgd更新以及超参优化方法以及训练神经网络流程
实在不知道如何提升就使用emsemble!
优化:
1.利用梯度信息
2.改进学习率
3.增加了动量
Open the file cs231n/optim.py
and read the documentation at the top of the file to make sure you understand the API.
optim_config 肯定不只是lr,还有动量etc.
总结训练一个网络的技巧
1.训练过拟合
2.optim
3.lr ws
神经网络一层的结构以及相应位置顺序
1.bn -relu - drop
pool