fastai notebook - loading data and training
soruce
Loading the data with a factory method
from fastai.vision.all import *
path = untar_data(URLs.IMAGENETTE_160)
dls = ImageDataLoaders.from_folder(path, valid='val',
item_tfms=RandomResizedCrop(128, min_scale=0.35), batch_tfms=Normalize.from_stats(*imagenet_stats))
dls.show_batch()
Loading the data with the data block API
fnames = ...
fastai notebook - datablock
soruce
Building a DataBlock from scratch
from fastai.data.all import *
from fastai.vision.all import *
path = untar_data(URLs.PETS)
fnames = get_image_files(path/"images")
dblock = DataBlock()
dsets = dblock.datasets(fnames)
dsets.train[0]
>
(Path('/home/jhoward/.fastai/data/oxford-iiit-pet/images/Birman_82.jpg'),
Path('/home/jhoward/....
fastai notebook - custom transform
soruce
Text transfer learning
from fastai.text.all import *
from fastai.vision.all import *
# !pip install albumentations
source = untar_data(URLs.PETS)
items = get_image_files(source/"images")
class AlbumentationsTransform(Transform):
def __init__(self, aug): self.aug = aug
def encodes(self, img: PILImage):
aug_img = self.aug...
fastai notebook - Collaborative
soruce
Text transfer learning
from fastai.tabular.all import *
from fastai.collab import *
path = untar_data(URLs.ML_100k)
# The main table is in u.data. Since it’s not a proper csv, we have to specify a few things while opening it: the tab delimiter, the columns we want to keep and their names.
ratings = pd.read_csv(path/'u.data', delimiter=...
pathlib
soruce
pathlib
>>> from pathlib import *
>>> p =Path(".")
>>> [x for x in p.iterdir() if x.is_dir()]
[PosixPath('test1'), PosixPath('test2')]
# glob
>>> list(p.glob('**/*.py'))
[PosixPath('test.py'), PosixPath('test2/p1.py'), PosixPath('test2/test21/p3.py'), PosixPath('test2/test21/p2.py')]
>>> lis...
shell [ 和 ]] 的区别
soruce
shell [ 和 ]] 的区别
区别一
[ ]是符合POSIX标准的测试语句,兼容性更强,几乎可以运行在所有的Shell解释器中
[[ ]]仅可运行在特定的几个Shell解释器中(如Bash等)
区别二:<和>在[[ ]]中用作排序,而[ ]不支持
区别三:[ ]中使用-a和-o表示逻辑与和逻辑或,[[ ]]使用&&和||来表示
[[ ]]不支持-a
区别四:在[ ]中==是字符匹配,在[[ ]]中是模式匹配
[[ "$name" == c* ]] && echo Y || echo N
# name=ccc
# [[ "$name" == c* ]] && echo Y || echo N
Y
# [...
tcpdump
soruce
tcpdump filter
https://www.wains.be/pub/networking/tcpdump_advanced_filters.txt
tcpdump advanced filters
========================
Sebastien Wains <sebastien -the at sign- wains -dot- be>
http://www.wains.be
###################################################################
This page is not updated anymore and contains mistakes ...
rsyslog
doc1
doc2
rsyslog
man rsyslog.conf
rsyslog 作为标准的syslog守护进程,预装在了大多数的Linux发行版中。在客户端/服务器架构的配置下,rsyslog同时扮演了两种角色:
1.作为一个syslog服务器,rsyslog可以收集来自其他设施的日志信息;
2.作为一个syslog客户端,rsyslog可以将其内部的日志信息传输到远程的syslog服务器。
当通过syslog机制来收集日志时,有3个必须要考虑到的重要事情:
1、设施层级: 监听何种类型的进程
2、严重性 (优先) 级别: 收集何种级别的日志消息
3、目标: 发送或记录日志消息到何处
现在我们更加深入地了解一下配置是如何定义的
设施层级定义了一种用来对内部系统进程进行...
共计 106 篇文章,14 页。