NexT


  • Home

  • Archives

  • Tags

Graph Machine Learning - Laplacian Operator

Posted on 2022-08-27 | In AI
Graph
Read more »

GNN - Graph Laplacian Operator/Matrix

Posted on 2022-08-27 | In AI
Graph
Read more »

Dl_continuity

Posted on 2022-08-22

ML: continuous vs. discrete (EA, RL)

Why special continuity in ML? stronger continuity.

Liptz continuity

Reference:?

详细解析深度学习中的 Lipschitz 条件 - 知乎 (zhihu.com)

Lipschitz continuity is useful in Deep learning, GAN, etc.

详细解析深度学习中的 Lipschitz 条件 - 知乎 (zhihu.com)

Hugarian algoirthm vs,. Sikhorn (in SuperGlue) for matching (reference: paper from SuperGlue and CSD??)

Hugarian is not differentiable, Sikhorn is differentiable (yes, no?)

(8 条消息) 如何理解深度图匹配算法CIE-H? - 知乎 (zhihu.com)

视觉SLAM总结——SuperPoint / SuperGlue_Leo-Peng的博客-CSDN博客_superpoint

Read more »

Windows + ML CUDA - Anaconda / WSL2 / DirectML

Posted on 2022-08-13 | In AI

最近一直搞錯 windows 如何用 GPU 做 ML/AI task. 重新整理一次。

Method 1: Windows Anaconda

這是最直接的方法。

開啓終端機, then Anaconda Prompt 如下圖:

image-20220813181825980

image-20220813181944778

``` (base) PS > conda env list

conda env list

conda environments:

# base * D:\anaconda3 opencv D:\anaconda3\envs\opencv sql D:\anaconda3\envs\sql tf1 D:\anaconda3\envs\tf1 tf1b D:\anaconda3\envs\tf1b tf2 D:\anaconda3\envs\tf2 tf21 D:\anaconda3\envs\tf21 torch D:\anaconda3\envs\torch

conda activate torch cd .\examples\mnist
python main.py ```

正宗安裝和執行 PyTorch and TensorFlow 都是在 Ubuntu platform, 特別是在有 GPU 的情況下。不過最近開始有一些在 Windows 10 執行 PyTorch and TensorFlow 需求。

  • xddsf
  • 容易同時 blogging 和 coding, 因爲 blogging tool 大多是在 Windows (or Mac) 環境下,例如 Typora, Jekyll, etc.
  • Windows system 開始有一些令人驚喜的進步,for example,
    • Windows 10 開始支持 Windows subsystem for Linux (WSL2). Windows 11 將會支持 Windows 最近subsystem for Android (WSA). WSL2 甚至開始支持 GPU.
    • Windows 的 PowerShell and Terminal 越來越像 Linux shell. 可以做一些 coding.
  • 另一個之後會比較 Windows native machine learning platform, i.e. DirectML 的效能和 Pytorch/Tensorflow on Windows 的比較。

Windows Installation

Windows 安裝和 Ubuntu 基本相同。我的習慣是接近硬體的開始安裝,順序會是GPU driver→CUDA Toolkit→cuDNN→Anaconda/Python→Pytorch and Tensorflow。

Anaconda 的好處是可以建立不同的環境,安裝不同版本的 Tensorflow (1.15, 2.x) 和 PyTorch.

這裏用

  • GTX 1080: GPU driver 456.71
  • CUDA: 10.2
  • CuDNN: 8.2.2
  • Anaconda 2020.11: 2.0.4 (Python 3.8)
  • PyTorch: 1.9.1 (1 conda env: torch)
  • TensorFlow: 1.15 and 2.3 (2 conda env, Python down to 3.7 for compatibility)

Step 1: GPU driver

下表示 CUDA 對應 driver table. 我的 driver version 符合 CUDA 10.2 需求。因此不用再 update driver.

image-20210925235445225

Step 2: Install CUDA and CuDNN

CUDA 是 Nvidia 的 (GPU) computing platform API; CuDNN 是特別針對 machine learning 的加强 API.

CUDA download: https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exenetwork 可以直接 install.

Validate: Use PowerShell PS> nvcc -V

Install CuDNN 麻煩一點。必須在 Nvidia 官網注冊。Download and decompress 后,再把 bin, include, lib copy 到 CUDA 對應的 directory.

image-20210926000950554

image-20210926001104446

Check the environment variable of PATH, and CUDA, etc.

Step 3: Install Anaconda

直接在官網 download and install Anaconda. 我的是 2020.11 version: 2.0.4 (default Python 3.8)

接著用 conda create 3 個 virtual environments:

  • torch for PyTorch 1.9
  • tf1 for TensorFlow-GPU 1.15
  • tf2 for TensorFlow-GPU 2.6

First, create torch. 之所以 clone base 因爲 base 已經包含 matplotlib, scipy, etc. 常用 packages.

1
2
3
conda create --name torch --clone base  (base Python is 3.8)
conda activate torch
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

Next, create tf2. 因爲 TensforFlow-GPU 和 Python version 以及 CUDA 強相關。我試了幾種 configurations. TensorFlow 2.3 和 Python 3.7 以及 CUDA 10.2 看來最合。

1
2
3
4
5
6
conda activate base
conda create --name tf2 python=3.7  
conda activate tf2
conda install tensorflow-gpu=2.3

conda install -c conda-forge matplotlib

Next, create tf1. 爲什麽還要 tensorflow1? 因爲很多 legacy code 仍然使用 tensorflow1. 我試了幾種 configurations. TensorFlow 1.15 和 Python 3.6 以及 CUDA 10.0 看來最合。

1
2
3
4
5
6
conda activate base
conda create --name tf1 python=3.6  
conda activate tf1
conda install tensorflow-gpu=1.15

conda install -c conda-forge matplotlib

Keras is built-in in tensorflow 2.x. 但在 tensorflow 1.x 需要額外 install. Use anaconda to install Keras!

Jupyter notebook 也需要額外 install!

Test using mnist

Step 4: Update Windows Terminal Setting

Windows 10 Terminal 有一些優點

  • With multi-tab support

  • Support Linux command : wsl
  • Shell ?

Add anaconda3 PowerShell to Terminal list.

Ref: https://zhuanlan.zhihu.com/p/364292785

In the setting.json, add the following anaconda prompt:

{

​ // Anaconda Prompt

​ “guid”: “{2daaf818-fbab-47e8-b8ba-2f82eb89de40}”,

​ “name”: “Anaconda Prompt”,

​ “icon”: “D:\anaconda3\Menu\anaconda-navigator.ico”,

​ “startingDirectory”:”%USERPROFILE%\OneDrive\GitHub”,

​ “commandline”: “powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& ‘D:\anaconda3\shell\condabin\conda-hook.ps1’ ; conda activate ‘D:\anaconda3’ " “,

​ “hidden”: false

​ }

Step 5: Clone GitHub Coding to Local OneDrive/GitHub

Step 6: Install VS Code As Coding Tool

Read more »

vSLAM with NN

Posted on 2022-05-13 | In AI
vSLAM
Read more »

vSLAM with NN

Posted on 2022-05-13 | In AI
vSLAM
Read more »

vSLAM with NN

Posted on 2022-05-13 | In AI
vSLAM
Read more »

English_err

Posted on 2022-05-07

Native Chinese’s problem when speaking in English

中文沒有或是差異部分

  • Grammar

    • Tense: particularly past tense with verb
    • Gender: he/she not in spoken Chinese
    • single/plural
    • 假設句: if I were , I would have …
    • 中文特性 (I, I, I, you, you, you)
      • 太多主觀 (I, I think, I believe): 英文最好避免 I …: (1) 加入不確定性: I am wondering …, If you ask me, …, (2) 使用 in my view, …
      • 太多祈使句 (imperative, you, you, you):請你 xxxx -> 英文不禮貌最好轉問句 : could you please …,
    • 我(今天)(在臺北)吃飯 。中文時間地點最先。 I ate in Taipei today. 英文地點、時間最後。
    • 方向:中文: 東西先於南北:東北風。英文南北先於東西: northeast, southwest.
  • pronunciation/tones

    • 國語特性:一字一音,結尾母音或開口子音

    • vowel:
      • auto- (short o), 中文只有長音的 o (歐),沒有短音 o (auto, law)
      • paper, pepper: different /ei or e/
      • bed, bad: different /e and e/
    • consonant
      • 因爲中文 ending 主要是母音 (開口,e.g. 馬) 或是開口子音 (文,中)。不習慣閉口子音。也不習慣連續子音 (ks, ds, ms, ns, etc.)
      • e.g. ending with m (close mouth): name, time
      • s/z and th at the end (smooth, both, clothes, sixth)
      • wh -> either w or h: who, what, where
    • 因爲國語一字一音。不習慣發音多音節 long word
      • 重音在前 發音成重音在中或後 : ‘mechanism (x me’chanism)
      • 不習慣省略中間的 vowel: ’chocolate, ‘comfortable, ‘vegetable
      • 不記得省略子音: salmon, herb
      • 外來字 (特別是法文): rendezvous, dejavu
        • cliche’ /ei/, cafe’, finace’
        • age /ag/ (action), entourage, sabotage, camouflage, barrage, garage, tutelage, espionage
        • bouquet (no sound), ballet
        • a -> o, renaissance
        • pig, swine -> pork (法,豬); cow -> beef(法,牛), sheep -> lamb (法,羊)
    • intonation
      • 中文一般沒有 (sentence) intonation, 而是聲調 (word)。英文相反。
      • 中文一般沒有 (sentence) 輕重音。英文相反。
      • A bowl of freshly fried flying fish.
Read more »

CV-SLAM Bundle Adjustment (BA)

Posted on 2022-04-23 | In AI
Feature Extraction
Read more »

Human Brain

Posted on 2022-04-23 | In AI
Feature Extraction
Read more »
1 … 17 18 19 … 25
Allen Lu (from John Doe)

Allen Lu (from John Doe)

243 posts
18 categories
140 tags
RSS
© 2024 Allen Lu (from John Doe)
Powered by Jekyll
Theme - NexT.Muse