diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000000..5d7fa0864607 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include *.md +include LICENSE +include setup.py +recursive-include yolov5/data * +recursive-include yolov5/models * +recursive-include yolov5/models_v5.0 * +include yolov5/requirements.txt diff --git a/build_wheel.sh b/build_wheel.sh new file mode 100755 index 000000000000..d22717596c27 --- /dev/null +++ b/build_wheel.sh @@ -0,0 +1,11 @@ +python3 -m pip install --upgrade build +mkdir yolov5 +cp -r data models models_v5.0 utils .pre-commit-config.yaml $(ls *.py) requirements.txt yolov5/ +grep --include=\*.py -rnl 'yolov5/' -e "from models" | xargs -i@ sed -i 's/from models/from yolov5.models/g' @ +grep --include=\*.py -rnl 'yolov5/' -e "from utils" | xargs -i@ sed -i 's/from utils/from yolov5.utils/g' @ +sed -i '$d' yolov5/requirements.txt +cat > yolov5/__init__.py << EOF +from yolov5.utils.general import NM_INTEGRATED +EOF +python3 -m build +rm -r yolov5 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000000..b0f076532a06 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 36f39017d6af..c6a19e789077 100755 --- a/requirements.txt +++ b/requirements.txt @@ -35,4 +35,4 @@ seaborn>=0.11.0 # pycocotools>=2.0 # COCO mAP # roboflow thop # FLOPs computation -sparseml[torch,torchvision] >= 0.12 \ No newline at end of file +sparseml[torch,torchvision] >= 0.12 diff --git a/setup.py b/setup.py new file mode 100644 index 000000000000..09083e299981 --- /dev/null +++ b/setup.py @@ -0,0 +1,32 @@ +import setuptools +import os + +def read_requirements(): + build_dir = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(build_dir, "yolov5", "requirements.txt")) as f: + return f.read().splitlines() + +setuptools.setup( + name="yolov5", + version='6.1.0', + author="", + long_description=open("README.md", "r", encoding="utf-8").read(), + long_description_content_type="text/markdown", + url="https://github.com/ultralytics/yolov5", + packages=['yolov5', 'yolov5.models', 'yolov5.utils'], + python_requires=">=3.6", + install_requires=read_requirements(), + include_package_data=True, + package_data={'': ['yolov5/models/*.yaml', 'yolov5/data/*']}, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: GNU General Public License (GPL)", + "Operating System :: OS Independent", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Education", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + ] +) diff --git a/utils/general.py b/utils/general.py index a8181bbaf5ee..f0a7859ff78a 100755 --- a/utils/general.py +++ b/utils/general.py @@ -40,6 +40,7 @@ NUM_THREADS = min(8, max(1, os.cpu_count() - 1)) # number of YOLOv5 multiprocessing threads VERBOSE = str(os.getenv('YOLOv5_VERBOSE', True)).lower() == 'true' # global verbose mode FONT = 'Arial.ttf' # https://ultralytics.com/assets/Arial.ttf +NM_INTEGRATED=True torch.set_printoptions(linewidth=320, precision=5, profile='long') np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format}) # format short g, %precision=5 @@ -405,7 +406,11 @@ def check_file(file, suffix=''): return file else: # search files = [] + if "models_v5.0/" in file: + files.extend(glob.glob(str(ROOT / '**' / file), recursive=True)) for d in 'data', 'models', 'utils': # search directories + if file.startswith(d + os.path.sep): + file = file[len(d)+1:] files.extend(glob.glob(str(ROOT / d / '**' / file), recursive=True)) # find file assert len(files), f'File not found: {file}' # assert file was found assert len(files) == 1, f"Multiple files match '{file}', specify exact path: {files}" # assert unique