Commonly used Modules in deep learning
ExifTool
ExifTool Command-Line Examples
Pillow
Pillow documentation
PIL.Image.open
PIL.Image.save
PIL.Image.convert
12conda install pillowimport PIL
open images in a folder
12345678910111213141516171819202122232425262728import osimport globfrom PIL import Imageimport matplotlib.pyplot as pltpath2image = r"path/to/images"path2mask = r"path/to/masks"image_paths = glob.glob(os.path.join(path2image, '*.png'))image_names = [os.path.basename(result_path) for result_path i ...
Pytorch Lightning
Learning material
Youtube video tutorials
PyTorch Lightning Tutorials | Aladdin Persson{target="_blank"}
The official document
lightning ai docs{target="_blank"}
The official document > Level Up
Level Up: Basic skills{target="_blank"}
Level Up: Intermediate skills{target="_blank"}
Level Up: Advanced skills{target="_blank"}
Level Up: Expert skills{target="_blank"}
LightningModule
Lightning Module{target="_blank"}
Log ...
openmmlab
Run Swin Transformer for Semantic Segmentation on Colab
Swin-Transformer-Semantic-Segmentation | GitHub
mmsegmentation | GitHub
mmsegmentation/…/get_started.md#install-on-google-colab | GitHub
get_started/installation | mmcv
Swin Transformer算法环境配置(语义分割)| ZhiHu
MMSegmentation_Tutorial.ipynb | Colab
install mmcv and mmsegmentation
12!pip install openmim!mim install mmcv
Use mmcv, not mmcv-full, to install the full version, because it took me so long that I canceled the installation.
MMCV contains ...
TransUNet
prepare synapse dataset
Image Sequentialization
Input xxx are image of size 224x224
reshape the input x∈RH×W×Cx \in \R^{H\times W\times C}x∈RH×W×C into a sequence of flattened 2D patches {xp1,xp2,⋯ ,xpN}∈R1×P2C,N=HWCP2C\{x_p^1, x_p^2, \cdots, x_p^N\}\in\R^{1\times P^2C},N=\frac{HWC}{P^2C}{xp1,xp2,⋯,xpN}∈R1×P2C,N=P2CHWC, where P denotes Patch_size and each patch is of size P×PP\times PP×P.
Patch Embedding:
z0=[xp1Exp2E⋮xpNE]+Eposz_0 = \begin{bmatrix}x_p^1E \\ x_p^2E \\ \vdots \\ x_p^NE\end{bm ...
网络
公网ip和私有ip
【硬件科普】IP地址是什么东西?IPV6和IPV4有什么区别?公网IP和私有IP又是什么?
【闲谈公网IP地址,100%判断宽带是否公网IP的方法,公网IP有什么好处,如何免费获得公网IP,一分钟安装TightVNC服务器,随时随地通过手机批量远控电脑】
【网络】半小时看懂<计算机网络>
万网获取本地公网IP地址
cmd 中 ipconfig 查出的 IPv4 地址为私有 IP
123456C:\Users\xiaophai>ipconfig...无线局域网适配器 WLAN: ... IPv4 地址 . . . . . . . . . . . . : 192.168.1.102 ...
使用 tracert 命令追踪万网获取本地公网IP地址中查询到的IP,检验是否为公网IP。
若返货 请求超时 说明不是公网IP,否则如下所示则为公网IP:
1234567891011C:\Users\xiaophai>tracert 36.5.17.20通过最多 30 个跃点跟踪到 36.5.17.20 的路由 1 13 ms 1 ...
Google Colab
Google Colab
google colab
Quick Primer on Colab Jupyter
Start
Firstly, you need to have a google drive. (Of course you also have to get a google account before this.)
New a folder as your work space in your google drive.
If you already have a .ipynb file, you can double click it directly (or right click it > Open with > Google Colaboratory) to open this .ipynb file with Colab.
If you want to new a .ipynb file, just right click blank space > More > Google Colaboratory, then google ...
Semantic Segmentation
Self-Supervised learning
Self-Supervised Representation Learning | Lil’Log
self-supervised task is also known as pretext task
Broadly speaking, all the generative models can be considered as self-supervised, but with different goals: Generative models focus on creating diverse and realistic images, while self-supervised representation learning care about producing good features generally helpful for many tasks.
RGB-IR
通常 remote sensing image (RSI) 图像有三种颜色模式
IRRG: 3 channels (IR-R-G)
RGB: 3 chan ...
RNN
Intro
These two links are the source code of d2l (Dive into Deep Learning)
Note that the source code of en-version and the zh-version is different. And the version Mu Li used in his videos and tutorials is Chinese version. The source code of python module installed by pip is also the Chinese version.
The Chinese version: d2l-ai/d2l-zh/blob/master/d2l/torch.py
The English version: d2l-ai/d2l-en/blob/master/d2l/torch.py
Use this command to import d2l
1from d2l import torch as d2l
The referen ...
Python笔记
zip函数
zip() 函数用于将多个列表(或者其它可迭代的对象)中对应的元素, 打包成一个个元组, 然后返回由这些元组组成的列表(Python3返回一个对象).
如果各个迭代器的元素个数不一致, 则返回列表长度与最短的对象相同, 利用 * 号操作符, 可以将元组解压为列表.
Note: 在 Python 3 中为了减少内存, zip() 返回的是一个对象. 如需展示列表, 需手动 list() 转换.
12345678910111213a = [1,2,3,4]b = ['a','b','c','d']c = ['A','B','C','D']zipped = list(a,b,c) #将3个列表打包成一个对象for i,j,k in zipped: print(i,j,k) #输出1 a A2 b B3 c C4 d D
zipped的数据类型实际为列表
1[(1, 'a', ...
Attention and Transformer
The Intro
Attention Is All You Need | arxiv
Pytorch Transformers from Scratch (Attention is all you need) | Aladdin Persson | YouTube
TRANSFORMERS FROM SCRATCH | blog
transformer_from_scratch.py | GitHub
Attention and Q,K,V
Queries, Keys, and Values are terms from the field of Recommendation Algorithms.
There is a collection of many key-value pairs D={(k1,v1),(k2,v2),⋯ ,(km,vm)}D = \{(k_1,v_1),(k_2,v_2),\cdots,(k_m,v_m)\}D={(k1,v1),(k2,v2),⋯,(km,vm)} and a query qqq. You need to find a key ...