Skip to content

Instantly share code, notes, and snippets.

View YimianDai's full-sized avatar
💭
I may be slow to respond.

Yimian Dai YimianDai

💭
I may be slow to respond.
View GitHub Profile
@YimianDai
YimianDai / Notes-on-WangMengyuan.md
Last active August 20, 2019 22:25
王孟源观点
  1. 现代英美媒体意识形态宣传的主轴,亦即所谓的 “民主”、“自由”,其真正的意义在于消弭政府监管,使资本一家独大,这是 1970 年初期开始的资本大反扑的结果。
  2. 我的人生态度,是坚持理想原则,但仍要追寻对现实世界最大的实际影响和贡献。前者是理想主义,后者是实用主义。请注意这两者是绝对相容的,因为理想主义的相反,是现实主义,而不是实用主义。
  3. 载人航天主要是霸权争夺的象征,是对全世界多数人类的最佳广告,有很重要的士气和宣传价值。从战略角度来看,它是无人伤亡的正面国力碰撞。你可以抱怨它的实际效益低于很多其他科研计划,但是正确的比较对象,其实是全面战争,包括核战争,所以它真正是应该被严肃考虑的首选之一。
@YimianDai
YimianDai / eval_ssd.md
Last active September 6, 2019 16:48
eval_ssd.py
  • parse_args
    • data-shape: 默认是 300,这个数值在 Evaluation 中会影响 net_name 和 SSDDefaultValTransform 里面的 imresize 也就是 Eval 图像的大小
  • get_dataset
  • get_dataloader
  • benchmarking
  • validate
  • __main__

Eval Script

@YimianDai
YimianDai / train_ssd.md
Last active September 30, 2019 18:11
train_ssd.py

Train Script

$ python train_tiny_ssd.py --gpus 0,1 -j 16 --lr 0.0001 --lr-decay-epoch 160,200 --lr-decay 0.1 --epochs 240 --data-shape 512 --train-split train --val-split val --nms-thresh 0.01 --batch-size 12 --resume best_TinySSD.params 

Debug

@YimianDai
YimianDai / _MultiWorkerIter.md
Last active August 15, 2019 22:36
_MultiWorkerIter

Internal multi-worker iterator for DataLoader.

num_workers 大于 0 的时候,DataLoader 实际用的是下面的代码来处理数据

        # multi-worker
        return _MultiWorkerIter(self._worker_pool, self._batchify_fn, self._batch_sampler,
                                pin_memory=self._pin_memory, pin_device_id=self._pin_device_id,
                                worker_fn=_thread_worker_fn if self._thread_pool else _worker_fn,
@YimianDai
YimianDai / DataLoader.md
Last active August 15, 2019 22:18
DataLoader

DataLoader 的作用是 Loads data from a dataset and returns mini-batches of data

__init__

sampler 是什么?怎么理解 Either specify sampler or shuffle, not both.

samplerbatch_sampler 有什么区别?

如果指定 batch_sampler 的时候就不需要指定 batch_size, shuffle, sampler, and last_batch

@YimianDai
YimianDai / Segmentation-Test.md
Last active October 8, 2019 17:18
Gluon-CV Segmentation Test Script
  • parse_args
    • model and dataset
    • synchronized Batch Normalization
    • evaluation only
      • '--eval'
        1. whether evaluation only, evaluation 就是指是计算 pixAccmIoU 还是保存所有测试结果
        2. True 的话,就是按照 Batch 一个一个扫遍 Dataset,最后输出 pixAccmIoU
        3. False 的话,还是按照 Batch 一个一个扫遍 Dataset,但是不计算 pixAccmIoU,而是把 Batch 里面的每一个样本的预测结果的图保存下来
    • dummy benchmark
  • test
@YimianDai
YimianDai / U-Net.md
Created August 13, 2019 05:08
U-Net

test

@YimianDai
YimianDai / Attention-to-Scale.md
Last active December 8, 2021 16:42
Attention to Scale: Scale-aware Semantic Image Segmentation

Attention to Scale: Scale-aware Semantic Image Segmentation

这是一篇较早的文章了,10 Nov 2015 挂到了 arXiv 上,是 CVPR 2016 的文章。不管是 Object Detection 还是 Semantic Segmentation,性能要好的一个关键在于利用好 multi-scale features。

论文试图解决的问题是:如何利用 multi-scale 的 feature?

论文尝试给出的途径是,将各个 scale 独立预测的 score map 做一个 weighted sum,其实是一个决策级的融合。这个权重来源于共享的 Attention Module,具体由另一个 FCN 实现。

1. multi-scale features 的来源

@YimianDai
YimianDai / SoftIoU.md
Created August 8, 2019 18:19
SoftIoU Loss

自己实现的 SoftIoU Loss,用于前景背景的图像分割,相较于 Focal Loss,SoftIoU Loss 的好处是不需要设置 Loss 的参数了,只要关注 Model 就好了

from gluoncv.loss import Loss as gcvLoss

class SoftIoULoss(gcvLoss):
    def __init__(self, batch_axis=0, weight=None):
 super(SoftIoULoss, self).__init__(weight, batch_axis)
@YimianDai
YimianDai / SigmoidMetric.md
Last active August 6, 2019 23:26
SigmoidMetric
    predict = np.argmax(output.asnumpy(), 1).astype('int64')

pixAcc 是 TP / T

IoU 是 TP / (T + P - TP)

如果 pixAcc 很高,比如 0.95,而 IoU 很低,接近于 0,那么 说明分类器几乎把所有像素都预测成了 P