Update sys.path.append(str(ROOT)) (#4852)
* Update `sys.path.append(str(ROOT))` * Cleanup
This commit is contained in:
1 parent
3732f9ac8a
commit
4d1a2ac87e
10 files changed
+30
-32
No files matched your search
@@ -1,19 +0,0 @@
|
||||
# import sys
|
||||
# from pathlib import Path
|
||||
#
|
||||
# import torch
|
||||
# from PIL import ImageFont
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# # Check YOLOv5 Annotator font
|
||||
# font = 'Arial.ttf'
|
||||
# try:
|
||||
# ImageFont.truetype(font)
|
||||
# except Exception as e: # download if missing
|
||||
# url = "https://ultralytics.com/assets/" + font
|
||||
# print(f'Downloading {url} to {ROOT / font}...')
|
||||
# torch.hub.download_url_to_file(url, str(ROOT / font))
|
||||
+4
-1
@@ -8,7 +8,10 @@ from pathlib import Path
|
||||
import torch
|
||||
import yaml
|
||||
|
||||
sys.path.append('./') # to run '$ python *.py' files in subdirectories
|
||||
FILE = Path(__file__).resolve()
|
||||
ROOT = FILE.parents[2] # YOLOv5 root directory
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.append(str(ROOT)) # add ROOT to PATH
|
||||
|
||||
port = 0 # --master_port
|
||||
path = Path('').resolve()
|
||||
|
||||
@@ -4,7 +4,9 @@ from pathlib import Path
|
||||
import wandb
|
||||
|
||||
FILE = Path(__file__).resolve()
|
||||
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path
|
||||
ROOT = FILE.parents[3] # YOLOv5 root directory
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.append(str(ROOT)) # add ROOT to PATH
|
||||
|
||||
from train import train, parse_opt
|
||||
from utils.general import increment_path
|
||||
|
||||
@@ -11,7 +11,9 @@ import yaml
|
||||
from tqdm import tqdm
|
||||
|
||||
FILE = Path(__file__).resolve()
|
||||
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path
|
||||
ROOT = FILE.parents[3] # YOLOv5 root directory
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.append(str(ROOT)) # add ROOT to PATH
|
||||
|
||||
from utils.datasets import LoadImagesAndLabels
|
||||
from utils.datasets import img2label_paths
|
||||
|
||||
Reference in new issue
Block a user