fuhao7i Blog

[我还很年轻,吃苦趁现在!]

Dali工具箱🕶7——Data pre-processing: Transform the label format

"semantic segmentation, pngs, labels, transform, "

将labels转化为单通道的png格式,每个像素点存放的是它的种类: 0, 1, 2… 等 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 from PIL import Image with open('/content/drive/MyDrive/语义分割/dataset/val.txt', 'r')...

Dali工具箱🕶6——Compute Confusion Matrix

"confusion matrix, TP, FP, TN, FN, Precision, IoU, Recall "

1.sklearn.metrics.confusion_matrix (y_true, y_pred, labels=None, sample_weight=None) y_true为真实值, y_pred为预测值(softmax之后, 取最大值的坐标, 即预测的像素点类别) y_true和y_pred都需要flatten为一维数组 1 2 3 4 >>> fro...

Image Enhancement🐽2——metrics for picture quality

"SSIM(structural similarity), PSNR(Peak Signal to Noise Ratio)"

1. SSIM: Structural similarity 2. PSNR: Peak Signal to Nosie Ratio 3. implement 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import skimage from skimage.metrics import structural_sim...

Dali杂货铺🐰22——the dump() and load() function in pickle module

"pickle, dump(), load()"

pickle 模块实现了基本的数据序列化与反序列化。序列化对象可以在磁盘上保存对象,并在需要的时候读取出来,反序列化适合程序直接应用。 1. dump() function pickle.dump(obj, file, [,protocol]) obj: 序列化对象,将对象obj保存到文件file中; file: 表示保存到的类文件对象,file必须有一个write(...

Modular torch💌2——Define your Dataset

"Dataset for classification, semantic sementation, object detection or ..."

1. Dataset for classification 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 class MyDataset(Dataset): # 创类:MyDataset,继承torch.utils.data.Dataset def __init__(self, datatxt, transfor...

Dali工具箱🕶5——the use of numpy

"np.where, np.argmax, np.argmin, np.eye, np.seed, np.vstack, np.hstack, torch.sum, squeeze "

1. Boolean indexes 1 2 3 4 5 6 7 8 9 10 11 12 13 import numpy as np a = np.arange(12).reshape(3,4) print('-' * 20) print(a) print('-' * 20) # 数组a中所有大于5的位置为True, 其余为False print(a>5) print('-' ...

Modular torch💌1——load checkpoint

"load weights into state dict"

Modular loading checkpoint put your checkpoint path and model name into “checkpoint_path” and “model_name” respectively. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # -------------------------...

小菊的语义分割4🌼——Metrics for semantic segmentation

"mAP, precision, recall, F1-score, IoU, mIoU"

reference 深度学习之语义分割中的度量标准 4.4.2分类模型评判指标(一) - 混淆矩阵(Confusion Matrix)

Dali杂货铺🐰21——The contiguous() in PyTorch

"contiguous(), squeeze()"


Dali杂货铺🐰20——Common operations of tensors

"cat, "

record the common operations of tensors. 1. torch.cat((tensor1, tensor2), dim) cat is ‘concatenate’, menas link (things) together in a chain or series. >>> import torch >>...