From 208690d4057a2b17af4f728ff870865e4944828f Mon Sep 17 00:00:00 2001 From: yang-jinwu Date: Mon, 7 Nov 2022 14:45:30 +0800 Subject: [PATCH 01/10] Centroids_Reid --- .../pytorch_lightning/core/step_result.py | 4 +++- .../utilities/device_dtype_mixin.py | 14 ++++++++++++++ .../Centroids-reid/train_ctl_model.py | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/core/step_result.py b/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/core/step_result.py index b6112a68b4..3411d19f69 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/core/step_result.py +++ b/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/core/step_result.py @@ -436,7 +436,9 @@ class Result(Dict): for k, v in self.items(): if isinstance(v, torch.Tensor): v = v.detach() - newone[k] = copy(v) + newone[k] = v.clone() + else: + newone[k] = copy(v) return newone @staticmethod diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/utilities/device_dtype_mixin.py b/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/utilities/device_dtype_mixin.py index cf8e83648b..e4325b53c6 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/utilities/device_dtype_mixin.py +++ b/PyTorch/contrib/cv/classification/Centroids-reid/pytorch_lightning/utilities/device_dtype_mixin.py @@ -15,6 +15,8 @@ from typing import Union, Optional import torch +if torch.__version__ >='1.8': + import torch_npu from torch.nn import Module @@ -109,6 +111,18 @@ class DeviceDtypeModuleMixin(Module): torch.float16 """ # there is diff nb vars in PT 1.5 + if torch.__version__ >='1.8': + if args: + args_list = list(args) + for index, arg in enumerate(args_list): + if isinstance(arg,tuple) and "type='npu'" in str(arg): + args_list[index] = torch_npu.new_device(type=torch_npu.npu.native_device, index=arg.index) + break + args = tuple(args_list) + if kwargs and isinstance(kwargs.get("device"),tuple): + namedtuple_device = kwargs.get("device") + if "type='npu'" in str(namedtuple_device): + kwargs['device'] = torch_npu.new_device(type=torch_npu.npu.native_device, index=namedtuple_device.index) out = torch._C._nn._parse_to(*args, **kwargs) self.__update_properties(device=out[0], dtype=out[1]) return super().to(*args, **kwargs) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/train_ctl_model.py b/PyTorch/contrib/cv/classification/Centroids-reid/train_ctl_model.py index c0ef01372a..85843b440a 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/train_ctl_model.py +++ b/PyTorch/contrib/cv/classification/Centroids-reid/train_ctl_model.py @@ -1,3 +1,4 @@ + # encoding: utf-8 # BSD 3-Clause License # @@ -42,6 +43,8 @@ from pathlib import Path import numpy as np import pytorch_lightning as pl import torch +if torch.__version__ >= "1.8": + import torch_npu import torch.nn as nn import torch.nn.functional as F from einops import rearrange, repeat -- Gitee From 60398636d0d1e1274aa7b6f30ce21d1e29be300f Mon Sep 17 00:00:00 2001 From: yang-jinwu Date: Tue, 8 Nov 2022 18:56:53 +0800 Subject: [PATCH 02/10] README.md --- .../classification/Centroids-reid/README.md | 205 +++++++++++++----- 1 file changed, 155 insertions(+), 50 deletions(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/README.md b/PyTorch/contrib/cv/classification/Centroids-reid/README.md index 5f96417322..16e1df756e 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/README.md +++ b/PyTorch/contrib/cv/classification/Centroids-reid/README.md @@ -1,50 +1,155 @@ -### Centroids-reid -在数据集DukeMTMC-reID实现对Centroids-reid的训练。 -- 数据下载地址: -https://ascend-pytorch-one-datasets.obs.cn-north-4.myhuaweicloud.com:443/train/zip/DukeMTMC-reID.zip -### Centroids-reid的实现细节 -### 环境准备 -- 安装PyTorch(pytorch.org) -- pip install -r requirements.txt -- 下载数据集DukeMTMC-reID,请在下载和解压时确保硬盘空间充足。 -- 请在data文件夹遵循以下的目录结构。 -``` -|-- data -| |-- DukeMTMC-reID -| | |-- bounding_box_test/ -| | |-- bounding_box_train/ - ...... -``` -- 下载权重文件,并放在models文件夹下,models文件夹遵循以下的目录结构。 -``` -权重文件下载链接: -|-- models -| |-- resnet50-19c8e357.pth -``` -### 模型训练 -- 注意,在Centroids-reid目录下会自动保存代码运行的日志。 -- 运行脚本文件进行模型训练: -``` -# 1p train perf -bash test/train_performance_1p.sh --data_path=xxx - -# 8p train perf -bash test/train_performance_8p.sh --data_path=xxx - -# 1p train full -bash test/train_full_1p.sh --data_path=xxx - -# 8p train full -bash test/train_full_8p.sh --data_path=xxx -``` -### 训练结果 -Centroids-reid pytorch-lightning rusult -| 服务器类型 | 性能 | 是否收敛 | MAP | -|------- |---------- |------ |-------- | -| GPU1卡 | 1.91it/s | 是 | 0.95844 | -| GPU8卡 | 1.20it/s | 是 | 0.94051 | -| NPU1卡 | 2.26it/s | 是 | 0.96056 | -| NPU8卡 | 1.30it/s | 是 | 0.95472 | -### 其他说明 -- 在centroids-reid-main/configs目录下找到256_resnet50.yml,将文件中的PRETRAIN_PATH修改为权重文件resnet50-19c8e357.pth的当前路径 - +# Centroids-Reid for PyTorch + +- [概述](概述.md) +- [准备训练环境](准备训练环境.md) +- [开始训练](开始训练.md) +- [训练结果展示](训练结果展示.md) +- [版本说明](版本说明.md) + + + +# 概述 + +## 简述 + +图像检索任务包括从一组图库(数据库)图像中查找与查询图像相似的图像。此类系统用于各种应用,例如人员重新识别(ReD)或视觉产品搜索。尽管检索模型得到了积极的发展,但它仍然是一项具有挑战性的任务,这主要是由于视角、光照、背景杂波或遮挡变化引起的类内方差较大,而类间方差可能相对较低。目前,很大一部分研究集中在创建更健壮的特征和修改目标函数上,通常基于三重损失。一些作品尝试使用类的形心/代理表示来缓解计算速度和与三元组损失一起使用的硬样本挖掘的问题。然而,这些方法仅用于训练,在检索阶段被丢弃。在本文中,我们建议在训练和检索过程中使用平均质心表示。这种聚集表示对异常值更为稳健,并确保了更稳定的特征。由于每个类都由一个嵌入表示,即类质心,因此检索时间和存储要求都显著降低。由于降低了候选目标向量的数量,聚合多个嵌入导致了搜索空间的显著减少,这使得该方法特别适合于生产部署。在两个ReID和时尚检索数据集上进行的综合实验证明了该方法的有效性,优于现有技术。 + +- 参考实现: + + ``` + url=https://github.com/pytorch/vision.git + commit_id=xxx + ``` + +- 适配昇腾 AI 处理器的实现: + + ``` + url=https://gitee.com/ascend/ModelZoo-PyTorch.git + code_path=PyTorch/contrib/cv/classification + ``` + +- 通过Git获取代码方法如下: + + ``` + git clone {url} # 克隆仓库的代码 + cd {code_path} # 切换到模型代码所在路径,若仓库下只有该模型,则无需切换 + ``` + +- 通过单击“立即下载”,下载源码包。 + +# 准备训练环境 + +## 准备环境 + +- 当前模型支持的固件与驱动、 CANN 以及 PyTorch 如下表所示。 + + **表 1** 版本配套表 + + | 配套 | 版本 | + | ---------- | ------------------------------------------------------------ | + | 固件与驱动 | [5.1.RC2](https://www.hiascend.com/hardware/firmware-drivers?tag=commercial) | + | CANN | [5.1.RC2](https://www.hiascend.com/software/cann/commercial?version=5.1.RC2) | + | PyTorch | [1.8.1](https://gitee.com/ascend/pytorch/tree/master/)| + +- 安装依赖(根据模型需求,按需添加所需依赖)。 + + ``` + pip install -r requirements.txt + ``` + + +## 准备数据集 + +1. 获取数据集。 + + 在数据集DukeMTMC-reID实现对Centroids-reid的训练。 + + 数据集目录结构参考如下所示。 + + ``` + ├── data + ├──DukeMTMC-reID + ├──bounding_box_test/ + ├──bounding_box_train/ + ├──... + ``` + +2. 数据预处理(按需处理所需要的数据集)。 + +# 开始训练 + +## 训练模型 + +1. 进入解压后的源码包根目录。 + + ``` + cd /${模型文件夹名称} + ``` + +2. 运行训练脚本。 + + 该模型支持单机单卡训练和单机8卡训练。 + + - 单机单卡训练 + + 启动单卡训练。 + + ``` + bash ./test/train_full_1p.sh --data_path=/data/xxx/ + ``` + + - 单机8卡训练 + + 启动8卡训练。 + + ``` + bash ./test/train_full_8p.sh --data_path=/data/xxx/ + ``` + + --data\_path参数填写数据集路径。 + + 模型训练脚本参数说明如下。 + + ``` + --GPU_IDS //指定训练用卡 + --DATASETS.NAMES //数据集名称 + --DATASETS.ROOT_DIR //数据集根目录 + --SOLVER.IMS_PER_BATCH //训练批次大小 + --SOLVER.MAX_EPOCHS //训练最大的epoch数 + --TEST.IMS_PER_BATCH //测试批次大小 + --SOLVER.BASE_LR //初始学习率 + --OUTPUT_DIR //输出目录 + ``` + + 训练完成后,权重文件保存在当前路径下,并输出模型训练精度和性能信息。 + +# 训练结果展示 + +**表 2** 训练结果展示表 + +| pytorch版本 | NAME | 性能 | 是否收敛 | MAP | +| ------- | ----- | --- | ------ |-----| +| pytorch1.5 | 1p-NPU | 2.26it/s | 是 | 0.96056 | +| pytorch1.5 | 8p-NPU | 1.30it/s | 是 | 0.95472 | +| pytorch1.8 | 1p-NPU | 3.06it/s | 是 | - | +| pytorch1.8 | 8p-NPU | 1.10it/s | 是 | 0.95936 | + +# 版本说明 + +## 变更 +2022.11.8更新 + +## 已知问题 + +无。 + + + + + + + + + + + -- Gitee From 2db4f7c4e539155c0dc4719a97c4d4666fd7bcb8 Mon Sep 17 00:00:00 2001 From: yang-jinwu Date: Tue, 15 Nov 2022 15:24:57 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9BASH=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cv/classification/Centroids-reid/test/train_full_8p.sh | 5 +++-- .../Centroids-reid/test/train_performance_1p.sh | 5 +++-- .../Centroids-reid/test/train_performance_8p.sh | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/test/train_full_8p.sh b/PyTorch/contrib/cv/classification/Centroids-reid/test/train_full_8p.sh index f5dab631fc..554d330545 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/test/train_full_8p.sh +++ b/PyTorch/contrib/cv/classification/Centroids-reid/test/train_full_8p.sh @@ -132,7 +132,8 @@ e2e_time=$(( $end_time - $start_time )) echo "------------------ Final result ------------------" #输出性能FPS,需要模型审视修改 ASCEND_DEVICE_ID=0 -FPS=`grep -a 'it/s' ${test_path_dir}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|grep 'Epoch'|awk -F "it/s" '{print $1}'|awk -F ',' '{print $2}'|sed 's/ //g'|awk 'END {print}'` +average_time=`grep -a "step time:" ${test_path_dir}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk -F "step time:" '{print $2}'|awk -F "," '{print $1}'|tail -n +5|awk '{sum += $1} END {print sum/NR}'` +FPS=`echo "${batch_size}/${average_time}"|bc` #打印,不需要修改 echo "Final Performance images/sec : $FPS" @@ -169,4 +170,4 @@ echo "ActualFPS = ${ActualFPS}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${ echo "TrainingTime = ${TrainingTime}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "TrainAccuracy = ${train_accuracy}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "ActualLoss = ${ActualLoss}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log -echo "E2ETrainingTime = ${e2e_time}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log \ No newline at end of file +echo "E2ETrainingTime = ${e2e_time}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_1p.sh b/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_1p.sh index 95dd76ab92..c90a1b220b 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_1p.sh +++ b/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_1p.sh @@ -108,7 +108,8 @@ e2e_time=$(( $end_time - $start_time )) #结果打印,不需要修改 echo "------------------ Final result ------------------" #输出性能FPS,需要模型审视修改 -FPS=`grep -a 'it/s' ${test_path_dir}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk -F "it/s" '{print $1}'|awk -F ',' '{print $2}'|sed 's/ //g'|awk 'END {print}'` +average_time=`grep -a "step time:" ${test_path_dir}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk -F "step time:" '{print $2}'|awk -F "," '{print $1}'|tail -n +5|awk '{sum += $1} END {print sum/NR}'` +FPS=`echo "${batch_size}/${average_time}"|bc` #打印,不需要修改 echo "Final Performance images/sec : $FPS" @@ -145,4 +146,4 @@ echo "ActualFPS = ${ActualFPS}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${ echo "TrainingTime = ${TrainingTime}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "TrainAccuracy = ${train_accuracy}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "ActualLoss = ${ActualLoss}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log -echo "E2ETrainingTime = ${e2e_time}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log \ No newline at end of file +echo "E2ETrainingTime = ${e2e_time}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_8p.sh b/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_8p.sh index f776486a70..92d806d70d 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_8p.sh +++ b/PyTorch/contrib/cv/classification/Centroids-reid/test/train_performance_8p.sh @@ -132,7 +132,8 @@ e2e_time=$(( $end_time - $start_time )) echo "------------------ Final result ------------------" #输出性能FPS,需要模型审视修改 ASCEND_DEVICE_ID=0 -FPS=`grep -a 'it/s' ${test_path_dir}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk -F "it/s" '{print $1}'|awk -F ',' '{print $2}'|sed 's/ //g'|awk 'END {print}'` +average_time=`grep -a "step time:" ${test_path_dir}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log|awk -F "step time:" '{print $2}'|awk -F "," '{print $1}'|tail -n +5|awk '{sum += $1} END {print sum/NR}'` +FPS=`echo "${batch_size}/${average_time}"|bc` #打印,不需要修改 echo "Final Performance images/sec : $FPS" @@ -169,4 +170,4 @@ echo "ActualFPS = ${ActualFPS}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${ echo "TrainingTime = ${TrainingTime}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "TrainAccuracy = ${train_accuracy}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "ActualLoss = ${ActualLoss}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log -echo "E2ETrainingTime = ${e2e_time}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log \ No newline at end of file +echo "E2ETrainingTime = ${e2e_time}" >> ${test_path_dir}/output/$ASCEND_DEVICE_ID/${CaseName}.log -- Gitee From 2ba7180885b5ce763a62d6872d8c89571db8de07 Mon Sep 17 00:00:00 2001 From: yang-jinwu Date: Sun, 27 Nov 2022 08:52:18 +0800 Subject: [PATCH 04/10] requirements.txt --- .../contrib/cv/classification/Centroids-reid/requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt b/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt index ee281ca7c7..318807e26a 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt +++ b/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt @@ -6,3 +6,6 @@ pytorch-lightning==1.1.4 torchvision tqdm yacs +if args.data +protobuf==3.19.6 + -- Gitee From 54cfdb50e84038b04133701516e778a3febed098 Mon Sep 17 00:00:00 2001 From: chenping68 Date: Thu, 15 Dec 2022 11:21:13 +0800 Subject: [PATCH 05/10] README.md --- .../Centroids-reid/.README.md.swp | Bin 0 -> 4096 bytes .../Centroids-reid/.readme.md.swp | Bin 0 -> 4096 bytes .../classification/Centroids-reid/README.md | 52 ++++++++++-------- 3 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 PyTorch/contrib/cv/classification/Centroids-reid/.README.md.swp create mode 100644 PyTorch/contrib/cv/classification/Centroids-reid/.readme.md.swp diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/.README.md.swp b/PyTorch/contrib/cv/classification/Centroids-reid/.README.md.swp new file mode 100644 index 0000000000000000000000000000000000000000..da9ed3ae1d54f4f8ae77dfeda3f5cce8b56a87ec GIT binary patch literal 4096 zcmeIu%?g4*5C`ymfgtJytS()2v=4%AQ64-<5!Inf=cp-TzEO{vMJExu$INNw zKMVuE*gXZIwQy#vt}bKGdCJEa@a2{7d!NHCXBr4P7i z2vNxFjA-ww18SaJJot9Nu_(2Qf!~2=kumD3cvLDZU@hwnDq(Cbm4Lm!+JwH7i2GB literal 0 HcmV?d00001 diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/README.md b/PyTorch/contrib/cv/classification/Centroids-reid/README.md index 16e1df756e..c0def64b19 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/README.md +++ b/PyTorch/contrib/cv/classification/Centroids-reid/README.md @@ -17,8 +17,8 @@ - 参考实现: ``` - url=https://github.com/pytorch/vision.git - commit_id=xxx + url=https://github.com/mikwieczorek/centroids-reid + commit_id=a1825b7a92b2a8d5e223708c7c43ab58a46efbcf ``` - 适配昇腾 AI 处理器的实现: @@ -47,11 +47,12 @@ | 配套 | 版本 | | ---------- | ------------------------------------------------------------ | - | 固件与驱动 | [5.1.RC2](https://www.hiascend.com/hardware/firmware-drivers?tag=commercial) | - | CANN | [5.1.RC2](https://www.hiascend.com/software/cann/commercial?version=5.1.RC2) | + |硬件 | [1.0.17](https://www.hiascend.com/hardware/firmware-drivers?tag=commercial) + | NPU固件与驱动 | [6.0.RC1](https://www.hiascend.com/hardware/firmware-drivers?tag=commercial) | + | CANN | [6.0.RC1](https://www.hiascend.com/software/cann/commercial?version=6.0.RC1) | | PyTorch | [1.8.1](https://gitee.com/ascend/pytorch/tree/master/)| -- 安装依赖(根据模型需求,按需添加所需依赖)。 +- 安装依赖。 ``` pip install -r requirements.txt @@ -60,11 +61,11 @@ ## 准备数据集 -1. 获取数据集。 +1.获取数据集。 在数据集DukeMTMC-reID实现对Centroids-reid的训练。 - - 数据集目录结构参考如下所示。 + 用户自行获取原始数据集,可选用的开源数据集DukeMTMC-reID,将数据集上传到在源码包根目录下新建的“data/”目录下并解压。 + 以DukeMTMC-reID数据集为例,数据集目录结构参考如下所示。 ``` ├── data @@ -73,9 +74,14 @@ ├──bounding_box_train/ ├──... ``` + 下载resnet50-19c8e357.pth(https://download.pytorch.org/models/resnet50-19c8e357.pth)权重文件,并放到在源码包根目录下新建的“models/”文件夹下,“models/”文件夹遵循以下的目录结构。 -2. 数据预处理(按需处理所需要的数据集)。 - + ``` + |-- models + | |-- resnet50-19c8e357.pth + ``` + +2.获取预训练模型 # 开始训练 ## 训练模型 @@ -88,22 +94,22 @@ 2. 运行训练脚本。 - 该模型支持单机单卡训练和单机8卡训练。 + 该模型支持单机单卡性能和单机8卡训练。 - - 单机单卡训练 + - 单机单卡性能 - 启动单卡训练。 + 启动单卡性能。 ``` - bash ./test/train_full_1p.sh --data_path=/data/xxx/ + bash ./test/train_performance_1p.sh --data_path=/data/xxx/ ``` - - 单机8卡训练 + - 单机8卡性能 - 启动8卡训练。 + 启动8卡性能。 ``` - bash ./test/train_full_8p.sh --data_path=/data/xxx/ + bash ./test/train_performance_8p.sh --data_path=/data/xxx/ ``` --data\_path参数填写数据集路径。 @@ -129,15 +135,17 @@ | pytorch版本 | NAME | 性能 | 是否收敛 | MAP | | ------- | ----- | --- | ------ |-----| -| pytorch1.5 | 1p-NPU | 2.26it/s | 是 | 0.96056 | -| pytorch1.5 | 8p-NPU | 1.30it/s | 是 | 0.95472 | -| pytorch1.8 | 1p-NPU | 3.06it/s | 是 | - | -| pytorch1.8 | 8p-NPU | 1.10it/s | 是 | 0.95936 | +| pytorch1.5 | 1p-NPU | 47it/s | 是 | 0.96056 | +| pytorch1.5 | 8p-NPU | 287it/s | 是 | 0.95472 | +| pytorch1.8 | 1p-NPU | 87it/s | 是 | - | +| pytorch1.8 | 8p-NPU | 879it/s | 是 | 0.96407 | # 版本说明 ## 变更 -2022.11.8更新 +2022.11.08:更新torch1.8版本,重新发布。 + +2022.08..24:首次发布。 ## 已知问题 -- Gitee From 61b7f8f5e851deedcba225b370acaac50ca1745a Mon Sep 17 00:00:00 2001 From: chenping68 Date: Thu, 15 Dec 2022 12:12:36 +0800 Subject: [PATCH 06/10] README.md --- .../contrib/cv/classification/Centroids-reid/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/README.md b/PyTorch/contrib/cv/classification/Centroids-reid/README.md index c0def64b19..36ddb8ab93 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/README.md +++ b/PyTorch/contrib/cv/classification/Centroids-reid/README.md @@ -104,6 +104,14 @@ bash ./test/train_performance_1p.sh --data_path=/data/xxx/ ``` + - 单机8卡训练 + + 启动8卡训练。 + + ``` + bash ./test/train_full_8p.sh --data_path=/data/xxx/ + ``` + - 单机8卡性能 启动8卡性能。 -- Gitee From 49b54a8bc44204033bf7696f7f576b3b9a659b08 Mon Sep 17 00:00:00 2001 From: chenping68 Date: Thu, 15 Dec 2022 14:41:58 +0800 Subject: [PATCH 07/10] README.md --- PyTorch/contrib/cv/classification/Centroids-reid/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/README.md b/PyTorch/contrib/cv/classification/Centroids-reid/README.md index 36ddb8ab93..745919fabd 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/README.md +++ b/PyTorch/contrib/cv/classification/Centroids-reid/README.md @@ -103,8 +103,8 @@ ``` bash ./test/train_performance_1p.sh --data_path=/data/xxx/ ``` - - - 单机8卡训练 + + - 单机8卡训练 启动8卡训练。 -- Gitee From 8dff204116cb212304da0c8234db9fa0ea948845 Mon Sep 17 00:00:00 2001 From: chenping68 Date: Thu, 15 Dec 2022 16:21:06 +0800 Subject: [PATCH 08/10] README.md --- .../Centroids-reid/.README.md.swp | Bin 4096 -> 16384 bytes .../classification/Centroids-reid/README.md | 47 ++++++++++-------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/.README.md.swp b/PyTorch/contrib/cv/classification/Centroids-reid/.README.md.swp index da9ed3ae1d54f4f8ae77dfeda3f5cce8b56a87ec..605b6bbc01f518c03960f3f89b88c832ea7ec635 100644 GIT binary patch literal 16384 zcmeHNS!^5E6`ibgwkBxN^s|#V0c4|`k!Z=13%G$|D~SNh7GybXnivX2jxE-bsFHMK z#|}!Zq%2WOv|5X`SX;c1@+MOxMSZj%O^~7miWXha6tU;c47<5S+P?qvUi*;_X#O08xzvFUQN>7%%-1e%99MQNF?XFs{ z+gT~v-xBTBHjl@7#A&yAovvDOkAxhT)8VnWC8t9yD=OSuQY6$kHc)0JnGBc=+{M5X z+zx9_Hcj06>@)nAzjWxXeDl#{z+}K=z+}K=z+}K=z+}K=z+~Y6nE`Lz{oMD_!269x zzG__WyX*RZ@tis_eCw`!DlG zyYmNO*9m&y$NT@(`TzEl9Cr)&02l_|0$u{11)c$T;A_Csz*m6BfJcF?kD?6l6!0YQ z2=KEC z2%G}m1`Y#n09$~_!yNY-@Yjbpt_OGpC<1l>R^aQvqrii}1Hk>j9T4$n;8(yefg#`y z0w3eRIbaZI0VE(FcpUgC0w?bSx4_@Wz^{Q10en8eO#>4^05}Qg9H)F>D^KD+GS{w! zE~~L7&MIh~H%Zq(a;ll7DD#u#Tsz0}JjI)DzDX~qDJ&M=EqQ7sZ(g<~XP3P|+L4zp z)OoA)0?4ePUsib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syt8hkKBjdA;NXuAf!rsDiG`#$vPul z6-SO&SO3TA8KoPkXF1Gp_TLz0pT|VbXEL!F7c?%u85@~-Y)zC*~}v)*J0Zpj~|K6!WR{OH$^u@1&<2yy}9a5gHfLU!P%;qY;>O PuU~c9SeBSRCY1XZjay<* delta 45 zcmZo@U~EuONHPfX^i?p|GhqM%0S1N@rdi1v`JTyE{tOI7`S~RiFRE;G*~1S2{YVUn diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/README.md b/PyTorch/contrib/cv/classification/Centroids-reid/README.md index 745919fabd..37881da47e 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/README.md +++ b/PyTorch/contrib/cv/classification/Centroids-reid/README.md @@ -52,6 +52,10 @@ | CANN | [6.0.RC1](https://www.hiascend.com/software/cann/commercial?version=6.0.RC1) | | PyTorch | [1.8.1](https://gitee.com/ascend/pytorch/tree/master/)| +- 环境准备指导。 + + 请参考[《Pytorch框架训练环境准备》](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/ptes) + - 安装依赖。 ``` @@ -61,7 +65,7 @@ ## 准备数据集 -1.获取数据集。 +获取数据集。 在数据集DukeMTMC-reID实现对Centroids-reid的训练。 用户自行获取原始数据集,可选用的开源数据集DukeMTMC-reID,将数据集上传到在源码包根目录下新建的“data/”目录下并解压。 @@ -74,14 +78,15 @@ ├──bounding_box_train/ ├──... ``` - 下载resnet50-19c8e357.pth(https://download.pytorch.org/models/resnet50-19c8e357.pth)权重文件,并放到在源码包根目录下新建的“models/”文件夹下,“models/”文件夹遵循以下的目录结构。 + +## 获取预训练模型 + 下载[resnet50-19c8e357.pth](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/ptes)权重文件,并放到在源码包根目录下新建的“models/”文件夹下,“models/”文件夹遵循以下的目录结构。 ``` |-- models | |-- resnet50-19c8e357.pth ``` - -2.获取预训练模型 + # 开始训练 ## 训练模型 @@ -104,25 +109,25 @@ bash ./test/train_performance_1p.sh --data_path=/data/xxx/ ``` - - 单机8卡训练 - - 启动8卡训练。 - - ``` - bash ./test/train_full_8p.sh --data_path=/data/xxx/ - ``` - - - 单机8卡性能 - - 启动8卡性能。 - - ``` - bash ./test/train_performance_8p.sh --data_path=/data/xxx/ - ``` - + - 单机8卡训练 + + 启动8卡训练。 + + ``` + bash ./test/train_full_8p.sh --data_path=/data/xxx/ + ``` + + - 单机8卡性能 + + 启动8卡性能。 + + ``` + bash ./test/train_performance_8p.sh --data_path=/data/xxx/ + ``` + --data\_path参数填写数据集路径。 - 模型训练脚本参数说明如下。 + 模型训练脚本参数说明如下: ``` --GPU_IDS //指定训练用卡 -- Gitee From 2f7abc963acec271636bd43ded4b5ac73d4b61c5 Mon Sep 17 00:00:00 2001 From: chenping68 Date: Thu, 15 Dec 2022 16:26:21 +0800 Subject: [PATCH 09/10] README.md --- PyTorch/contrib/cv/classification/Centroids-reid/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/README.md b/PyTorch/contrib/cv/classification/Centroids-reid/README.md index 37881da47e..5660ba6d2e 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/README.md +++ b/PyTorch/contrib/cv/classification/Centroids-reid/README.md @@ -54,7 +54,7 @@ - 环境准备指导。 - 请参考[《Pytorch框架训练环境准备》](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/ptes) + 请参考[《Pytorch框架训练环境准备》](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/ptes)。 - 安装依赖。 @@ -80,7 +80,7 @@ ``` ## 获取预训练模型 - 下载[resnet50-19c8e357.pth](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/ptes)权重文件,并放到在源码包根目录下新建的“models/”文件夹下,“models/”文件夹遵循以下的目录结构。 + 下载[resnet50-19c8e357.pth](https://download.pytorch.org/models/resnet50-19c8e357.pth)权重文件,并放到在源码包根目录下新建的“models/”文件夹下,“models/”文件夹遵循以下的目录结构。 ``` |-- models -- Gitee From 7030627fa14308eb269617d9d7218460de6300de Mon Sep 17 00:00:00 2001 From: yjw Date: Tue, 27 Dec 2022 15:17:09 +0800 Subject: [PATCH 10/10] Centroids-reid --- .../contrib/cv/classification/Centroids-reid/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt b/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt index 318807e26a..3f87de6622 100644 --- a/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt +++ b/PyTorch/contrib/cv/classification/Centroids-reid/requirements.txt @@ -1,3 +1,4 @@ + einops mlflow opencv-python @@ -6,6 +7,5 @@ pytorch-lightning==1.1.4 torchvision tqdm yacs -if args.data protobuf==3.19.6 -- Gitee