星期日, 3月 27, 2022

How to install pytorch in tx2

 

 nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver

Copyright (c) 2005-2021 NVIDIA Corporation

Built on Sun_Feb_28_22:34:44_PST_2021

Cuda compilation tools, release 10.2, V10.2.300

Build cuda_10.2_r440.TC440_70.29663091_0


cuda_10.2
python3.6

PyTorch for Jetson - version 1.10 now available

  • PyTorch v1.7 - torchvision v0.8.1

Install jetson pytorch: 
https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-10-now-available/72048

--------------------------
pytorch
wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl -O torch-1.10.0-cp36-cp36m-linux_aarch64.whl sudo apt-get install python3-pip libopenblas-base libopenmpi-dev pip3 install Cython  pip3 install torch-1.7.0-cp36-cp36m-linux_aarch64.whl

---------------------
$sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev$
$git clone --branch v0.12.0 https://github.com/pytorch/vision torchvision # see below for version of torchvision to download
$ cd torchvision $ export BUILD_VERSION=0.8.1 # where 0.x.0 is the torchvision version $ python3 setup.py install --user
$ cd ../ # attempting to load torchvision from build dir will result in import error
$pip install 'pillow<7' # always needed for Python 2.7, not needed torchvision v0.5.0+ with Python 3.6

------------------

sudo apt-cache show nvidia-jetpack
It will show something like:

Package: nvidia-jetpack
Version: 4.4-b144
Architecture: arm64
Maintainer: NVIDIA Corporation

-------------------------------------

cuda version

$ cat /usr/local/cuda/version.txt

CUDA Version 10.2.300

-----------------------------------------

查看cudnn版本

ls /usr/local/cuda*
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2-------------------------------------workable pytorch in TX2 w/ python3.6 CUDA 10.2, jetpack 4.4https://developer.nvidia.com/embedded/downloads
----------------------------------

pip3 install --no-deps torchvision Collecting torchvision Using cached https://files.pythonhosted.org/packages/fb/01/03fd7e503c16b3dc262483e5555ad40974ab5da8b9879e164b56c1f4ef6f/torchvision-0.2.2.post3-py2.py3-none-any.whl Installing collected packages: torchvision Successfully installed torchvision-0.2.2.post3



星期一, 3月 07, 2022

CA intermediate ssl certificate

 https://www.thesslstore.com/blog/root-certificates-intermediate/



https://aboutssl.org/install-ssl-certificate-on-lighttpd-server/

星期六, 3月 05, 2022

斐波那契數列 Dynamic Programming

 

斐波那契數列 

Dynamic Programming

https://ithelp.ithome.com.tw/articles/10271832

Mutual Information Python

 


https://www.codeleading.com/article/31721058116/

  1. from sklearn import metrics as mr
  2. from scipy.misc import imread
  3. import numpy as np
  4. img1 = imread('1.jpg')
  5. img2 = imread('2.jpg')
  6. img2 = np.resize(img2, (img1.shape[0], img1.shape[1], img1.shape[2]))
  7. img1 = np.reshape(img1, -1)
  8. img2 = np.reshape(img2, -1)
  9. print(img2.shape)
  10. print(img1.shape)
  11. mutual_infor = mr.mutual_info_score(img1, img2)
  12. print(mutual_infor)


https://vimsky.com/zh-tw/examples/detail/python-method-sklearn.metrics.mutual_info_score.html