From b9a3e7c0df51930877826c652ea7960d6f2ddc60 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Mon, 11 Jul 2022 14:38:29 +0800 Subject: [PATCH 1/7] Create CommonCommands.txt --- CommonCommands.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 CommonCommands.txt diff --git a/CommonCommands.txt b/CommonCommands.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/CommonCommands.txt @@ -0,0 +1 @@ + From f14cff4bb28544bcd4ba8f49a3754e6956aac754 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Mon, 11 Jul 2022 14:40:03 +0800 Subject: [PATCH 2/7] Update CommonCommands.txt --- CommonCommands.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CommonCommands.txt b/CommonCommands.txt index 8b13789..7ee0934 100644 --- a/CommonCommands.txt +++ b/CommonCommands.txt @@ -1 +1,6 @@ +conda env list +conda create -n yolo_37 python=3.7 -y +conda activate yolo_37 + +pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple From 1e54757ddaa7440454f31dd7db5b8e4e331237c4 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Mon, 11 Jul 2022 14:52:07 +0800 Subject: [PATCH 3/7] Update CommonCommands.txt --- CommonCommands.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CommonCommands.txt b/CommonCommands.txt index 7ee0934..2fb40d7 100644 --- a/CommonCommands.txt +++ b/CommonCommands.txt @@ -4,3 +4,8 @@ conda create -n yolo_37 python=3.7 -y conda activate yolo_37 pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + +# ptorch 官方安装命令 cuda11 linux +pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html //torchaudio==0.10.2+cu113 +# ptorch 官方安装命令 cuda10 linux +pip3 install torch torchvision //torchaudio From 0bc04cd10875caa98806e8ad7b488f2382cb2da4 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Mon, 11 Jul 2022 14:55:03 +0800 Subject: [PATCH 4/7] Update CommonCommands.txt --- CommonCommands.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCommands.txt b/CommonCommands.txt index 2fb40d7..e99f9b4 100644 --- a/CommonCommands.txt +++ b/CommonCommands.txt @@ -1,5 +1,5 @@ conda env list - +nvcc -V conda create -n yolo_37 python=3.7 -y conda activate yolo_37 From 352c19bd1286333b49a02d9ad7d0abd9a80be715 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Mon, 11 Jul 2022 14:59:50 +0800 Subject: [PATCH 5/7] Update CommonCommands.txt --- CommonCommands.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CommonCommands.txt b/CommonCommands.txt index e99f9b4..71f2fe5 100644 --- a/CommonCommands.txt +++ b/CommonCommands.txt @@ -3,9 +3,10 @@ nvcc -V conda create -n yolo_37 python=3.7 -y conda activate yolo_37 -pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple - # ptorch 官方安装命令 cuda11 linux pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html //torchaudio==0.10.2+cu113 # ptorch 官方安装命令 cuda10 linux pip3 install torch torchvision //torchaudio + +pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + From d120e5502e1dfd847e507fb1b184f7e5ff0f9466 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Tue, 12 Jul 2022 17:12:17 +0800 Subject: [PATCH 6/7] Delete CommonCommands.txt --- CommonCommands.txt | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 CommonCommands.txt diff --git a/CommonCommands.txt b/CommonCommands.txt deleted file mode 100644 index 71f2fe5..0000000 --- a/CommonCommands.txt +++ /dev/null @@ -1,12 +0,0 @@ -conda env list -nvcc -V -conda create -n yolo_37 python=3.7 -y -conda activate yolo_37 - -# ptorch 官方安装命令 cuda11 linux -pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html //torchaudio==0.10.2+cu113 -# ptorch 官方安装命令 cuda10 linux -pip3 install torch torchvision //torchaudio - -pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple - From 3a4df4e42ee8a252ec3668ab89d1c2f6755232b6 Mon Sep 17 00:00:00 2001 From: superbayes <56495942+superbayes@users.noreply.github.com> Date: Tue, 12 Jul 2022 17:18:19 +0800 Subject: [PATCH 7/7] Create tool.py Simplify training steps --- utils/tool.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/utils/tool.py b/utils/tool.py index fd4ee4f..77a79e2 100644 --- a/utils/tool.py +++ b/utils/tool.py @@ -8,8 +8,8 @@ def __init__(self, path): with open(path, encoding='utf8') as f: data = yaml.load(f, Loader=yaml.FullLoader) - self.val_txt = data["DATASET"]["VAL"] - self.train_txt = data["DATASET"]["TRAIN"] + self.val_txt = self.getImgPath_toOneFile(data["DATASET"]["VAL"],'val') + self.train_txt = self.getImgPath_toOneFile(data["DATASET"]["TRAIN"],'train') self.names = data["DATASET"]["NAMES"] self.learn_rate = data["TRAIN"]["LR"] @@ -23,6 +23,26 @@ def __init__(self, path): self.category_num = data["MODEL"]["NC"] print("Load yaml sucess...") + + def getImgPath_toOneFile(self,yaml_path:str,name_type:str): + """ + generate txt file : train.txt or val.txt + """ + if yaml_path.endswith('txt'): + return yaml_path + + pre_path = os.path.join(yaml_path,'../') + txt_path = os.path.join(pre_path,name_type+'.txt') + f_txt = open(txt_path,'w') + img_path_list = os.listdir(yaml_path) + imgTypeList = ['jpg','png','bmp'] + for content in img_path_list: + if content.split('.')[-1] not in imgTypeList:continue + img_full_path = os.path.join(yaml_path,content) + f_txt.write(img_full_path + '\n') + pass + f_txt.close() + return txt_path class EMA(): def __init__(self, model, decay):