Add docstrings and improve comments (#11229)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-05-03 22:51:26 +02:00 committed by GitHub
parent ccfc1cf925
commit d5458f27cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 34 additions and 17 deletions

View file

@ -19,6 +19,7 @@ def test_checks():
assert torch.cuda.is_available() == CUDA_IS_AVAILABLE
assert torch.cuda.device_count() == CUDA_DEVICE_COUNT
@pytest.mark.slow
@pytest.mark.skipif(not CUDA_IS_AVAILABLE, reason="CUDA is not available")
def test_export_engine():

View file

@ -345,12 +345,12 @@ def test_labels_and_crops():
labels = save_path / f"labels/{im_name}.txt"
assert labels.exists()
# Check detections match label count
assert len(r.boxes.data) == len([l for l in labels.read_text().splitlines() if l])
assert len(r.boxes.data) == len([line for line in labels.read_text().splitlines() if line])
# Check crops path and files
crop_dirs = [p for p in (save_path / "crops").iterdir()]
crop_dirs = list((save_path / "crops").iterdir())
crop_files = [f for p in crop_dirs for f in p.glob("*")]
# Crop directories match detections
assert all([r.names.get(c) in {d.name for d in crop_dirs} for c in cls_idxs])
assert all(r.names.get(c) in {d.name for d in crop_dirs} for c in cls_idxs)
# Same number of crops as detections
assert len([f for f in crop_files if im_name in f.name]) == len(r.boxes.data)
@ -643,8 +643,8 @@ def test_yolo_world():
model(ASSETS / "bus.jpg", conf=0.01)
model = YOLO("yolov8s-worldv2.pt") # no YOLOv8n-world model yet
# Training from pretrain, evaluation process is included at the final stage of training.
# Use dota8.yaml which has less categories to reduce the inference time of CLIP model
# Training from a pretrained model. Eval is included at the final stage of training.
# Use dota8.yaml which has fewer categories to reduce the inference time of CLIP model
model.train(
data="dota8.yaml",
epochs=1,