Skip to content

Commit

Permalink
📝 docs: 更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
henryzhuhr committed Jun 1, 2024
1 parent 8d6bef8 commit 8e5196e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 24 deletions.
2 changes: 2 additions & 0 deletions docs/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ outline: deep
DATASET_DIR=/path/to/dataset
```

> 需要注意的是,数据集通常需要放置在项目外的路径,例如 `~/data` (推荐)。如果放置在项目内,导致编辑器对于项目的索引过大,会导致编辑器卡顿
这里准备好了一个示例数据集,可以下载

```bash
Expand Down
41 changes: 32 additions & 9 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,52 @@ git submodule init
git submodule update
```

### 创建虚拟环境
### 创建环境并安装依赖

确保安装了 conda ,如果没有安装,请从 [Miniconda](https://docs.anaconda.com/free/miniconda/index.html) 下载,或者快速安装

```shell
# linux x64
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
```


#### 方法一:使用提供的脚本


查看 `scripts/base.sh` ,根据需要修改配置,执行命令自动创建并且激活虚拟环境

::: code-group

```shell [使用 venv 创建虚拟环境]
bash scripts/python-activate.venv.sh
```

```shell [使用 conda 创建虚拟环境]
bash scripts/python-activate.conda.sh
```

:::

- **可以重复执行该脚本获取激活环境的提示信息或者安装依赖**
- 修改 `export PIP_QUIET=true``false` 可以查看安装过程
- 该脚本会复制 `yolov5/requirements.txt``.cache/yolov5/requirements.txt`,可以自行修改 `.cache/yolov5/requirements.txt` 文件安装相关依赖,例如取消 `onnx` 的注释以支持 ONNX 格式的模型导出

#### 方法二:手动安装

创建虚拟环境
```shell
export ENV_NAME=deep-object-detect-track
# 在项目内安装环境(推荐)
conda create -p .env/dodt python=3.10 -y
conda activate ./.env/dodt
conda create -p .env/$ENV_NAME python=3.10 -y
conda activate ./.env/$ENV_NAME
# 全局安装环境
conda create -n dodt python=3.10 -y
conda activate dodt
conda create -n $ENV_NAME python=3.10 -y
conda activate $ENV_NAME
```
> Python 版本选择 3.10 是因为 Ubuntu 22.04 默认安装的 Python 版本是 3.10
### 安装依赖

1. 安装 PyTorch

参考官网 [INSTALL PYTORCH](https://pytorch.org/get-started/locally/) 选择配置安装 PyTorch
Expand All @@ -75,7 +98,7 @@ pip install torch torchvision \

```shell
pip install -r projects/yolov5/requirements.txt
pip install -r requirements.txt
pip install -r requirements/requirements.train.txt
```

如果涉及部署流程,需要自行修改 `requirements.txt` 文件,将下列依赖取消注释掉,然后重新执行上述命令
Expand Down
2 changes: 1 addition & 1 deletion scripts/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export ENV_PATH=$BASE_ENV_PATH/.env/$ENV_NAME

# ================== Python Variables ==================
CUSTOM_PYTHON_VERSION=3.12 # Uncomment and set to the desired Python version
export PIP_QUIET=false
export PIP_QUIET=true

# ================== Enabling OpenVINO ==================
export OPENVINO_HOME=/opt/intel/openvino_2024
Expand Down
24 changes: 10 additions & 14 deletions scripts/python-install-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,23 @@ if [ ! -f ".cache/yolov5/requirements.txt" ]; then
cp projects/yolov5/requirements.txt .cache/yolov5/requirements.txt
fi
python3 -m pip install $PIP_QUIET_FLAG -r .cache/yolov5/requirements.txt
python3 -m pip install $PIP_QUIET_FLAG -r requirements/requirements.txt

python3 -m pip install $PIP_QUIET_FLAG onnx
python3 -m pip install $PIP_QUIET_FLAG onnx-simplifier
python3 -m pip install $PIP_QUIET_FLAG -r requirements/requirements.train.txt

if [ ! -z "${CUDA_VERSION}" ]; then
python3 -m pip install $PIP_QUIET_FLAG onnxruntime-gpu
else
python3 -m pip install $PIP_QUIET_FLAG onnxruntime
fi

# if [ -d "$INTEL_OPENVINO_DIR" ]; then
# print_info "OpenVINO found in $INTEL_OPENVINO_DIR"
# print_info "Installing OpenVINO Python requirements from $INTEL_OPENVINO_DIR/python/requirements.txt"
# python3 -m pip install $PIP_QUIET_FLAG -r $INTEL_OPENVINO_DIR/python/requirements.txt
# else
# print_warning "OpenVINO not found"
# print_info "Installing OpenVINO Python requirements from pip"
# python3 -m pip install $PIP_QUIET_FLAG openvino-dev
# fi

if [ -d "$INTEL_OPENVINO_DIR" ]; then
print_info "OpenVINO found in $INTEL_OPENVINO_DIR"
print_info "Installing OpenVINO Python requirements from $INTEL_OPENVINO_DIR/python/requirements.txt"
python3 -m pip install $PIP_QUIET_FLAG -r $INTEL_OPENVINO_DIR/python/requirements.txt
else
print_warning "OpenVINO not found, skipping OpenVINO Python requirements installation"
# print_info "Installing OpenVINO Python requirements from pip"
# python3 -m pip install $PIP_QUIET_FLAG openvino-dev
fi

# freeze the requirements
# python3 -m pip list --format=freeze > requirements.version.txt

0 comments on commit 8e5196e

Please sign in to comment.