探索学习率设置技巧以提高Keras中模型性能 | 炼丹技巧
学习率是一个控制每次更新模型权重时响应估计误差而调整模型程度的超参数。学习率选取是一项具有挑战性的工作,学习率设置的非常小可能导致训练过程过长甚至训练进程被卡住,而设置的非常大可能会导致过快学习到次优的权重集合或者训练过程不稳定。
迁移学习
我们使用迁移学习将训练好的机器学习模型应用于不同但相关的任务中。这在深度学习这种使用层级链接的神经网络中非常有效。特别是在计算机视觉任务中,这些网络中的前几层倾向于学习较简单的特征。例如:边缘、梯度特征等。
这是一种在计算机视觉任务中被证实过可以产生更好结果的成熟方法。大多数预训练的模型(Resnet,VGG,Inception等)都是在ImageNet上进行训练的,并且根据实际任务中所用数据与ImageNet数据的相似性,这些预训练得到的权重需要或多或少地改变。
在fast.ai课程中,Jeremy Howard探讨了迁移学习的不同学习率策略以提高模型在速度和准确性方面的表现。
差分学习(Differential learning)
差分学习提出的动机来自这样一个事实,即在对预训练模型进行微调时,更靠近输入的层更可能学习更多的简单特征。因此,我们不想改变这些层的权重,而是更大程度上修改更深层的权重从而适应目标任务/数据。
“差分学习率”是指在网络的不同部分使用不同的学习率,初始层的学习率较低,后几层的学习率逐渐提高。
使用差分学习率的CNN样例
在Keras中实现差分学习率
为了在Keras中实现差异学习,我们需要修改优化器源代码。这里以Adam优化期为例,kears中Adam实现源代码如下:
class Adam(Optimizer): """Adam optimizer. Default parameters follow those provided in the original paper. # Arguments lr: float >= 0. Learning rate. beta_1: float, 0 < beta < 1. Generally close to 1. beta_2: float, 0 < beta < 1. Generally close to 1. epsilon: float >= 0. Fuzz factor. If `None`, defaults to `K.epsilon()`. decay: float >= 0. Learning rate decay over each update. amsgrad: boolean. Whether to apply the AMSGrad variant of this algorithm from the paper "On the Convergence of Adam and Beyond". """ def __init__(self, lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0., amsgrad=False, **kwargs): super(Adam, self).__init__(**kwargs) with K.name_scope(self.__class__.__name__): self.iterations = K.variable(0, dtype='int64', name='iterations') self.lr = K.variable(lr, name='lr') self.beta_1 = K.variable(beta_1, name='beta_1') self.beta_2 = K.variable(beta_2, name='beta_2') self.decay = K.variable(decay, name='decay') if epsilon is None: epsilon = K.epsilon() self.epsilon = epsilon self.initial_decay = decay self.amsgrad = amsgrad @interfaces.legacy_get_updates_support def get_updates(self, loss, params): grads = self.get_gradients(loss, params) self.updates = [K.update_add(self.iterations, 1)] lr = self.lr if self.initial_decay > 0: lr = lr * (1. / (1. + self.decay * K.cast(self.iterations, K.dtype(self.decay)))) t = K.cast(self.iterations, K.floatx()) + 1 lr_t = lr * (K.sqrt(1. - K.pow(self.beta_2, t)) / (1. - K.pow(self.beta_1, t))) ms = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params] vs = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params] if self.amsgrad: vhats = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params] else: vhats = [K.zeros(1) for _ in params] self.weights = [self.iterations] + ms + vs + vhats for p, g, m, v, vhat in zip(params, grads, ms, vs, vhats): m_t = (self.beta_1 * m) + (1. - self.beta_1) * g v_t = (self.beta_2 * v) + (1. - self.beta_2) * K.square(g) if self.amsgrad: vhat_t = K.maximum(vhat, v_t) p_t = p - lr_t * m_t / (K.sqrt(vhat_t) + self.epsilon) self.updates.append(K.update(vhat, vhat_t)) else: p_t = p - lr_t * m_t / (K.sqrt(v_t) + self.epsilon) self.updates.append(K.update(m, m_t)) self.updates.append(K.update(v, v_t)) new_p = p_t # Apply constraints. if getattr(p, 'constraint', None) is not None: new_p = p.constraint(new_p) self.updates.append(K.update(p, new_p)) return self.updates def get_config(self): config = {'lr': float(K.get_value(self.lr)), 'beta_1': float(K.get_value(self.beta_1)), 'beta_2': float(K.get_value(self.beta_2)), 'decay': float(K.get_value(self.decay)), 'epsilon': self.epsilon, 'amsgrad': self.amsgrad} base_config = super(Adam, self).get_config() return dict(list(base_config.items()) + list(config.items()))
"""Adam optimizer.
Default parameters follow those provided in the original paper.
# Arguments
lr: float >= 0. Learning rate.
beta_1: float, 0 < beta < 1. Generally close to 1.
beta_2: float, 0 < beta < 1. Generally close to 1.
epsilon: float >= 0. Fuzz factor. If `None`, defaults to `K.epsilon()`.
decay: float >= 0. Learning rate decay over each update.
amsgrad: boolean. Whether to apply the AMSGrad variant of this
algorithm from the paper "On the Convergence of Adam and
Beyond".
"""
def __init__(self, lr=0.001, beta_1=0.9, beta_2=0.999,
epsilon=None, decay=0., amsgrad=False, **kwargs):
super(Adam, self).__init__(**kwargs)
with K.name_scope(self.__class__.__name__):
self.iterations = K.variable(0, dtype='int64', name='iterations')
self.lr = K.variable(lr, name='lr')
self.beta_1 = K.variable(beta_1, name='beta_1')
self.beta_2 = K.variable(beta_2, name='beta_2')
self.decay = K.variable(decay, name='decay')
if epsilon is None:
epsilon = K.epsilon()
self.epsilon = epsilon
self.initial_decay = decay
self.amsgrad = amsgrad
@interfaces.legacy_get_updates_support
def get_updates(self, loss, params):
grads = self.get_gradients(loss, params)
self.updates = [K.update_add(self.iterations, 1)]
lr = self.lr
if self.initial_decay > 0:
lr = lr * (1. / (1. + self.decay * K.cast(self.iterations,
K.dtype(self.decay))))
t = K.cast(self.iterations, K.floatx()) + 1
lr_t = lr * (K.sqrt(1. - K.pow(self.beta_2, t)) /
(1. - K.pow(self.beta_1, t)))
ms = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params]
vs = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params]
if self.amsgrad:
vhats = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params]
else:
vhats = [K.zeros(1) for _ in params]
self.weights = [self.iterations] + ms + vs + vhats
for p, g, m, v, vhat in zip(params, grads, ms, vs, vhats):
m_t = (self.beta_1 * m) + (1. - self.beta_1) * g
v_t = (self.beta_2 * v) + (1. - self.beta_2) * K.square(g)
if self.amsgrad:
vhat_t = K.maximum(vhat, v_t)
p_t = p - lr_t * m_t / (K.sqrt(vhat_t) + self.epsilon)
self.updates.append(K.update(vhat, vhat_t))
else:
p_t = p - lr_t * m_t / (K.sqrt(v_t) + self.epsilon)
self.updates.append(K.update(m, m_t))
self.updates.append(K.update(v, v_t))
new_p = p_t
# Apply constraints.
if getattr(p, 'constraint', None) is not None:
new_p = p.constraint(new_p)
self.updates.append(K.update(p, new_p))
return self.updates
def get_config(self):
config = {'lr': float(K.get_value(self.lr)),
'beta_1': float(K.get_value(self.beta_1)),
'beta_2': float(K.get_value(self.beta_2)),
'decay': float(K.get_value(self.decay)),
'epsilon': self.epsilon,
'amsgrad': self.amsgrad}
base_config = super(Adam, self).get_config()
return dict(list(base_config.items()) + list(config.items()))
我们修改上面的源代码以包含以下内容:
拆分层:split_1和split_2是分别进行第一次和第二次拆分的层名称。
修改参数lr以应用学习率表 - 应用3个学习率表(因为差分学习结构中分为3个不同的阶段)
在更新每层的学习率时,初始代码遍历所有层并为其分配学习速率。我们改变这一点,以便为不同的层设置不同的学习率。
class Adam_dlr(optimizers.Optimizer): """Adam optimizer. Default parameters follow those provided in the original paper. # Arguments split_1: split layer 1 split_2: split layer 2 lr: float >= 0. List of Learning rates. [Early layers, Middle layers, Final Layers] beta_1: float, 0 < beta < 1. Generally close to 1. beta_2: float, 0 < beta < 1. Generally close to 1. epsilon: float >= 0. Fuzz factor. If `None`, defaults to `K.epsilon()`. decay: float >= 0. Learning rate decay over each update. amsgrad: boolean. Whether to apply the AMSGrad variant of this algorithm from the paper "On the Convergence of Adam and Beyond". """ def __init__(self, split_1, split_2, lr=[1e-7, 1e-4, 1e-2], beta_1=0.9, beta_2=0.999, epsilon=None, decay=0., amsgrad=False, **kwargs): super(Adam_dlr, self).__init__(**kwargs) with K.name_scope(self.__class__.__name__): self.iterations = K.variable(0, dtype='int64', name='iterations') self.lr = K.variable(lr, name='lr') self.beta_1 = K.variable(beta_1, name='beta_1') self.beta_2 = K.variable(beta_2, name='beta_2') self.decay = K.variable(decay, name='decay') # Extracting name of the split layers self.split_1 = split_1.weights[0].name self.split_2 = split_2.weights[0].name if epsilon is None: epsilon = K.epsilon() self.epsilon = epsilon self.initial_decay = decay self.amsgrad = amsgrad @keras.optimizers.interfaces.legacy_get_updates_support def get_updates(self, loss, params): grads = self.get_gradients(loss, params) self.updates = [K.update_add(self.iterations, 1)] lr = self.lr if self.initial_decay > 0: lr = lr * (1. / (1. + self.decay * K.cast(self.iterations, K.dtype(self.decay)))) t = K.cast(self.iterations, K.floatx()) + 1 lr_t = lr * (K.sqrt(1. - K.pow(self.beta_2, t)) / (1. - K.pow(self.beta_1, t))) ms = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params] vs = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params] if self.amsgrad: vhats = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params] else: vhats = [K.zeros(1) for _ in params] self.weights = [self.iterations] + ms + vs + vhats # Setting lr of the initial layers lr_grp = lr_t[0] for p, g, m, v, vhat in zip(params, grads, ms, vs, vhats): # Updating lr when the split layer is encountered if p.name == self.split_1: lr_grp = lr_t[1] if p.name == self.split_2: lr_grp = lr_t[2] m_t = (self.beta_1 * m) + (1. - self.beta_1) * g v_t = (self.beta_2 * v) + (1. - self.beta_2) * K.square(g) if self.amsgrad: vhat_t = K.maximum(vhat, v_t) p_t = p - lr_grp * m_t / (K.sqrt(vhat_t) + self.epsilon) # 使用更新后的学习率 self.updates.append(K.update(vhat, vhat_t)) else: p_t = p - lr_grp * m_t / (K.sqrt(v_t) + self.epsilon) self.updates.append(K.update(m, m_t)) self.updates.append(K.update(v, v_t)) new_p = p_t # Apply constraints. if getattr(p, 'constraint', None) is not None: new_p = p.constraint(new_p) self.updates.append(K.update(p, new_p)) return self.updates def get_config(self):# print('Optimizer LR: ', K.get_value(self.lr))# print() config = { 'lr': (K.get_value(self.lr)), 'beta_1': float(K.get_value(self.beta_1)), 'beta_2': float(K.get_value(self.beta_2)), 'decay': float(K.get_value(self.decay)), 'epsilon': self.epsilon, 'amsgrad': self.amsgrad} base_config = super(Adam_dlr, self).get_config() return dict(list(base_config.items()) + list(config.items()))
"""Adam optimizer.
Default parameters follow those provided in the original paper.
# Arguments
split_1: split layer 1
split_2: split layer 2
lr: float >= 0. List of Learning rates. [Early layers, Middle layers, Final Layers]
beta_1: float, 0 < beta < 1. Generally close to 1.
beta_2: float, 0 < beta < 1. Generally close to 1.
epsilon: float >= 0. Fuzz factor. If `None`, defaults to `K.epsilon()`.
decay: float >= 0. Learning rate decay over each update.
amsgrad: boolean. Whether to apply the AMSGrad variant of this
algorithm from the paper "On the Convergence of Adam and
Beyond".
"""
def __init__(self, split_1, split_2, lr=[1e-7, 1e-4, 1e-2], beta_1=0.9, beta_2=0.999,
epsilon=None, decay=0., amsgrad=False, **kwargs):
super(Adam_dlr, self).__init__(**kwargs)
with K.name_scope(self.__class__.__name__):
self.iterations = K.variable(0, dtype='int64', name='iterations')
self.lr = K.variable(lr, name='lr')
self.beta_1 = K.variable(beta_1, name='beta_1')
self.beta_2 = K.variable(beta_2, name='beta_2')
self.decay = K.variable(decay, name='decay')
# Extracting name of the split layers
self.split_1 = split_1.weights[0].name
self.split_2 = split_2.weights[0].name
if epsilon is None:
epsilon = K.epsilon()
self.epsilon = epsilon
self.initial_decay = decay
self.amsgrad = amsgrad
@keras.optimizers.interfaces.legacy_get_updates_support
def get_updates(self, loss, params):
grads = self.get_gradients(loss, params)
self.updates = [K.update_add(self.iterations, 1)]
lr = self.lr
if self.initial_decay > 0:
lr = lr * (1. / (1. + self.decay * K.cast(self.iterations,
K.dtype(self.decay))))
t = K.cast(self.iterations, K.floatx()) + 1
lr_t = lr * (K.sqrt(1. - K.pow(self.beta_2, t)) /
(1. - K.pow(self.beta_1, t)))
ms = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params]
vs = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params]
if self.amsgrad:
vhats = [K.zeros(K.int_shape(p), dtype=K.dtype(p)) for p in params]
else:
vhats = [K.zeros(1) for _ in params]
self.weights = [self.iterations] + ms + vs + vhats
# Setting lr of the initial layers
lr_grp = lr_t[0]
for p, g, m, v, vhat in zip(params, grads, ms, vs, vhats):
# Updating lr when the split layer is encountered
if p.name == self.split_1:
lr_grp = lr_t[1]
if p.name == self.split_2:
lr_grp = lr_t[2]
m_t = (self.beta_1 * m) + (1. - self.beta_1) * g
v_t = (self.beta_2 * v) + (1. - self.beta_2) * K.square(g)
if self.amsgrad:
vhat_t = K.maximum(vhat, v_t)
p_t = p - lr_grp * m_t / (K.sqrt(vhat_t) + self.epsilon) # 使用更新后的学习率
self.updates.append(K.update(vhat, vhat_t))
else:
p_t = p - lr_grp * m_t / (K.sqrt(v_t) + self.epsilon)
self.updates.append(K.update(m, m_t))
self.updates.append(K.update(v, v_t))
new_p = p_t
# Apply constraints.
if getattr(p, 'constraint', None) is not None:
new_p = p.constraint(new_p)
self.updates.append(K.update(p, new_p))
return self.updates
def get_config(self):
# print('Optimizer LR: ', K.get_value(self.lr))
# print()
config = {
'lr': (K.get_value(self.lr)),
'beta_1': float(K.get_value(self.beta_1)),
'beta_2': float(K.get_value(self.beta_2)),
'decay': float(K.get_value(self.decay)),
'epsilon': self.epsilon,
'amsgrad': self.amsgrad}
base_config = super(Adam_dlr, self).get_config()
return dict(list(base_config.items()) + list(config.items()))
具有热启动的随机梯度下降(SGDR)
理想情况下,对于每一批的随机梯度下降(SGD)网络应越来越接近损失的全局最小值。因此,随着训练的进行降低学习速率是有意义的,这使得算法不会超过错过并尽可能接近最小值。通过余弦退火,我们可以使用余弦函数来降低学习率。在前200次迭代内逐步调低学习率
SGDR是学习速率退火的最新变体,由Loshchilov&Hutter在他们的论文“Sgdr:Stochastic Gradient Descent with Warm Restarts”(https://arxiv.org/abs/1608.03983)中引入。在这种技术中,我们不时的进行学习率突增。下面是使用余弦退火重置三个均匀间隔的学习速率的示例。
每迭代100次后将学习率调到最大
突然提高学习率背后的基本原理是:在这样做的情况下,梯度下降不会卡在任何局部最小值,并且可能以其向全局最小值的方式“跳出”局部最小值。
每次学习率下降到最小点(上图中每100次迭代),我们称之为循环。作者还建议通过一些常数因子使每个下一周期比前一周期更长。
每个周期需要两倍于上一个周期大小
在Keras中实现SGDR
使用Keras Callbacks回调函数,我们可以实现以遵循特定公式的方式更新学习率。具体实现可以参考周期性学习率官方实现方法这个Git(https://github.com/bckenstler/CLR)。
class LR_Updater(Callback): '''This callback is utilized to log learning rates every iteration (batch cycle) it is not meant to be directly used as a callback but extended by other callbacks ie. LR_Cycle ''' def __init__(self, iterations): ''' iterations = dataset size / batch size epochs = pass through full training dataset ''' self.epoch_iterations = iterations self.trn_iterations = 0. self.history = {} def on_train_begin(self, logs={}): self.trn_iterations = 0. logs = logs or {} def on_batch_end(self, batch, logs=None): logs = logs or {} self.trn_iterations += 1 K.set_value(self.model.optimizer.lr, self.setRate()) self.history.setdefault('lr', []).append(K.get_value(self.model.optimizer.lr)) self.history.setdefault('iterations', []).append(self.trn_iterations) for k, v in logs.items(): self.history.setdefault(k, []).append(v) def plot_lr(self): plt.xlabel("iterations") plt.ylabel("learning rate") plt.plot(self.history['iterations'], self.history['lr']) def plot(self, n_skip=10): plt.xlabel("learning rate (log scale)") plt.ylabel("loss") plt.plot(self.history['lr'], self.history['loss']) plt.xscale('log')class LR_Cycle(LR_Updater): '''This callback is utilized to implement cyclical learning rates it is based on this pytorch implementation https://github.com/fastai/fastai/blob/master/fastai and adopted from this keras implementation https://github.com/bckenstler/CLR ''' def __init__(self, iterations, cycle_mult = 1): ''' iterations = dataset size / batch size iterations = number of iterations in one annealing cycle cycle_mult = used to increase the cycle length cycle_mult times after every cycle for example: cycle_mult = 2 doubles the length of the cycle at the end of each cy$ ''' self.min_lr = 0 self.cycle_mult = cycle_mult self.cycle_iterations = 0. super().__init__(iterations) def setRate(self): self.cycle_iterations += 1 if self.cycle_iterations == self.epoch_iterations: self.cycle_iterations = 0. self.epoch_iterations *= self.cycle_mult cos_out = np.cos(np.pi*(self.cycle_iterations)/self.epoch_iterations) + 1 return self.max_lr / 2 * cos_out def on_train_begin(self, logs={}): super().on_train_begin(logs={}) #changed to {} to fix plots after going from 1 to mult. lr self.cycle_iterations = 0. self.max_lr = K.get_value(self.model.optimizer.lr)
'''This callback is utilized to log learning rates every iteration (batch cycle)
it is not meant to be directly used as a callback but extended by other callbacks
ie. LR_Cycle
'''
def __init__(self, iterations):
'''
iterations = dataset size / batch size
epochs = pass through full training dataset
'''
self.epoch_iterations = iterations
self.trn_iterations = 0.
self.history = {}
def on_train_begin(self, logs={}):
self.trn_iterations = 0.
logs = logs or {}
def on_batch_end(self, batch, logs=None):
logs = logs or {}
self.trn_iterations += 1
K.set_value(self.model.optimizer.lr, self.setRate())
self.history.setdefault('lr', []).append(K.get_value(self.model.optimizer.lr))
self.history.setdefault('iterations', []).append(self.trn_iterations)
for k, v in logs.items():
self.history.setdefault(k, []).append(v)
def plot_lr(self):
plt.xlabel("iterations")
plt.ylabel("learning rate")
plt.plot(self.history['iterations'], self.history['lr'])
def plot(self, n_skip=10):
plt.xlabel("learning rate (log scale)")
plt.ylabel("loss")
plt.plot(self.history['lr'], self.history['loss'])
plt.xscale('log')
class LR_Cycle(LR_Updater):
'''This callback is utilized to implement cyclical learning rates
it is based on this pytorch implementation https://github.com/fastai/fastai/blob/master/fastai
and adopted from this keras implementation https://github.com/bckenstler/CLR
'''
def __init__(self, iterations, cycle_mult = 1):
'''
iterations = dataset size / batch size
iterations = number of iterations in one annealing cycle
cycle_mult = used to increase the cycle length cycle_mult times after every cycle
for example: cycle_mult = 2 doubles the length of the cycle at the end of each cy$
'''
self.min_lr = 0
self.cycle_mult = cycle_mult
self.cycle_iterations = 0.
super().__init__(iterations)
def setRate(self):
self.cycle_iterations += 1
if self.cycle_iterations == self.epoch_iterations:
self.cycle_iterations = 0.
self.epoch_iterations *= self.cycle_mult
cos_out = np.cos(np.pi*(self.cycle_iterations)/self.epoch_iterations) + 1
return self.max_lr / 2 * cos_out
def on_train_begin(self, logs={}):
super().on_train_begin(logs={}) #changed to {} to fix plots after going from 1 to mult. lr
self.cycle_iterations = 0.
self.max_lr = K.get_value(self.model.optimizer.lr)
可以查看github存储库以获取差分学习和SGDR的完整代码。它还包含一个测试文件,用于在样本数据集上使用这些技术。
欢迎关注磐创博客资源汇总站:
http://docs.panchuang.net/
欢迎关注PyTorch官方中文教程站:
http://pytorch.panchuang.net/
探索学习率设置技巧以提高Keras中模型性能 | 炼丹技巧的更多相关文章
- 提高MySQL效率与性能的技巧
为查询缓存优化你的查询 大多数的MySQL服务器都开启了查询缓存.这是提高性最有效的方法之一,而且这是被MySQL的数据库引擎处理的.当有很多相同的查询被执行了多次的时候,这些查询结果会被放到一个缓存 ...
- keras 中模型的保存
参考:https://www.cnblogs.com/weiyinfu/p/9788179.html#0 1.model.summary() 这个函数会打印模型结构,但是仅仅是打印到控制台,不能保存 ...
- php中一些提高性能的技巧
php中一些提高性能的技巧 tags:php性能 提高性能 php中的@ php的静态 引言:php作为一种脚本语言,本身的性能上肯定是不如c++或者java的.拥有简单易学的特性的同时,性能提升的空 ...
- jQuery中的100个技巧
1.当document文档就绪时执行JavaScript代码. 我们为什么使用jQuery库呢?原因之一就在于我们可以使jQuery代码在各种不同的浏览器和存在bug的浏览器上完美运行. < ...
- Visual Studio 2015中的常用调试技巧分享
.NET 技术交流群:337901356 欢迎您的加入! 为什么要学习调试? 调试(Debug)是作为一个程序员必须要学会的东西,学会调试可以极大的提高开发效率,排错时间,很多人不喜欢调试,但我认为这 ...
- asp.net提高程序性能的技巧(一)
[摘 要] 我只是提供我几个我认为有助于提高写高性能的asp.net应用程序的技巧,本文提到的提高asp.net性能的技巧只是一个起步,更多的信息请参考<Improving ASP.NET Pe ...
- Python机器学习笔记:深入学习Keras中Sequential模型及方法
Sequential 序贯模型 序贯模型是函数式模型的简略版,为最简单的线性.从头到尾的结构顺序,不分叉,是多个网络层的线性堆叠. Keras实现了很多层,包括core核心层,Convolution卷 ...
- jQuery中的100个技巧(译)
1.当document文档就绪时执行JavaScript代码. 我们为什么使用jQuery库呢?原因之一就在于我们可以使jQuery代码在各种不同的浏览器和存在bug的浏览器上完美运行. <sc ...
- 25条提高iOS App性能的技巧和诀窍
25条提高iOS App性能的技巧和诀窍 当我们开发iOS应用时,好的性能对我们的App来说是很重要的.你的用户也希望如此,但是如果你的app表现的反应迟钝或者很慢也会伤害到你的审核. 然而,由于IO ...
随机推荐
- Codeforces Round #612 (Div. 2)C. Garland
第四次写题解,请多指教! http://codeforces.com/contest/1287/problem/C题目链接 题目大意是有一个数字串挂有1-n n个数字,现在上面缺失了一些数字,让你找出 ...
- 【原创】面试官问我G1回收器怎么知道你是什么时候的垃圾?
这是why技术的第36篇原创文章 上面的图片是我上周末在家拍的.以后的文章里面我的第一张配图都用自己随手拍下的照片吧.分享生活,分享技术,哈哈. 阳台上的花开了,成都的春天快来了,疫情也应该快要过去了 ...
- C++走向远洋——61(项目一、排序函数模板)
*/ * Copyright (c) 2016,烟台大学计算机与控制工程学院 * All rights reserved. * 文件名:text.cpp * 作者:常轩 * 微信公众号:Worldhe ...
- git指令-版本回退
git指令-版本回退 回顾: 1. 修改文件 2. 添加到暂存区并提交 回顾对readme共三次修改: 1. 版本1:wrote a readme file Git is a version cont ...
- webpack里的externals
最近在用webpack做一些是sdk相关的东西,有几个概念总结一下: 1.library要做sdk,一定要做的一个配置,用于说明最终的SDK暴露给调用者的一个名称例如:library: 'HelloJ ...
- Slog64_项目上线之ArthurSlog个人网站上线3
ArthurSlog SLog-64 Year·1 Guangzhou·China September 9th 2018 ArthurSlog Page GitHub NPM Package Page ...
- IIS6.0文件解析漏洞和短文件名漏洞复现
一.IIS6.0文件解析漏洞 1.ASP一句话木马的准备 新建木马文件“muma.txt”,将“我asp是一句话木马:<%eval request("asp")%>”写 ...
- 运维介绍以及虚拟机,centos安装
运维的职责 1.企业的数据安全 2.网站7*24小时运行 3.企业服务好 服务器 服务器尺寸: 高度为单位:U(unit)1U=1.75英寸=4.45cm 服务器的分类: 机架式服务器 刀片式服务器 ...
- 【转】Maven详细
Maven maven 中央仓库 网站 https://mvnrepository.com/ 全世界 发布到Maven仓库 供用类着使用 maven 本质上下载工具和构建工具 下载工具 迅雷 只能下载 ...
- Java原来还可以这么学:如何搞定面试中必考的集合类
原创声明 本文作者:黄小斜 转载请务必在文章开头注明出处和作者. 系列文章介绍 本文是<五分钟学Java>系列文章的一篇 本系列文章主要围绕Java程序员必须掌握的核心技能,结合我个人三年 ...