* use os.path.relpath instead of relative_to * use os.path.relpath instead of relative_to * Remove os.path from val.py * Remove os.path from train.py * Update detect.py import to os * Update export.py import to os Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>modifyDataloader
""" | """ | ||||
import argparse | import argparse | ||||
import os | |||||
import sys | import sys | ||||
from pathlib import Path | from pathlib import Path | ||||
ROOT = FILE.parents[0] # YOLOv5 root directory | ROOT = FILE.parents[0] # YOLOv5 root directory | ||||
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 | ||||
ROOT = ROOT.relative_to(Path.cwd()) # relative | |||||
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative | |||||
from models.experimental import attempt_load | from models.experimental import attempt_load | ||||
from utils.datasets import LoadImages, LoadStreams | from utils.datasets import LoadImages, LoadStreams |
""" | """ | ||||
import argparse | import argparse | ||||
import os | |||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
import time | import time | ||||
ROOT = FILE.parents[0] # YOLOv5 root directory | ROOT = FILE.parents[0] # YOLOv5 root directory | ||||
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 | ||||
ROOT = ROOT.relative_to(Path.cwd()) # relative | |||||
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative | |||||
from models.common import Conv | from models.common import Conv | ||||
from models.experimental import attempt_load | from models.experimental import attempt_load |
ROOT = FILE.parents[0] # YOLOv5 root directory | ROOT = FILE.parents[0] # YOLOv5 root directory | ||||
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 | ||||
ROOT = ROOT.relative_to(Path.cwd()) # relative | |||||
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative | |||||
import val # for end-of-epoch mAP | import val # for end-of-epoch mAP | ||||
from models.experimental import attempt_load | from models.experimental import attempt_load |
ROOT = FILE.parents[0] # YOLOv5 root directory | ROOT = FILE.parents[0] # YOLOv5 root directory | ||||
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 | ||||
ROOT = ROOT.relative_to(Path.cwd()) # relative | |||||
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative | |||||
from models.experimental import attempt_load | from models.experimental import attempt_load | ||||
from utils.datasets import create_dataloader | from utils.datasets import create_dataloader |