|
|
@ -1,4 +1,6 @@
|
|
|
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
|
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import shutil
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
import cv2
|
|
|
|
import cv2
|
|
|
@ -224,20 +226,22 @@ def test_results():
|
|
|
|
|
|
|
|
|
|
|
|
def test_data_utils():
|
|
|
|
def test_data_utils():
|
|
|
|
# Test functions in ultralytics/data/utils.py
|
|
|
|
# Test functions in ultralytics/data/utils.py
|
|
|
|
from ultralytics.data.utils import autosplit, zip_directory
|
|
|
|
from ultralytics.data.utils import HUBDatasetStats, autosplit, zip_directory
|
|
|
|
|
|
|
|
from ultralytics.utils.downloads import download
|
|
|
|
|
|
|
|
|
|
|
|
# from ultralytics.utils.files import WorkingDirectory
|
|
|
|
# from ultralytics.utils.files import WorkingDirectory
|
|
|
|
# with WorkingDirectory(ROOT.parent / 'tests'):
|
|
|
|
# with WorkingDirectory(ROOT.parent / 'tests'):
|
|
|
|
|
|
|
|
|
|
|
|
autosplit()
|
|
|
|
Path('tests/coco8.zip').unlink(missing_ok=True)
|
|
|
|
zip_directory(ROOT / 'assets') # zip
|
|
|
|
Path('coco8.zip').unlink(missing_ok=True)
|
|
|
|
Path(ROOT / 'assets.zip').unlink() # delete zip
|
|
|
|
download('https://github.com/ultralytics/hub/raw/master/example_datasets/coco8.zip', unzip=False)
|
|
|
|
|
|
|
|
shutil.move('coco8.zip', 'tests')
|
|
|
|
# from ultralytics.data.utils import HUBDatasetStats
|
|
|
|
shutil.rmtree('tests/coco8', ignore_errors=True)
|
|
|
|
# from ultralytics.utils.downloads import download
|
|
|
|
stats = HUBDatasetStats('tests/coco8.zip', task='detect')
|
|
|
|
# Path('coco8.zip').unlink(missing_ok=True)
|
|
|
|
stats.get_json(save=False)
|
|
|
|
# download('https://github.com/ultralytics/hub/raw/master/example_datasets/coco8.zip', unzip=False)
|
|
|
|
stats.process_images()
|
|
|
|
# shutil.move('coco8.zip', 'tests')
|
|
|
|
|
|
|
|
# stats = HUBDatasetStats('tests/coco8.zip', task='detect')
|
|
|
|
autosplit('tests/coco8')
|
|
|
|
# stats.get_json(save=False)
|
|
|
|
zip_directory('tests/coco8/images/val') # zip
|
|
|
|
# stats.process_images()
|
|
|
|
shutil.rmtree('tests/coco8', ignore_errors=True)
|
|
|
|
|
|
|
|
shutil.rmtree('tests/coco8-hub', ignore_errors=True)
|
|
|
|