diff --git a/detect.py b/detect.py index f791faa0908..dbd9e8550bc 100644 --- a/detect.py +++ b/detect.py @@ -31,12 +31,19 @@ import argparse import csv import os +import pathlib import platform import sys from pathlib import Path import torch +# Updating PosixPath on Windows for compatibility +if sys.platform == "win32": + temp = pathlib.PosixPath + pathlib.PosixPath = pathlib.WindowsPath + del temp + FILE = Path(__file__).resolve() ROOT = FILE.parents[0] # YOLOv5 root directory if str(ROOT) not in sys.path: