Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ultralytics 8.3.22 #3038

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def validate_ov_model(
) -> Tuple[Dict, int, int]:
validator.seen = 0
validator.jdict = []
validator.stats = []
validator.stats = dict(tp_m=[], tp=[], conf=[], pred_cls=[], target_cls=[], target_img=[])
validator.batch_i = 1
validator.confusion_matrix = ConfusionMatrix(nc=validator.nc)
compiled_model = ov.compile_model(ov_model, device_name="CPU")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def validate(
) -> Tuple[Dict, int, int]:
validator.seen = 0
validator.jdict = []
validator.stats = []
validator.stats = dict(tp_m=[], tp=[], conf=[], pred_cls=[], target_cls=[], target_img=[])
validator.batch_i = 1
validator.confusion_matrix = ConfusionMatrix(nc=validator.nc)

Expand Down Expand Up @@ -101,13 +101,12 @@ def print_statistics(stats: np.ndarray, total_images: int, total_objects: int) -


def prepare_validation(model: YOLO, args: Any) -> Tuple[Validator, torch.utils.data.DataLoader]:
validator = model.smart_load("validator")(args)
validator = model.task_map[model.task]["validator"](args=args)
validator.data = check_det_dataset(args.data)
validator.stride = 32

data_loader = validator.get_dataloader(f"{DATASETS_DIR}/coco128-seg", 1)

validator = model.smart_load("validator")(args)

validator.is_coco = True
validator.class_map = coco80_to_coco91_class()
validator.names = model.model.names
Expand Down Expand Up @@ -146,7 +145,7 @@ def validation_ac(
) -> float:
validator.seen = 0
validator.jdict = []
validator.stats = []
validator.stats = dict(tp_m=[], tp=[], conf=[], pred_cls=[], target_cls=[], target_img=[])
validator.batch_i = 1
validator.confusion_matrix = ConfusionMatrix(nc=validator.nc)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ultralytics==8.0.170
ultralytics==8.3.22
onnx==1.16.0
openvino==2024.4
5 changes: 3 additions & 2 deletions examples/post_training_quantization/openvino/yolov8/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validate(
) -> Tuple[Dict, int, int]:
validator.seen = 0
validator.jdict = []
validator.stats = []
validator.stats = dict(tp=[], conf=[], pred_cls=[], target_cls=[], target_img=[])
validator.confusion_matrix = ConfusionMatrix(nc=validator.nc)
model.reshape({0: [1, 3, -1, -1]})
compiled_model = ov.compile_model(model, device_name="CPU")
Expand Down Expand Up @@ -66,8 +66,9 @@ def print_statistics(stats: np.ndarray, total_images: int, total_objects: int) -


def prepare_validation(model: YOLO, args: Any) -> Tuple[Validator, torch.utils.data.DataLoader]:
validator = model.smart_load("validator")(args)
validator = model.task_map[model.task]["validator"](args=args)
validator.data = check_det_dataset(args.data)
validator.stride = 32
dataset = validator.data["val"]
print(f"{dataset}")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ultralytics==8.0.170
ultralytics==8.3.22
onnx>=1.12.0,<1.16.2
openvino==2024.4
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def validate(
) -> Tuple[Dict, int, int]:
validator.seen = 0
validator.jdict = []
validator.stats = []
validator.stats = dict(tp_m=[], tp=[], conf=[], pred_cls=[], target_cls=[], target_img=[])
validator.batch_i = 1
validator.confusion_matrix = ConfusionMatrix(nc=validator.nc)
model.reshape({0: [1, 3, -1, -1]})
Expand Down Expand Up @@ -92,15 +92,14 @@ def print_statistics(stats: np.ndarray, total_images: int, total_objects: int) -


def prepare_validation(model: YOLO, args: Any) -> Tuple[Validator, torch.utils.data.DataLoader]:
validator = model.smart_load("validator")(args)
validator = model.task_map[model.task]["validator"](args=args)
validator.data = check_det_dataset(args.data)
validator.stride = 32
dataset = validator.data["val"]
print(f"{dataset}")

data_loader = validator.get_dataloader(f"{DATASETS_DIR}/coco128-seg", 1)

validator = model.smart_load("validator")(args)

validator.is_coco = True
validator.class_map = coco80_to_coco91_class()
validator.names = model.model.names
Expand Down Expand Up @@ -146,7 +145,7 @@ def validation_ac(
) -> float:
validator.seen = 0
validator.jdict = []
validator.stats = []
validator.stats = dict(tp_m=[], tp=[], conf=[], pred_cls=[], target_cls=[], target_img=[])
validator.batch_i = 1
validator.confusion_matrix = ConfusionMatrix(nc=validator.nc)
num_outputs = len(compiled_model.outputs)
Expand Down Expand Up @@ -211,6 +210,7 @@ def main():
model = YOLO(f"{ROOT}/{MODEL_NAME}.pt")
args = get_cfg(cfg=DEFAULT_CFG)
args.data = "coco128-seg.yaml"
args.workers = 0

# Prepare validation dataset and helper
validator, data_loader = prepare_validation(model, args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ultralytics==8.0.170
ultralytics==8.3.22
onnx>=1.12.0,<1.16.2
openvino==2024.4
1 change: 1 addition & 0 deletions tests/cross_fw/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def test_examples(
env["PYTHONPATH"] = str(PROJECT_ROOT) # need this to be able to import from tests.* in run_example.py
env["ONEDNN_MAX_CPU_ISA"] = "AVX2" # Set ISA to AVX2 to get CPU independent results
env["CUDA_VISIBLE_DEVICES"] = "" # Disable GPU
env["YOLO_VERBOSE"] = "False" # Set ultralytics to quiet mode

metrics_file_path = tmp_path / "metrics.json"
python_executable_with_venv = get_python_executable_with_venv(venv_path)
Expand Down
Loading