文章目录
- VSCode如何在行内显示变量值
- 多版本cuda切换
- 服务器相关
- conda 创建和删除环境
- 下载
- 折叠内容
- 有多少个文件夹
- 查看端口占用
- 找不到目录文件
- ImportError: libcoppeliaSim.so.1: cannot open shared object file: No such file or directory
- subprocess.CalledProcessError: Command '['git', 'config', '--get', 'remote.origin.url']' returned non-zero exit status 1.
- 制作U盘启动盘
- $'\r': command not found
- 重命名 tmux 的 session
- LaTex
- CoLMAP 格式转化
- 关闭僵尸进程
VSCode如何在行内显示变量值
多版本cuda切换
https://developer.nvidia.com/cuda-toolkit-archive
# 查看Linux版本
lsb_release -a
cat /etc/os-release
新服务器安装 anaconda
第一次添加驱动不要忘记添加到环境
echo 'export PATH=/usr/local/cuda-12.1/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
服务器相关
Accelerate 部署(换HF cache位置)
通过 SSH 从远程服务器同步
rsync -avuz -e 'ssh -p 39115' root@218.200.126.238:/mnt/data/wangsen/world_model/code/iVideoGPT_var_2/ ./ --progress
外网文件下载不了,多尝试几次
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run
pip修改国内镜像源(临时/永久)
conda 换源
~/.CONDARC
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.sustech.edu.cn/anaconda/pkgs/main
- https://mirrors.sustech.edu.cn/anaconda/pkgs/free
- https://mirrors.sustech.edu.cn/anaconda/pkgs/r
- https://mirrors.sustech.edu.cn/anaconda/pkgs/pro
- https://mirrors.sustech.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.sustech.edu.cn/anaconda/cloud
msys2: https://mirrors.sustech.edu.cn/anaconda/cloud
bioconda: https://mirrors.sustech.edu.cn/anaconda/cloud
menpo: https://mirrors.sustech.edu.cn/anaconda/cloud
pytorch: https://mirrors.sustech.edu.cn/anaconda/cloud
simpleitk: https://mirrors.sustech.edu.cn/anaconda/cloud
nvidia: https://mirrors.sustech.edu.cn/anaconda-extra/cloud
添加路径
vim ~/.bashrc source ~/.bashrc
export PATH="/usr/local/cuda-11.7/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH"
新建用户
1. 登录:
访问方式:ssh root@xxx.xxx.xxx.xxx,密码:yyyyyyyyy
2.新建用户:
adduser abc
sudo userdel abc # 删除用户
3.分配磁盘空间:
cd /mnt/data/
mkdir abc
4.使用 chown 命令更改目录所有者
sudo chown -R wangsen:wangsen /mnt/hwdata/wangsen/
sudo chmod -R g+rw /mnt/data/wangsen/
5.连接终端:
Host(主机): 服务器的 IP 地址,xxx.xxx.xxx.xxx。
Port(端口): SSH 连接使用的端口号,yyyyy。
Username(用户名): abc。
Password(密码): iairabc。
6. root
sudo visudo
username ALL=(ALL:ALL) ALL
保存并退出编辑器。通常在visudo中,保存并退出的方法是按Ctrl + X,然后按Y确认保存,再按Enter退出。
7. 输出
xxx.xxx.xxx.xxx -p yyyyy
User:abc
Key:iairabc
清理swap区域
sudo swapoff -a
sudo rm /swap.img
sudo dd if=/dev/zero of=/swap.img bs=1M count=4096
sudo chmod 600 /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img
free -m
压缩解压
tar -cf xx.tar xxxxxx/
tar -xf xx.tar -c 指定位置
conda 创建和删除环境
[/home/user/anaconda3] >>> /mnt/data/user/Anaconda/
python
import torch
print(torch.cuda.is_available())
exit()
conda create --name anf_c --clone anf # 创建一个anf_c的环境
conda remove -n xxx --all
下载
将百度网盘中数据集直接下载到服务器上
huggingface-cli下载数据(含国内镜像源方法)
pip install -U huggingface_hub
# 建议将上面这一行写入 ~/.bashrc。若没有写入,则每次下载时都需要先输入该命令
export HF_ENDPOINT=https://hf-mirror.com
--repo-type
huggingface-cli download --resume-download jxu124/OpenX-Embodiment --repo-type dataset --local-dir /mnt/data/wangsen/world_model/data/OXE --include "jaco_play/*"
修改HuggingFace模型下载默认缓存路径
vim ~/.bashrc
export HF_HOME="/path/to/you/dir" # 替换为你想更改的目标路径
source ~/.bashrc
env | grep HF_HOME
vim ~/.bashrc
export XDG_CACHE_HOME="你想要的目录"
esc : wq
source ~/.bashrc
折叠内容
<details>
<summary>点击展开/折叠</summary>
这里是可以展开或折叠的内容。
</details>
有多少个文件夹
统计文件夹的总数
ls -l | grep ^d | wc -l
只统计文件(不包括文件夹):
find . -type f | wc -l
查看端口占用
sudo lsof -i :29500
找不到目录文件
import sys
sys.path.append('/data1/user/Robot/Code/') # 哪里调用不到就在哪里加入
ImportError: libcoppeliaSim.so.1: cannot open shared object file: No such file or directory
方法:source ~/.bashrc
subprocess.CalledProcessError: Command ‘[‘git’, ‘config’, ‘–get’, ‘remote.origin.url’]’ returned non-zero exit status 1.
git remote add origin 11
制作U盘启动盘
$‘\r’: command not found
$ sudo apt install dos2unix
$ dos2unix your_.sh
dos2unix: converting file train.sh to Unix format...
重命名 tmux 的 session
tmux rename-session -t old_name new_name
LaTex
latex下列表默认缩进,修改为不进行缩进
运用宏包 \usepackage{enumitem}
\begin{itemize}[leftmargin=*]
\item test
\item test
\end{itemize}
CoLMAP 格式转化
sudo apt install colmap
colmap model_converter --input_path . --output_path . --output_type TXT
这个命令会将当前目录下的.bin文件转换为.txt文件,并保存在同一个目录下。
camera.txt & image.txt &
# Camera list with one line of data per camera:
# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
# Number of cameras: 1
1 SIMPLE_RADIAL 4032 3024 3575.06 2016 1512 0.0251346
focal_length (焦距):3575.06,表示相机的焦距(以像素为单位)。
cx (主点x坐标):2016,表示图像中心在x方向上的坐标(以像素为单位)。
cy (主点y坐标):1512,表示图像中心在y方向上的坐标(以像素为单位)。
radial_distortion (径向畸变参数):0.0251346,表示径向畸变的系数。
# Image list with two lines of data per image:
# IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME
# POINTS2D[] as (X, Y, POINT3D_ID)
# Number of images: 34, mean observations per image: 4368.1470588235297
34 0.999667 0.00313307 0.0253658 -0.00353764 4.73307 -3.07995 1.56188 1 IMG_2995.JPG
102.581 10.1238 -1 1210.11 10.8019 -1 72.8585 12.5679 -1 250.252 11.9117 -1 436.122 12.7498 -1 1103.58 13.8941 -1 1172.19 13.3632 -1 1196.71 15.0687 -1 1665.15 14.3031 5681 939.559 16.1451 -1
第一行的含义
IMAGE_ID:34,图像的唯一标识符。
QW, QX, QY, QZ:0.999667 0.00313307 0.0253658 -0.00353764,表示相机的旋转姿态,以单位四元数表示。四元数是一种紧凑且数值稳定的表示旋转的方式。
TX, TY, TZ:4.73307 -3.07995 1.56188,表示相机的平移向量,即相机在世界坐标系中的位置。
CAMERA_ID:1,相机的ID,与cameras.txt文件中的相机ID相对应。
NAME:IMG_2995.JPG,图像文件的名称。
第二行的含义
102.581 10.1238 -1 1210.11 10.8019 -1 72.8585 12.5679 -1 ...
每组三个值表示一个二维特征点及其对应的三维点ID:
X, Y:特征点在图像中的二维坐标(像素坐标)。
POINT3D_ID:该特征点对应的三维点ID。如果该特征点没有对应的三维点,则为-1。
# 3D point list with one line of data per point:
# POINT3D_ID, X, Y, Z, R, G, B, ERROR, TRACK[] as (IMAGE_ID, POINT2D_IDX)
# Number of points: 23477, mean track length: 6.3260638071303825
25758 -24.858607895466015 34.030347822769421 93.004948702444622 47 63 36 2.0938852711759646 19 9463 21 9490 18 9011 20 9267
参数解释
POINT3D_ID
值:25758
含义:三维点的唯一标识符。
X, Y, Z
值:-24.858607895466015 34.030347822769421 93.004948702444622
含义:三维点在世界坐标系中的坐标。
R, G, B
值:47 63 36
含义:该三维点的颜色,以RGB格式表示。这些颜色通常是从图像中提取的特征点的颜色信息。
ERROR
值:2.0938852711759646
含义:该三维点的重建误差。这个值表示该点在所有观测图像中的平均重投影误差,单位通常是像素。较小的误差值表示该点的重建质量较高。
TRACK
值:19 9463 21 9490 18 9011 20 9267
含义:该三维点在哪些图像中被观测到,以及在这些图像中的特征点索引。每对值表示:
IMAGE_ID:图像的ID。
POINT2D_IDX:该图像中对应的二维特征点的索引(在images.txt文件中第二行的特征点列表中的索引)。
示例解析
以示例中的TRACK部分为例:
19 9463:表示该三维点在图像19中被观测到,对应的二维特征点索引为9463。
21 9490:表示该三维点在图像21中被观测到,对应的二维特征点索引为9490。
18 9011:表示该三维点在图像18中被观测到,对应的二维特征点索引为9011。
20 9267:表示该三维点在图像20中被观测到,对应的二维特征点索引为9267。
关闭僵尸进程
sudo fuser -v /dev/nvidia*
USER PID ACCESS COMMAND
/dev/nvidia0: root kernel mount /dev/nvidia0
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia1: root kernel mount /dev/nvidia1
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia2: root kernel mount /dev/nvidia2
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia3: root kernel mount /dev/nvidia3
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia4: root kernel mount /dev/nvidia4
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia5: root kernel mount /dev/nvidia5
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia6: root kernel mount /dev/nvidia6
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia7: root kernel mount /dev/nvidia7
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidiactl: root kernel mount /dev/nvidiactl
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
/dev/nvidia-uvm: root kernel mount /dev/nvidia-uvm
root 43701 F...m python
root 43702 F...m python
root 43703 F...m python
root 43704 F...m python
root 43705 F...m python
sudo kill -9 43701 43702 43703 43704 43705