Replace `path.absolute()` with `path.resolve()` (#4763)

pull/4764/head
Glenn Jocher 2021-09-11 22:46:33 +02:00 committed by GitHub
parent cd810c8286
commit c47be26f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 11 additions and 11 deletions

View File

@ -15,7 +15,7 @@ import numpy as np
import torch
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
from models.experimental import attempt_load

View File

@ -15,7 +15,7 @@ import torch
import torch.nn as nn
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
from models.common import Conv

View File

@ -33,7 +33,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
from utils.downloads import attempt_download
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'))
set_logging(verbose=verbose)

View File

@ -11,7 +11,7 @@ import sys
from copy import deepcopy
from pathlib import Path
FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[1].as_posix()) # add yolov5/ to path
from models.common import *

View File

@ -26,7 +26,7 @@ from torch.nn.parallel import DistributedDataParallel as DDP
from torch.optim import Adam, SGD, lr_scheduler
from tqdm import tqdm
FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
import val # for end-of-epoch mAP

View File

@ -4,7 +4,7 @@
# import torch
# from PIL import ImageFont
#
# FILE = Path(__file__).absolute()
# FILE = Path(__file__).resolve()
# ROOT = FILE.parents[1] # yolov5/ dir
# if str(ROOT) not in sys.path:
# sys.path.append(str(ROOT)) # add ROOT to PATH

View File

@ -156,7 +156,7 @@ class _RepeatSampler(object):
class LoadImages: # for inference
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:
files = sorted(glob.glob(p, recursive=True)) # glob
elif os.path.isdir(p):

View File

@ -147,7 +147,7 @@ def is_colab():
def is_pip():
# 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=''):

View File

@ -3,7 +3,7 @@ from pathlib import Path
import wandb
FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path
from train import train, parse_opt

View File

@ -9,7 +9,7 @@ from pathlib import Path
import yaml
from tqdm import tqdm
FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path
from utils.datasets import LoadImagesAndLabels

2
val.py
View File

@ -17,7 +17,7 @@ import numpy as np
import torch
from tqdm import tqdm
FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
from models.experimental import attempt_load