Replace `path.absolute()` with `path.resolve()` (#4763)
This commit is contained in:
parent
cd810c8286
commit
c47be26f34
|
|
@ -15,7 +15,7 @@ import numpy as np
|
||||||
import torch
|
import torch
|
||||||
import torch.backends.cudnn as cudnn
|
import torch.backends.cudnn as cudnn
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
||||||
|
|
||||||
from models.experimental import attempt_load
|
from models.experimental import attempt_load
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.utils.mobile_optimizer import optimize_for_mobile
|
from torch.utils.mobile_optimizer import optimize_for_mobile
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
||||||
|
|
||||||
from models.common import Conv
|
from models.common import Conv
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
|
||||||
from utils.downloads import attempt_download
|
from utils.downloads import attempt_download
|
||||||
from utils.torch_utils import select_device
|
from utils.torch_utils import select_device
|
||||||
|
|
||||||
file = Path(__file__).absolute()
|
file = Path(__file__).resolve()
|
||||||
check_requirements(requirements=file.parent / 'requirements.txt', exclude=('tensorboard', 'thop', 'opencv-python'))
|
check_requirements(requirements=file.parent / 'requirements.txt', exclude=('tensorboard', 'thop', 'opencv-python'))
|
||||||
set_logging(verbose=verbose)
|
set_logging(verbose=verbose)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import sys
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[1].as_posix()) # add yolov5/ to path
|
sys.path.append(FILE.parents[1].as_posix()) # add yolov5/ to path
|
||||||
|
|
||||||
from models.common import *
|
from models.common import *
|
||||||
|
|
|
||||||
2
train.py
2
train.py
|
|
@ -26,7 +26,7 @@ from torch.nn.parallel import DistributedDataParallel as DDP
|
||||||
from torch.optim import Adam, SGD, lr_scheduler
|
from torch.optim import Adam, SGD, lr_scheduler
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
||||||
|
|
||||||
import val # for end-of-epoch mAP
|
import val # for end-of-epoch mAP
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# import torch
|
# import torch
|
||||||
# from PIL import ImageFont
|
# from PIL import ImageFont
|
||||||
#
|
#
|
||||||
# FILE = Path(__file__).absolute()
|
# FILE = Path(__file__).resolve()
|
||||||
# ROOT = FILE.parents[1] # yolov5/ dir
|
# ROOT = FILE.parents[1] # yolov5/ dir
|
||||||
# if str(ROOT) not in sys.path:
|
# if str(ROOT) not in sys.path:
|
||||||
# sys.path.append(str(ROOT)) # add ROOT to PATH
|
# sys.path.append(str(ROOT)) # add ROOT to PATH
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class _RepeatSampler(object):
|
||||||
|
|
||||||
class LoadImages: # for inference
|
class LoadImages: # for inference
|
||||||
def __init__(self, path, img_size=640, stride=32, auto=True):
|
def __init__(self, path, img_size=640, stride=32, auto=True):
|
||||||
p = str(Path(path).absolute()) # os-agnostic absolute path
|
p = str(Path(path).resolve()) # os-agnostic absolute path
|
||||||
if '*' in p:
|
if '*' in p:
|
||||||
files = sorted(glob.glob(p, recursive=True)) # glob
|
files = sorted(glob.glob(p, recursive=True)) # glob
|
||||||
elif os.path.isdir(p):
|
elif os.path.isdir(p):
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ def is_colab():
|
||||||
|
|
||||||
def is_pip():
|
def is_pip():
|
||||||
# Is file in a pip package?
|
# Is file in a pip package?
|
||||||
return 'site-packages' in Path(__file__).absolute().parts
|
return 'site-packages' in Path(__file__).resolve().parts
|
||||||
|
|
||||||
|
|
||||||
def is_ascii(s=''):
|
def is_ascii(s=''):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from pathlib import Path
|
||||||
|
|
||||||
import wandb
|
import wandb
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path
|
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path
|
||||||
|
|
||||||
from train import train, parse_opt
|
from train import train, parse_opt
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from pathlib import Path
|
||||||
import yaml
|
import yaml
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path
|
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path
|
||||||
|
|
||||||
from utils.datasets import LoadImagesAndLabels
|
from utils.datasets import LoadImagesAndLabels
|
||||||
|
|
|
||||||
2
val.py
2
val.py
|
|
@ -17,7 +17,7 @@ import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
FILE = Path(__file__).absolute()
|
FILE = Path(__file__).resolve()
|
||||||
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
||||||
|
|
||||||
from models.experimental import attempt_load
|
from models.experimental import attempt_load
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue