Anaconda使用
- 创建环境:
conda create -n pytorch python=3.7
- 删除环境:
conda remove --name pytorch --all
- 完全卸载Anaconda(Windows下)参考:
conda install anaconda-clean
anaconda-clean --yes
- 添加conda源(Windows也可用)参考:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- 删除conda源:
conda config --remove-key channels
- 修改默认conda环境变量(
:wq
保存退出):
vi ~/.bashrc
pytorch下载地址:https://download.pytorch.org/whl/torch_stable.html
创建用户
查看IP
ip addr show
关闭指定端口
sudo ufw deny
pip使用
添加pip源:
- 指定安装源,安装opencv模块,单次有效
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
国内源:
豆瓣:
https://pypi.doubanio.com/simple/
阿里云 :
https://mirrors.aliyun.com/pypi/simple/
- 修改配置文件,永久有效
Linux下,修改 ~/.pip/pip.conf (没有则创建)
内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
windows下,win+R 打开用户目录%HOMEPATH%,在此目录下创建 pip 文件夹,在 pip 目录下创建 pip.ini 文件, 内容如下:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
修改host
sudo gedit /etc/hosts
刷新DNS
sudo /etc/init.d/networking restart
压缩命令
压缩速度快,多线程压缩命令如下:
tar -cvf - face_image/ | pigz -p 8 > face_image_p4.tar.gz
解压命令:
tar --use-compress-program="pigz -dk -p8" -xf train_img.tar.gz
path:/home/user/folder/test
cd /home/user/folder/
zip -r test.zip test/
解压压缩包中的1个文件夹:
unzip oulu-face-pair.zip 'oulu-face-pair/P001/*' -d test-ou
其中oulu-face-pair.zip
为压缩包,P001
为压缩包中的一个文件夹,test-ou
为解压后输出的路径。
查看压缩包里文件结构:
unzip -l test.zip
mv:移动文件(夹)到指定目录
mv path dst-path
cp:复制文件(夹)到指定目录
mv path dst-path
复制时显示进度命令:
rsync -ah --progress path dst-path
free -mh
rm -rf 文件夹
tar zxvf 文件名.tgz
du -B G --max-depth=1 path(路径)
数据集
伯克利无人驾驶BDD地址:BDD-100k
可以使用IDM使用方法和教程进行下载,pan下载例子。以及2019年IDM-install
显存释放
在ubuntu使用kill -9 PID
杀死后台训练程序时,可能会出现不释放显存的情况,可以使用
fuser -v /dev/nvidia*
查看GPU上的进程,然后kill -9 PID
即可。也可以直接使用:
pkill -9 -U username
杀死指定用户的所有进程。
批量重命名
在excl表中输入以下命令:
="REN?"&A1&"?"&B1&""
win10环境变量
原始Path
(避免被覆盖,特此记录)如下:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
opencv读取视频
在ubuntu下使用opencv读取视频时,capture.isOpened()
可能为False
,运行:
pip install opencv-contrib-python
即可解决问题(参考isOpened())
Cmake使用
cmake学习:https://github.com/Akagi201/learning-cmake
https://github.com/wzpan/cmake-demo
https://www.hahack.com/codes/cmake/