From 815f602f28661a88a88be533d83c35ecfb135a38 Mon Sep 17 00:00:00 2001 From: Malte Lorbach <49158835+maltelorbach@users.noreply.github.com> Date: Mon, 11 Oct 2021 12:01:46 +0200 Subject: [PATCH 1/6] use os.path.relpath instead of relative_to --- train.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/train.py b/train.py index e8034a648cac..471b9763913f 100644 --- a/train.py +++ b/train.py @@ -10,6 +10,7 @@ import logging import math import os +import os.path import random import sys import time @@ -30,7 +31,7 @@ ROOT = FILE.parents[0] # YOLOv5 root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH -ROOT = ROOT.relative_to(Path.cwd()) # relative +ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative import val # for end-of-epoch mAP from models.experimental import attempt_load From 3a0cc1b34dcc8041ff3007cc62bd948f0bebe3c8 Mon Sep 17 00:00:00 2001 From: Malte Lorbach <49158835+maltelorbach@users.noreply.github.com> Date: Mon, 11 Oct 2021 12:01:46 +0200 Subject: [PATCH 2/6] use os.path.relpath instead of relative_to --- detect.py | 3 ++- export.py | 3 ++- train.py | 3 ++- val.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/detect.py b/detect.py index 75ec3ecc5ff3..3335cca85cbd 100644 --- a/detect.py +++ b/detect.py @@ -7,6 +7,7 @@ """ import argparse +import os.path import sys from pathlib import Path @@ -19,7 +20,7 @@ ROOT = FILE.parents[0] # YOLOv5 root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH -ROOT = ROOT.relative_to(Path.cwd()) # relative +ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative from models.experimental import attempt_load from utils.datasets import LoadImages, LoadStreams diff --git a/export.py b/export.py index 74aca4b6c30a..85d8cce3c2e2 100644 --- a/export.py +++ b/export.py @@ -21,6 +21,7 @@ """ import argparse +import os.path import subprocess import sys import time @@ -34,7 +35,7 @@ ROOT = FILE.parents[0] # YOLOv5 root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH -ROOT = ROOT.relative_to(Path.cwd()) # relative +ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative from models.common import Conv from models.experimental import attempt_load diff --git a/train.py b/train.py index e8034a648cac..471b9763913f 100644 --- a/train.py +++ b/train.py @@ -10,6 +10,7 @@ import logging import math import os +import os.path import random import sys import time @@ -30,7 +31,7 @@ ROOT = FILE.parents[0] # YOLOv5 root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH -ROOT = ROOT.relative_to(Path.cwd()) # relative +ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative import val # for end-of-epoch mAP from models.experimental import attempt_load diff --git a/val.py b/val.py index 2cd8eba87443..66f21f1dc724 100644 --- a/val.py +++ b/val.py @@ -9,6 +9,7 @@ import argparse import json import os +import os.path import sys from pathlib import Path from threading import Thread @@ -21,7 +22,7 @@ ROOT = FILE.parents[0] # YOLOv5 root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH -ROOT = ROOT.relative_to(Path.cwd()) # relative +ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative from models.experimental import attempt_load from utils.datasets import create_dataloader From 5fbdf323baa4a4f2e576e50d6bd144c9ea80b59c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 11 Oct 2021 09:35:12 -0700 Subject: [PATCH 3/6] Remove os.path from val.py --- val.py | 1 - 1 file changed, 1 deletion(-) diff --git a/val.py b/val.py index 66f21f1dc724..2fc547322a0a 100644 --- a/val.py +++ b/val.py @@ -9,7 +9,6 @@ import argparse import json import os -import os.path import sys from pathlib import Path from threading import Thread From eb511190c3f58a9423dcc2b1261af88d437eaf61 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 11 Oct 2021 09:36:03 -0700 Subject: [PATCH 4/6] Remove os.path from train.py --- train.py | 1 - 1 file changed, 1 deletion(-) diff --git a/train.py b/train.py index 471b9763913f..29ae43e3bd37 100644 --- a/train.py +++ b/train.py @@ -10,7 +10,6 @@ import logging import math import os -import os.path import random import sys import time From fe1ff1dd7bd3afd029af4ad0b283091b5bfabe7b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 11 Oct 2021 09:37:16 -0700 Subject: [PATCH 5/6] Update detect.py import to os --- detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect.py b/detect.py index 3335cca85cbd..346860e3832f 100644 --- a/detect.py +++ b/detect.py @@ -7,7 +7,7 @@ """ import argparse -import os.path +import os import sys from pathlib import Path From b77881eae3f8ffc25cfda942d659b9d965cc97c8 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 11 Oct 2021 09:37:43 -0700 Subject: [PATCH 6/6] Update export.py import to os --- export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export.py b/export.py index 85d8cce3c2e2..2aca0f341dbd 100644 --- a/export.py +++ b/export.py @@ -21,7 +21,7 @@ """ import argparse -import os.path +import os import subprocess import sys import time