Skip to content

Commit

Permalink
mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderDokuchaev committed Nov 15, 2024
1 parent 11b4c48 commit 1d62b66
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

ROOT = Path(__file__).parent.resolve()
DATASET_PATH = Path().home() / ".cache" / "nncf" / "datasets"
DATASET_PATH.mkdir(parents=True, exist_ok=True)

# Overwrite dataset path to avoid downloading COCO dataset to NNCF git root directory
SETTINGS.update(datasets_dir=DATASET_PATH.as_posix())
Expand Down Expand Up @@ -110,13 +109,12 @@ def print_statistics(stats: Dict[str, float], total_images: int, total_objects:


def prepare_validation(model: YOLO, args: Any) -> Tuple[SegmentationValidator, torch.utils.data.DataLoader]:
coco_data_path = DATASET_PATH / "coco128-seg"
coco_data_path.mkdir(parents=True, exist_ok=True)

validator: SegmentationValidator = model.task_map[model.task]["validator"](args=args)
validator.data = check_det_dataset(args.data)
validator.stride = 32

coco_data_path = DATASET_PATH / "coco128-seg"
data_loader = validator.get_dataloader(coco_data_path.as_posix(), 1)

validator.is_coco = True
validator.class_map = coco80_to_coco91_class()
validator.names = model.model.names
Expand All @@ -125,6 +123,8 @@ def prepare_validation(model: YOLO, args: Any) -> Tuple[SegmentationValidator, t
validator.process = ops.process_mask
validator.plot_masks = []

data_loader = validator.get_dataloader(coco_data_path.as_posix(), 1)

return validator, data_loader


Expand Down
12 changes: 6 additions & 6 deletions examples/post_training_quantization/openvino/yolov8/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
MODEL_NAME = "yolov8n"

ROOT = Path(__file__).parent.resolve()
DATASET_PATH = Path().home() / ".cache" / "nncf" / "datasets"
DATASET_PATH.mkdir(parents=True, exist_ok=True)
DATASET_PATH = Path().home() / ".cache3" / "nncf" / "datasets"

# Overwrite dataset path to avoid downloading COCO dataset to NNCF git root directory
SETTINGS.update(datasets_dir=DATASET_PATH.as_posix())
Expand Down Expand Up @@ -73,19 +72,20 @@ def print_statistics(stats: Dict[str, float], total_images: int, total_objects:


def prepare_validation(model: YOLO, args: Any) -> Tuple[DetectionValidator, torch.utils.data.DataLoader]:
coco_data_path = DATASET_PATH / "coco128"
coco_data_path.mkdir(parents=True, exist_ok=True)

validator: DetectionValidator = model.task_map[model.task]["validator"](args=args)
validator.data = check_det_dataset(args.data)
validator.stride = 32

coco_data_path = DATASET_PATH / "coco128"
data_loader = validator.get_dataloader(coco_data_path.as_posix(), 1)

validator.is_coco = True
validator.class_map = coco80_to_coco91_class()
validator.names = model.model.names
validator.metrics.names = validator.names
validator.nc = model.model.model[-1].nc

data_loader = validator.get_dataloader(coco_data_path.as_posix(), 1)

return validator, data_loader


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

ROOT = Path(__file__).parent.resolve()
DATASET_PATH = Path().home() / ".cache" / "nncf" / "datasets"
DATASET_PATH.mkdir(parents=True, exist_ok=True)

# Overwrite dataset path to avoid downloading COCO dataset to NNCF git root directory
SETTINGS.update(datasets_dir=DATASET_PATH.as_posix())
Expand Down Expand Up @@ -98,13 +97,12 @@ def print_statistics(stats: Dict[str, float], total_images: int, total_objects:


def prepare_validation(model: YOLO, args: Any) -> Tuple[SegmentationValidator, torch.utils.data.DataLoader]:
coco_data_path = DATASET_PATH / "coco128-seg"
coco_data_path.mkdir(parents=True, exist_ok=True)

validator: SegmentationValidator = model.task_map[model.task]["validator"](args=args)
validator.data = check_det_dataset(args.data)
validator.stride = 32

coco_data_path = DATASET_PATH / "coco128-seg"
data_loader = validator.get_dataloader(coco_data_path.as_posix(), 1)

validator.is_coco = True
validator.class_map = coco80_to_coco91_class()
validator.names = model.model.names
Expand All @@ -113,6 +111,8 @@ def prepare_validation(model: YOLO, args: Any) -> Tuple[SegmentationValidator, t
validator.process = ops.process_mask
validator.plot_masks = []

data_loader = validator.get_dataloader(coco_data_path.as_posix(), 1)

return validator, data_loader


Expand Down

0 comments on commit 1d62b66

Please sign in to comment.