@@ -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 |
@@ -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 |
@@ -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) | |||
@@ -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 * |
@@ -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 |
@@ -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 |
@@ -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): |
@@ -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=''): |
@@ -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 |
@@ -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 |
@@ -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 |