Replace `path.absolute()` with `path.resolve()` (#4763)
Browse files- detect.py +1 -1
- export.py +1 -1
- hubconf.py +1 -1
- models/yolo.py +1 -1
- train.py +1 -1
- utils/__init__.py +1 -1
- utils/datasets.py +1 -1
- utils/general.py +1 -1
- utils/loggers/wandb/sweep.py +1 -1
- utils/loggers/wandb/wandb_utils.py +1 -1
- val.py +1 -1
detect.py
CHANGED
@@ -15,7 +15,7 @@ import numpy as np
|
|
15 |
import torch
|
16 |
import torch.backends.cudnn as cudnn
|
17 |
|
18 |
-
FILE = Path(__file__).
|
19 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
20 |
|
21 |
from models.experimental import attempt_load
|
|
|
15 |
import torch
|
16 |
import torch.backends.cudnn as cudnn
|
17 |
|
18 |
+
FILE = Path(__file__).resolve()
|
19 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
20 |
|
21 |
from models.experimental import attempt_load
|
export.py
CHANGED
@@ -15,7 +15,7 @@ import torch
|
|
15 |
import torch.nn as nn
|
16 |
from torch.utils.mobile_optimizer import optimize_for_mobile
|
17 |
|
18 |
-
FILE = Path(__file__).
|
19 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
20 |
|
21 |
from models.common import Conv
|
|
|
15 |
import torch.nn as nn
|
16 |
from torch.utils.mobile_optimizer import optimize_for_mobile
|
17 |
|
18 |
+
FILE = Path(__file__).resolve()
|
19 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
20 |
|
21 |
from models.common import Conv
|
hubconf.py
CHANGED
@@ -33,7 +33,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
|
|
33 |
from utils.downloads import attempt_download
|
34 |
from utils.torch_utils import select_device
|
35 |
|
36 |
-
file = Path(__file__).
|
37 |
check_requirements(requirements=file.parent / 'requirements.txt', exclude=('tensorboard', 'thop', 'opencv-python'))
|
38 |
set_logging(verbose=verbose)
|
39 |
|
|
|
33 |
from utils.downloads import attempt_download
|
34 |
from utils.torch_utils import select_device
|
35 |
|
36 |
+
file = Path(__file__).resolve()
|
37 |
check_requirements(requirements=file.parent / 'requirements.txt', exclude=('tensorboard', 'thop', 'opencv-python'))
|
38 |
set_logging(verbose=verbose)
|
39 |
|
models/yolo.py
CHANGED
@@ -11,7 +11,7 @@ import sys
|
|
11 |
from copy import deepcopy
|
12 |
from pathlib import Path
|
13 |
|
14 |
-
FILE = Path(__file__).
|
15 |
sys.path.append(FILE.parents[1].as_posix()) # add yolov5/ to path
|
16 |
|
17 |
from models.common import *
|
|
|
11 |
from copy import deepcopy
|
12 |
from pathlib import Path
|
13 |
|
14 |
+
FILE = Path(__file__).resolve()
|
15 |
sys.path.append(FILE.parents[1].as_posix()) # add yolov5/ to path
|
16 |
|
17 |
from models.common import *
|
train.py
CHANGED
@@ -26,7 +26,7 @@ from torch.nn.parallel import DistributedDataParallel as DDP
|
|
26 |
from torch.optim import Adam, SGD, lr_scheduler
|
27 |
from tqdm import tqdm
|
28 |
|
29 |
-
FILE = Path(__file__).
|
30 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
31 |
|
32 |
import val # for end-of-epoch mAP
|
|
|
26 |
from torch.optim import Adam, SGD, lr_scheduler
|
27 |
from tqdm import tqdm
|
28 |
|
29 |
+
FILE = Path(__file__).resolve()
|
30 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
31 |
|
32 |
import val # for end-of-epoch mAP
|
utils/__init__.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
# import torch
|
5 |
# from PIL import ImageFont
|
6 |
#
|
7 |
-
# FILE = Path(__file__).
|
8 |
# ROOT = FILE.parents[1] # yolov5/ dir
|
9 |
# if str(ROOT) not in sys.path:
|
10 |
# sys.path.append(str(ROOT)) # add ROOT to PATH
|
|
|
4 |
# import torch
|
5 |
# from PIL import ImageFont
|
6 |
#
|
7 |
+
# FILE = Path(__file__).resolve()
|
8 |
# ROOT = FILE.parents[1] # yolov5/ dir
|
9 |
# if str(ROOT) not in sys.path:
|
10 |
# sys.path.append(str(ROOT)) # add ROOT to PATH
|
utils/datasets.py
CHANGED
@@ -156,7 +156,7 @@ class _RepeatSampler(object):
|
|
156 |
|
157 |
class LoadImages: # for inference
|
158 |
def __init__(self, path, img_size=640, stride=32, auto=True):
|
159 |
-
p = str(Path(path).
|
160 |
if '*' in p:
|
161 |
files = sorted(glob.glob(p, recursive=True)) # glob
|
162 |
elif os.path.isdir(p):
|
|
|
156 |
|
157 |
class LoadImages: # for inference
|
158 |
def __init__(self, path, img_size=640, stride=32, auto=True):
|
159 |
+
p = str(Path(path).resolve()) # os-agnostic absolute path
|
160 |
if '*' in p:
|
161 |
files = sorted(glob.glob(p, recursive=True)) # glob
|
162 |
elif os.path.isdir(p):
|
utils/general.py
CHANGED
@@ -147,7 +147,7 @@ def is_colab():
|
|
147 |
|
148 |
def is_pip():
|
149 |
# Is file in a pip package?
|
150 |
-
return 'site-packages' in Path(__file__).
|
151 |
|
152 |
|
153 |
def is_ascii(s=''):
|
|
|
147 |
|
148 |
def is_pip():
|
149 |
# Is file in a pip package?
|
150 |
+
return 'site-packages' in Path(__file__).resolve().parts
|
151 |
|
152 |
|
153 |
def is_ascii(s=''):
|
utils/loggers/wandb/sweep.py
CHANGED
@@ -3,7 +3,7 @@ from pathlib import Path
|
|
3 |
|
4 |
import wandb
|
5 |
|
6 |
-
FILE = Path(__file__).
|
7 |
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path
|
8 |
|
9 |
from train import train, parse_opt
|
|
|
3 |
|
4 |
import wandb
|
5 |
|
6 |
+
FILE = Path(__file__).resolve()
|
7 |
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path
|
8 |
|
9 |
from train import train, parse_opt
|
utils/loggers/wandb/wandb_utils.py
CHANGED
@@ -9,7 +9,7 @@ from pathlib import Path
|
|
9 |
import yaml
|
10 |
from tqdm import tqdm
|
11 |
|
12 |
-
FILE = Path(__file__).
|
13 |
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path
|
14 |
|
15 |
from utils.datasets import LoadImagesAndLabels
|
|
|
9 |
import yaml
|
10 |
from tqdm import tqdm
|
11 |
|
12 |
+
FILE = Path(__file__).resolve()
|
13 |
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path
|
14 |
|
15 |
from utils.datasets import LoadImagesAndLabels
|
val.py
CHANGED
@@ -17,7 +17,7 @@ import numpy as np
|
|
17 |
import torch
|
18 |
from tqdm import tqdm
|
19 |
|
20 |
-
FILE = Path(__file__).
|
21 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
22 |
|
23 |
from models.experimental import attempt_load
|
|
|
17 |
import torch
|
18 |
from tqdm import tqdm
|
19 |
|
20 |
+
FILE = Path(__file__).resolve()
|
21 |
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
22 |
|
23 |
from models.experimental import attempt_load
|